Start with d(A)=0,
d(i) = l (Ai), if i∈ΓA; Γi ≡ set of neighbor vertices of vertex i,l(ij) = length of arc from vertex i to vertex j.
= ∞, otherwise (∞ is a large number defined below);
Assign S = V-{A}, where V is the set of vertices in the given graph.
Assign P(i) = A, ∀i∈S.