Skip to content
GraphsShortest Pathcore

Dijkstra's

Grows a tree of shortest paths from the start, always settling the unvisited node with the smallest known distance and relaxing its edges. Optimal for graphs with non-negative weights.

Best
O(E log V)
Average
O(E log V)
Worst
O(E log V)
Space
O(V)