Class DijkstraMultiSource
- Namespace
- AlgorithmsSW.EdgeWeightedDigraph
- Assembly
- AlgorithmsSW.dll
A modified version of Dijkstra's algorithm that finds the shortest path from any source to any vertex.
[ExerciseReference(4, 4, 24)]
public class DijkstraMultiSource
- Inheritance
-
DijkstraMultiSource
- Inherited Members
- Extension Methods
Constructors
DijkstraMultiSource(IEdgeWeightedDigraph<double>, IEnumerable<int>)
Initializes a new instance of the DijkstraMultiSource class.
public DijkstraMultiSource(IEdgeWeightedDigraph<double> graph, IEnumerable<int> sources)
Parameters
graphIEdgeWeightedDigraph<double>The graph to find the shortest paths in.
sourcesIEnumerable<int>The source vertexes to find the shortest paths from.
Exceptions
- ArgumentException
graphcontains negative weights.
Methods
Distance(int)
Gets the distance from the source to the sink.
public double Distance(int sourceVertex)
Parameters
sourceVertexint
Returns
Exceptions
GetPath(int)
Gets the path from the source to the sink.
public DirectedPath<double> GetPath(int vertex)
Parameters
vertexint
Returns
Exceptions
PathExists(int)
public bool PathExists(int vertex)
Parameters
vertexint