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) Depth-first 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 depth-first 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 12-ounce flagon, b ounces in the eight-ounce flagon and c ounces in the five-ounce flagon. Various graphs are possible, but all should eight-ounce flagon and c ounces in the five-ounce flagon....
View Full Document
- Summer '10
- Graph Theory, Depth-first search, vertices