Dijkstra’s Algorithm#

Dijkstra’s algorithm finds the shortest path from a source node to every other node in a weighted graph (with non-negative edge weights). It works by greedily extracting the closest unvisited node and relaxing its neighbors.

Visualization#

Click Next to step through Dijkstra’s algorithm starting from node A.

Source: A
Dijkstra's algorithm step-through visualizationA weighted graph with nodes and edges showing shortest path computation.