Table of Contents

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
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 int

The source vertex from where paths originate.

target int

The target vertex to which paths should lead.

shortestPathCount int

The 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

Returns

bool