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
TWeightThe 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
digraphIEdgeWeightedDigraph<TWeight>The directed graph in which to find the paths.
sourceintThe source vertex from where paths originate.
targetintThe target vertex to which paths should lead.
shortestPathCountintThe number of shortest paths to find.
Methods
GetPath(int)
public DirectedPath<TWeight> GetPath(int rank)
Parameters
rankint
Returns
- DirectedPath<TWeight>
HasPath(int)
public bool HasPath(int k)
Parameters
kint