Unformatted text preview: 350 Solutions to Exercises 7. (a) [BB] Each time the procedure terminates, start it again with an unlabeled vertex. The number of connected components is equal to the number of times the procedure terminates. (b) Depthfirst search assigns the labels 1,2,3,4 to the vertices VI, V2, Vu, V6 respectively and then terminates. The next search assigns the labels 1,2,3 to vertices V3, Vs, VI3 respectively and ter minates. The next search assigns the labels 1,2,3,4,5,6 to the vertices V4, V5, VIO, V7, Vg, VI2 respectively and terminates. At this point, all the vertices have been labeled. There are three components. 8. The graph shows a spanning tree which results from one possible depthfirst search applied to a graph for this problem (formed in the same way that the graph in the solution to Problem 5 was formed). Vertex (a, b, c) indicates the state where there are a ounces in the 12ounce flagon, b ounces in the eightounce flagon and c ounces in the fiveounce flagon. Various graphs are possible, but all should eightounce flagon and c ounces in the fiveounce flagon....
View
Full Document
 Summer '10
 any
 Graph Theory, Depthfirst search, vertices

Click to edit the document details