Homework
#7

#1. Apply the F matrix method in our class handout
(i.e. the Floyd-Warshall algorithm) to the directed
graph above to calculate and show the matrices F(0), F (1), F (2) , F (3) , F (4) , F (5) , F (6) with the vertex order v1, v2,
v3, v4, v5, v6 on rows and columns.
#2. Continue from problem #1. Based on the matrices F(0) and F (6) alone
without visual help from the graph above, demonstrate how you can
determine the shortest distance from v2 to v5 and how to reconstruct a shortest
path from v2 to v5.
NOTE that
the matrices denoted by the notation F (i) here are different
from the matrices D(i) derived by the
matrix method used in Homework #6.
#3. Revisit the big O notation defined in Section 3.9 and consider the
following three functions f(n) = 1024 n2, g(n) = n4, and
h(n) = 2n. Which of the following statements are correct?
(i) f(n)
= O( g(n) ), (ii) f(n) = O( h(n) ),
(iii) g(n) =
O( f(n) ), (iv) g(n) = O( h(n) ),
(v) h(n)
= O( f(n) ), (vi) h(n) = O( g(n) ).
#4. Explain why the D matrix method for finding all-pair shortest distance information has a time complexity f(n)=O(n4) while the F matrix method for finding all-pair shortest distance information has a time complexity f(n)=O(n3 ) given that n is the number of vertices in the graph. In other words, for each method (i) estimate the time complexity f(n) as the number of basic arithmetic operations and comparisons needed when applying the method to a graph of n vertices and (ii) show that f(n) = O(n4) for the D matrix method and f(n) = O(n3) for the F matrix method.