Extend-Shortest-Paths(D,W) ; (A, B) n = rows(D) initialize D' ; n x n matrix (C) for i = 1 to n for j = 1 to n ; (initialize to 0) for k = 1 to n ; ( ) return D' ; (C)
Slow-APSP(W) n = rows(W) D(1) = W for m = 2 to n-1 D(m) = Extend-Shortest-Paths(D(m-1), W) return D(n-1)
Running times:
Extend-Shortest-Paths: Slow-APSP: