演算法›Ch4 圖論演算法
第 89 題/共 111 題
◀ AL 89/111
89. Floyd-Warshall、All-Pairs Shortest Path
#AL-04-089中Floyd-WarshallAll-Pairs Shortest Path

(10%) Consider the given directed graph.

The Floyd-Warshall algorithm can solve the all-pairs shortest-paths problem on a directed graph G=(V,E)G = (V, E). Answer the following questions.

(1) (2%) What is the time complexity of Floyd-Warshall algorithm?

(2) (3%) Let dij(k)d_{ij}^{(k)} be the weight of a shortest path from vertex ii to vertex jj for which all intermediate vertices are in the set {1,2,...,k}\{1,2,...,k\} and D(k)=(dij(k))D^{(k)} = \left(d_{ij}^{(k)}\right) be a n×nn \times n matrix. Floyd-Warshall algorithm computes D(k)D^{(k)} from D(k−1)D^{(k-1)} as the following formula.

dij(k)=d_{ij}^{(k)} = ________________

Please complete the above formula.

(3) (5%) Let dist(i,j)dist(i,j) be the length of the shortest path from node ii to node jj. What is dist(1,5)+dist(2,5)+dist(3,5)+dist(4,5)+dist(6,5)dist(1,5) + dist(2,5) + dist(3,5) + dist(4,5) + dist(6,5)?

題目附圖
📄 成大110
跳轉到第題
▤完整推導請見《WH 資工筆記 · 演算法》Ch4 圖論演算法
本章題號 · 81–100 / 111