⚡ AlgoZen_
~/home/graphs/dijkstra's_algorithm3 / 3

Dijkstra's Algorithm

Advanced

Find the shortest path from a source to all other nodes in a weighted graph. Greedily picks the nearest unvisited node and relaxes its edges.

time:O((V + E) log V)
space:O(V)
⚡ +400_XP
step[1/18]
> Init
425172
A
B
C
D
E
Initialize distances: A=0, all others=∞. Pick the unvisited node with smallest distance.

// tap NEXT STEP to walk through one step at a time