What It Does

Dijkstra's algorithm finds the shortest path from a single starting node to all other nodes in a graph with non-negative edge weights.

High-Level Steps

  1. Set the starting node distance to 0 and all others to infinity.
  2. Pick the unvisited node with the smallest known distance.
  3. Update distances of its neighbors and repeat until done.

Visual Idea

Animation demonstrating shortest path updates in Dijkstra's algorithm

This animation shows how shortest distances are updated as the algorithm explores nodes.

Learn More

Visit Wikipedia's Dijkstra's Algorithm page for detailed explanations and pseudocode.