Shortest Paths Floyd's Algorithm How do you store a weighted graph in a matrix? (A weighted graph has edge labels that represent distance or cost.) (graph6.pdf) What's the length of a path in a weighted graph? What's the distance matrix of a weighted graph? d[i][j] is the length of the shortest path from node i to node j How do you compute the distance matrix? If d[i][k] + d[k][j] is less than d[i][j], what should happen to the distance matrix? What if you compare d[i][k] + d[k][j] with d[i][j] for all possible triples of nodes (k, i, j)? for (k = 0; k < n; k++) for (i = 0; i < n; i++) for (j = 0; j < n; j++) if (d[i][k] + d[k][j] < d[i][j]) d[i][j] = d[i][k] + d[k][j]; Show the steps of Floyd's algorithm. Give the distance matrix after using each node as the pivot. (after each iteration of the outside loop) (graph4.pdf) a b c d e a 0 1 - 1 - b 1 0 1 - - c - - 0 - 1 d 1 - - 0 1 e - 1 - - 0 Classwork You may work with a partner. Show the steps of Floyd's algorithm. Give the distance matrix after pivoting with each node. (graph6.pdf) a b c d e a 0 2 4 - 1 b 4 0 - 1 - c 1 - 0 - - d - 5 1 0 1 e 2 2 - 1 0