Class YensAlgorithm<TWeight>
- Namespace
- AlgorithmsSW.EdgeWeightedDigraph
- Assembly
- AlgorithmsSW.dll
An implementation of Yen's algorithm of finding the k shortest paths between vertices in a directed edge weighted graph.
[ExerciseReference(4, 4, 7)]
public class YensAlgorithm<TWeight> : IKShortestPaths<TWeight> where TWeight : INumber<TWeight>, IMinMaxValue<TWeight>
Type Parameters
TWeight
The type of the edge weights.
- Inheritance
-
YensAlgorithm<TWeight>
- Implements
-
IKShortestPaths<TWeight>
- Inherited Members
- Extension Methods
Constructors
YensAlgorithm(IEdgeWeightedDigraph<TWeight>, int, int, int)
Initializes a new instance of the YensAlgorithm<TWeight> class.
public YensAlgorithm(IEdgeWeightedDigraph<TWeight> digraph, int source, int target, int shortestPathCount)
Parameters
digraph
IEdgeWeightedDigraph<TWeight>The directed graph in which to find the paths.
source
intThe source vertex from where paths originate.
target
intThe target vertex to which paths should lead.
shortestPathCount
intThe number of shortest paths to find.
Methods
GetPath(int)
public DirectedPath<TWeight> GetPath(int rank)
Parameters
rank
int
Returns
- DirectedPath<TWeight>
HasPath(int)
public bool HasPath(int k)
Parameters
k
int