Skip to main content

Module dijkstra

Module dijkstra 

Source
Expand description

Dijkstra’s shortest path algorithm

Finds shortest paths from a source node to all other nodes in a graph with non-negative edge weights.

Time complexity: O((V + E) log V) using a binary heap.

Functions§

dijkstra
Run Dijkstra’s algorithm from a source node
dijkstra_with_paths
Find shortest paths from source to all nodes, returning predecessors
reconstruct_path
Reconstruct path from predecessors map
shortest_path
Find shortest path between two nodes, returning the full node sequence.