15 4 32 5 50 4 12 3 2 12 Floyd's algorithm is used to find the shortest paths of all pairs of nodes. Let the array D[][]
Posted: Fri May 20, 2022 1:27 pm
15 4 32 5 50 4 12 3 2 12 Floyd's algorithm is used to find the shortest paths of all pairs of nodes. Let the array D[][] give the length of the shortest path between each pair of nodes. At the beginning, D[j] is the weight of the edge from node i to j. e.g. D[1][1] = 0, D[1][2] = 5, D[1][3] = infinity, D[1][4] = infinity D[2][1] = 50, D[2][2] = 0, D[2][3] = 50, D[2][4] = 4 After the k-th iteration, D[][] contains shortest paths that only use nodes {1, 2, ...., k} as intermediate nodes. 7. Fill in the blank. After the first iteration, D[4][2] = 20. What is D[3][2]? Ans: . (Do not put in any punctuation marks such as parenthesis or a comma or any sign. Your answer should be a number or the word 'infinity'.) 8. Fill in the blank. After the third iteration, what is D[1][3]? Ans: (Do not put in any punctuation marks such as parenthesis or a comma or any sign. Your answer should be a number or the word 'infinity'. )