def dijkstra(G, s):
N' = {s}
for each node v in G:
if v != s:
D(v) = c(s, v)
p(v) = s
while N' != N:
find v not in N' such that D(v) is a minimum
add v to N'
update D(w) for each neighbor w of v and not in N':
D(w) = min{D(w), D(v) + c(v, w)}
p(w) = v