This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: S. Dasgupta, C.H. Papadimitriou, and U.V. Vazirani 141 Trees A tree is an undirected graph that is connected and acyclic. Much of what makes trees so useful is the simplicity of their structure. For instance, Property 2 A tree on n nodes has n 1 edges. This can be seen by building the tree one edge at a time, starting from an empty graph. Initially each of the n nodes is disconnected from the others, in a connected component by itself. As edges are added, these components merge. Since each edge unites two different components, exactly n 1 edges are added by the time the tree is fully formed. In a little more detail: When a particular edge { u, v } comes up, we can be sure that u and v lie in separate connected components, for otherwise there would already be a path between them and this edge would create a cycle. Adding the edge then merges these two components, thereby reducing the total number of connected components by one. Over the course of this incremental process, the number of components decreases from n to one, meaning that n 1 edges must have been added along the way. The converse is also true. Property 3 Any connected, undirected graph G = ( V, E ) with  E  =  V   1 is a tree. We just need to show that G is acyclic. One way to do this is to run the following iterative procedure on it: while the graph contains a cycle, remove one edge from this cycle. The process terminates with some graph G = ( V, E ) , E ⊆ E , which is acyclic and, by Property 1 (from page 139), is also connected. Therefore G is a tree, whereupon  E  =  V   1 by Property 2. So E = E , no edges were removed, and G was acyclic to start with. In other words, we can tell whether a connected graph is a tree just by counting how many edges it has. Here’s another characterization. Property 4 An undirected graph is a tree if and only if there is a unique path between any pair of nodes. In a tree, any two nodes can only have one path between them; for if there were two paths, the union of these paths would contain a cycle. On the other hand, if a graph has a path between any two nodes, then it is connected. If these paths are unique, then the graph is also acyclic (since a cycle has two paths between any pair of nodes). 142 Algorithms Figure 5.2 T ∪ { e } . The addition of e (dotted) to T (solid lines) produces a cycle. This cycle must contain at least one other edge, shown here as e , across the cut ( S, V S ) . e S V S e 5.1.2 The cut property Say that in the process of building a minimum spanning tree (MST), we have already chosen some edges and are so far on the right track. Which edge should we add next? The following lemma gives us a lot of flexibility in our choice....
View
Full Document
 Spring '11
 Algorithms, Graph Theory, S. Dasgupta, C.H. Papadimitriou, U.V. Vazirani

Click to edit the document details