The Floyd-Warshall Algorithm
- Number the vertices of G by {1,2,…,n}.
- Consider all paths from i to j whose intermediate vertices are all drawn
from {1,2,…,k}
- Let p be the one with minimum weight from the aforementioned paths
- If k∈/p, then all intermediate vertices of p belong to
{1,2,…,k−1}
- If k∈p, decompose p into
i⇝p1k⇝p2j, the intermediate
vertices of the two resulting paths are also in {1,2,…,k−1}
dij(k)={wij,min{dij(k−1),dik(k−1)+dkj(k−1)},k=0k≥1
- The final result is given by D(n)
- Θ(n3)