Class OverlappingYensAlgorithm<TWeight>
- Namespace
- AlgorithmsSW.EdgeWeightedDigraph
- Assembly
- AlgorithmsSW.dll
This is like YensAlgorithm<TWeight>, but instead of looking for a fixed number of shortest paths, it looks for shortest paths until the intersection among all paths found is empty. This particular version is used to implement a more efficient version of finding critical edges.
[ExerciseReference(4, 4, 7)]
public class OverlappingYensAlgorithm<TWeight> : IKShortestPaths<TWeight> where TWeight : INumber<TWeight>, IMinMaxValue<TWeight>
Type Parameters
TWeight
The type of the edge weights.
- Inheritance
-
OverlappingYensAlgorithm<TWeight>
- Implements
-
IKShortestPaths<TWeight>
- Inherited Members
- Extension Methods
Constructors
OverlappingYensAlgorithm(IEdgeWeightedDigraph<TWeight>, int, int)
Initializes a new instance of the OverlappingYensAlgorithm<TWeight> class.
public OverlappingYensAlgorithm(IEdgeWeightedDigraph<TWeight> digraph, int source, int target)
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.
Properties
CriticalEdges
public ISet<(int, int)>? CriticalEdges { get; }
Property Value
PathRank
public int PathRank { get; }
Property Value
Methods
GetPath(int)
Gets the kth shortest path, if it exist, starting from 0, among all shortest paths that have a non-zero intersection.
public DirectedPath<TWeight> GetPath(int rank)
Parameters
rank
intThe rank (lowest rank 0 is the shortest) of the path to get.
Returns
- DirectedPath<TWeight>
The path with the given rank.
Exceptions
- InvalidOperationException
A path of the given rank does not exist.
HasPath(int)
public bool HasPath(int k)
Parameters
k
int