forked from YaccConstructor/QuickGraph
-
-
Notifications
You must be signed in to change notification settings - Fork 71
Ranked Shortest Path
Alexandre Rabérin edited this page May 12, 2020
·
1 revision
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))
{
...
}