Discrete Mathematics with Graph Theory (3rd Edition) 287

Discrete Mathematics with Graph Theory (3rd Edition) 287 -...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
Section 10.4 20. [BB] It is indeed necessary to continue. An identical set of d( i, j) for k = r and k = r + 1 simply indicates that the shortest path from each Vi to each Vj passing through V1, .•. , Vr has the same length as the shortest path through V1, •.. , Vr + 1. In the graph shown to the right, for instance, the values of d( i, j) do not change until k = 3 since the shortest path between pairs of vertices cannot be reduced until vertex V3 is used. 285 21. It is sufficient to prove that for each r = 1,2, ... , n, after the outer loop has completed the k = r iteration, the number d(i,j) is the length of a shortest path from Vi to Vj through the intermediate vertices V1, V2, ... ,Vr . We use mathematical induction on r. Suppose r = 1. If there is a path from Vi to Vj requiring at most the intermediate vertex Vb the shortest path is ViVj or ViV1Vj. With k = 1, the algorithm compares the lengths of these paths and makes d( i, j) the smaller of these numbers. Thus the result is true. Assume the result is true for k = r. Thus, when the algorithm has completed the
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.
Ask a homework question - tutors are online