Professional Documents
Culture Documents
2
Quick Solutions
3
Quick Solution
4
Floyd-Warshall
5
Representation of the Input
wij= 0 if i=j
wij= w(i,j) if ij and (i,j) in E
wij= if ij and (i,j) not in E
6
Format of the Output
7
Intermediate Vertices
8
Key Definition
9
Remark 1
10
Remark 2
11
Remark 2
12
Recursive Formulation
13
The Floyd-Warshall Algorithm
Floyd-Warshall(W)
n = # of rows of W;
D(0) = W;
for k = 1 to n do
for i = 1 to n do
for j = 1 to n do
dij(k) = min{dij(k-1) , dik(k-1) + dkj(k-1)};
od;
od;
od;
return D(n);
14
Time and Space Requirements
15