Table 1.
Procedure shortestPath(G,s) | |
For each v in G | 1 |
L(v) = ∞ | 2 |
3 | |
L(s) = 0 | 4 |
Q = V // Add all the vertices to Q | 5 |
6 | |
while Q ≠ NULL | 7 |
u = EXTRACT_MIN(Q) | 8 |
for each v in Adj(u) | 9 |
if L(v) > L(u) + d(u,v) // L(v) = min(L(v),L(u)+d(u,v)) | 10 |
L(v) = L(u)+d(u,v) | 11 |
return L | 12 |