Interface IShortestPath<TWeight>
- Namespace
- AlgorithmsSW.EdgeWeightedDigraph
- Assembly
- AlgorithmsSW.dll
Algorithm to find the shortest path from a source vertex to all other vertices in a edge weighted digraph.
public interface IShortestPath<TWeight>
Type Parameters
TWeight
The type of the edge weights.
- Extension Methods
Methods
GetDistanceTo(int)
Gets the distance from the source vertex to the given vertex.
TWeight GetDistanceTo(int vertex)
Parameters
vertex
intThe vertex to find the distance to.
Returns
- TWeight
The distance from the source vertex to the given vertex.
GetEdgesOfPathTo(int)
Gets the path from the source vertex to the given vertex.
IEnumerable<DirectedEdge<TWeight>> GetEdgesOfPathTo(int target)
Parameters
target
intThe vertex to find the path to.
Returns
- IEnumerable<DirectedEdge<TWeight>>
An enumerable of edges representing the path from the source vertex to the given vertex.
Exceptions
- InvalidOperationException
+there is no path from the source vertex to the given vertex.
HasPathTo(int)
Whether there is a path from the source vertex to the given vertex.
bool HasPathTo(int vertex)
Parameters
vertex
intThe vertex to check if there is a path to.