Function daggy::petgraph::algo::dijkstra [] [src]

pub fn dijkstra<'a, G, K, F, Edges>(graph: &'a G, start: G::NodeId, goal: Option<G::NodeId>, edges: F) -> HashMap<G::NodeId, K, RandomState> where Edges: Iterator<Item=(G::NodeId, K)>, F: FnMut(&'a G, G::NodeId) -> Edges, G: Visitable, K: Default + Add<K, Output=K> + Copy + PartialOrd<K>, G::NodeId: Eq, G::NodeId: Hash

Dijkstra's shortest path algorithm.

Compute the length of the shortest path from start to every reachable node.

The graph should be Visitable, and edges a closure that maps a node identifier to an iterator of (n, k) pairs where n is an adjacent node and k the edge weight.

If goal is not None, then the algorithm terminates once the goal node's cost is calculated.

Returns a HashMap that maps NodeId to path cost.