Dijkstra’s Algorithm definition
Dijkstra’s algorithm computes shortest-path distances from a start vertex in a graph with nonnegative edge weights.
Dijkstra’s Algorithm in a picture
How it works
Set the start’s tentative distance to zero and the others to infinity. Settle an unsettled vertex with the smallest tentative distance, then improve its neighbors’ estimates when going through it gives a smaller value. Repeat until every reachable vertex is settled.
Worked examples
Start at A with edges A → B of weight 3 and A → C of weight 8. Which settles next?
B, since its tentative distance is 3.
If B → C costs 2, what is the new estimate for C?
3 + 2 = 5, improving on 8.
What distance stays for an unreachable vertex?
Infinity in the usual initialization and representation.
Common mistake
Use a smallest tentative total distance from the start. Selecting the smallest individual edge anywhere is a different rule.
Quick check
Can a weight be zero?
Show answer
Yes.
What is updating a neighbor’s estimate commonly called?
Show answer
Relaxing the edge.
Sources
Flashcard
Dijkstra’s Algorithm
Reveal the definition
Dijkstra’s algorithm computes shortest-path distances from a start vertex in a graph with nonnegative edge weights.
Effortless Math. “Dijkstra’s Algorithm.” Math Dictionary.



