← Back to Examples

Dijkstra's Algorithm Explained

Dijkstra finds the shortest path from a start node to all other nodes.

It works by always exploring the nearest unvisited node next.

Shortest Distance from A to Each Node:
Watch how these values update as the algorithm explores the graph
A
0
B
C
D
E
F
Click "Start" to find shortest paths from A to all nodes
Currently Exploring
Distance Finalized
Not Yet Processed
Shortest Path

How it works:

Code Example

Loading code...