Skip to main content

dijkstra

Function dijkstra 

Source
pub fn dijkstra(graph: &Graph, start_node: NodeId) -> HashMap<NodeId, f64>
Expand description

Computes shortest distances from start node to all reachable nodes.

§Arguments

  • graph - The graph with edge weights
  • start_node - The starting node

§Returns

HashMap mapping each reachable node to its shortest distance from start_node