pub fn yen_k_shortest<N, FN, I>(
src: N,
dest: N,
k: usize,
neighbors: FN,
) -> Vec<YenPath<N>>Expand description
Find up to k shortest loopless paths from src to dest.
Uses Yen’s algorithm with Dijkstra as the inner shortest-path routine.
§Arguments
src- source nodedest- destination nodek- maximum number of paths to findneighbors- closure returning (neighbor, edge_cost) pairs for a node
Returns paths sorted by ascending cost. May return fewer than k paths
if fewer distinct loopless paths exist.