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
graph
IEdgeWeightedDigraph<double>The graph to find the shortest paths in.
sources
IEnumerable<int>The source vertexes to find the shortest paths from.
Exceptions
- ArgumentException
graph
contains negative weights.
Methods
Distance(int)
Gets the distance from the source to the sink.
public double Distance(int sourceVertex)
Parameters
sourceVertex
int
Returns
Exceptions
GetPath(int)
Gets the path from the source to the sink.
public DirectedPath<double> GetPath(int vertex)
Parameters
vertex
int
Returns
Exceptions
PathExists(int)
public bool PathExists(int vertex)
Parameters
vertex
int