Class EuclideanDistanceDigraph
- Namespace
- AlgorithmsSW.EdgeWeightedDigraph
- Assembly
- AlgorithmsSW.dll
A digraph where the weight of the edges is the euclidean distance between the vertexes, which are points in 3D space.
[ExerciseReference(4, 4, 27)]
public class EuclideanDistanceDigraph : IEdgeWeightedDigraph<double>, IReadOnlyEdgeWeightedDigraph<double>, IReadOnlyDigraph, IEnumerable<(int vertex0, int vertex1)>, IEnumerable
- Inheritance
-
EuclideanDistanceDigraph
- Implements
- Inherited Members
- Extension Methods
Constructors
EuclideanDistanceDigraph(IEnumerable<Vector3>)
Initializes a new instance of the EuclideanDistanceDigraph class.
public EuclideanDistanceDigraph(IEnumerable<Vector3> vertexes)
Parameters
vertexes
IEnumerable<Vector3>The spatial representation of the vertexes.
Properties
EdgeCount
Gets the number of edges in the graph.
public int EdgeCount { get; }
Property Value
SupportsParallelEdges
public bool SupportsParallelEdges { get; }
Property Value
SupportsSelfLoops
public bool SupportsSelfLoops { get; }
Property Value
VertexCount
Gets the number of vertices in the graph.
public int VertexCount { get; }
Property Value
WeightedEdges
Gets the edges that is part of this IReadOnlyEdgeWeightedDigraph<TWeight>.
public IEnumerable<DirectedEdge<double>> WeightedEdges { get; }
Property Value
Methods
AddEdge(DirectedEdge<double>)
Adds an edge to the graph.
public void AddEdge(DirectedEdge<double> edge)
Parameters
edge
DirectedEdge<double>The edge to add.
AddEdge(int, int)
Adds an edge to the digraph.
public void AddEdge(int source, int target)
Parameters
GetAdjacents(int)
Gets the adjacent vertices of a given vertex.
public IEnumerable<int> GetAdjacents(int vertex)
Parameters
vertex
intThe vertex to find adjacents for.
Returns
- IEnumerable<int>
An enumerable of adjacent vertices.
GetEnumerator()
Returns an enumerator that iterates through the collection.
public IEnumerator<(int vertex0, int vertex1)> GetEnumerator()
Returns
- IEnumerator<(int vertex0, int vertex1)>
An enumerator that can be used to iterate through the collection.
GetIncidentEdges(int)
Gets the edges that is incident to the given vertex.
public IEnumerable<DirectedEdge<double>> GetIncidentEdges(int vertex)
Parameters
vertex
intThe vertex to get the incident edges of.
Returns
- IEnumerable<DirectedEdge<double>>
An enumerable of incident edges.
MakeEdge(int, int)
public DirectedEdge<double> MakeEdge(int source, int target)
Parameters
Returns
RemoveEdge(DirectedEdge<double>)
Removes an edge from the graph.
public bool RemoveEdge(DirectedEdge<double> edge)
Parameters
edge
DirectedEdge<double>The edge to remove.