Skip to main content

k_shortest_paths

Function k_shortest_paths 

Source
pub fn k_shortest_paths(
    graph: &Graph,
    from: &[usize],
    to: &[usize],
    weight: &[f64],
    source: usize,
    target: usize,
    k: usize,
) -> Vec<Route>
Expand description

Yen’s algorithm for the k loopless shortest paths from source to target. Returns up to k routes in increasing cost order; Yen operates on the simple-graph abstraction where parallel edges collapse to the minimum weight, so each route’s edges are those minimum-weight edges.