Ranked Shortest Path - KeRNeLith/QuikGraph GitHub Wiki

Ranked Shortest Path Algorithm

This is a variation of the Shortest Path algorithm where not only the first one, but k-th shortest paths are returned

The Hoffman-Pavlet algorithm provides an implementation this problem for directed weighted graph with positive weights.

IBidirectionalGraph<TVertex, TEdge> graph = ...;
Func<TEdge, double> edgeWeights = ...;
TVertex source = ...;
TVertex target = ...;
int maxPathCount = 5;

foreach(IEnumerable<TEdge> path in graph.RankedShortestPathHoffman(edgeWeights, source, target, maxPathCount))
{
...
}
⚠️ **GitHub.com Fallback** ⚠️