问题2: 为什么8,)=-”?
问题3: 如果定义矩阵L=(),L1,L2, .,L”-1分别表示什么含义? 如何去计算L
自底向上计算 The heart of the algorithm is the following procedure,which,given matrices L()and W,returns the matrix L(m).That is,it extends the shortest paths com- puted so far by one more edge. EXTEND-SHORTEST-PATHS(L,W) 1 n L.rows 2 let L'= (be a new nx nmatrix 问题4: 3 for i=1 to n 4 for j 1to n 5 号=∞ one more 6 for k 1to n 7 号=min(5,lk+0对) edge”体现在 8 return L' 哪里?
自底向上计算
只需要扩展n-2次 SLOW-ALL-PAIRS-SHORTEST-PATHS(W) 1 n W.rows 2L0=W 3 for m 2to n-1 2 4 let L m)be a new nmatrix 5 L)=EXTEND-SHORTEST-PATHS(L-W) 6 return L(-1) 6 3 8 4 0 2 0 L() 0 1 7 L2= 3 40 304- 84051 471 2 2 00 06 0 506
只需要扩展n-2次
问题5: 为什么上述算法被称为“慢” 算法,为什么它可能被加快?