Flowcharts & Processes

Dijkstra's Algorithm Step-by-Step

Flowcharts & Algorithms diagram · made in Skemio

Flowchart tracing Dijkstra's algorithm from initializing distances to extracting min node from priority queue, relaxing neighbors, and finishing.
Flowchart tracing Dijkstra's algorithm from initializing distances to extracting min node from priority queue, relaxing neighbors, and finishing.

What it shows

  • Uses a priority queue (min-heap) to extract the nearest unvisited node.
  • Relaxes edge weights: dist[v] = min(dist[v], dist[u] + weight).
  • Requires non-negative weights; runs in O((V + E) log V) with heaps.

The takeaway

Dijkstra is greedy relaxation: visit the closest unvisited node, update its neighbors, and repeat.

More flowcharts & algorithms diagrams