1. dist[s] ← 0 (distance to source vertex is zero)
2. for all v ∈ V–{s} do dist[v] ← ∞ (set all other distances to infinity)
3. S ← ∅ (S, the set of visited vertices is initially empty)
4. Q ← V (Q, the queue initially contains all vertices)
6. u ← mindistance(Q,dist) (select the element of Q with the min. distance)
7. S ← S ∪ {u} (add u to list of visited vertices)
8. for all v ∈ neighbors[u] do
9. if dist[v] > dist[u] + w(u, v) (if new shortest path found)
10. then dist[v] ← d[u] + w(u, v) (set new value of shortest path)