Skip to main content

dijkstra

Function dijkstra 

Source
pub fn dijkstra<G: Graph + ?Sized>(
    graph: &G,
    start: usize,
    goal: usize,
) -> Option<(Vec<usize>, f64)>
Expand description

A shortest path by Dijkstra’s algorithm, with its cost; None if goal is unreachable. The reference for tests and the baseline for benches.

§Panics

Panics if start or goal is not a vertex of the graph.