DIJKSTRA ( V, E, s )
for each v in V
d[v] := oo; ("infinity")
pred[v] := NULL;
end for
d[s] := 0;
S := {};
V' := V;
while ( V' is not empty ) do
find a vertex u in V' such that d[u] is minimum;
V' := V' - {u};
S := S U {u};
for each edge e = (u,v) in E
if ( v is not in S ) and ( d[v] > d[u] + w(u,v) ) then
d[v] := d[u] + w(u,v);
pred[v] := u;
end if
end for
end while
END
At each iteration of the while loop we add a vertex