180 likes | 287 Views
Introduction to Graph Theory. Lecture 06: Properties of Trees and Minimum Spanning Trees. Definition of a Tree. Tree is a connected acyclic graph i.e. Connected and containing no cycle Have you come across trees before? What classes of trees have we seen so far?. 1. 2. 1. 2. 3. 3.
E N D
Introduction to Graph Theory Lecture 06: Properties of Trees and Minimum Spanning Trees
Definition of a Tree • Tree is a connectedacyclic graph • i.e. Connected and containing no cycle • Have you come across trees before? • What classes of trees have we seen so far? 1 2 1 2 3 3 leaf 4
Properties • P1: Every nontrivial tree (K1 is a trivial graph) has at least two end vertices. • P2: The deletion of any edge of a tree disconnects it. • P3: Given two vertices u and v, there is a uniqueu-v path (geodesic). • P4: A tree with n vertices has q=n-1 edges (minimally connected). • Proof? (by induction)
Graphical Sequences of Trees • Theorem: Given a sequence S of n positive integers such that and , then there exists a tree whose degree sequence is S. • Proof? (by induction again) • This is a good property for checking isomorphism. • Others are longest and shortest path
r t a b c Number of Leaves of a Tree • Let ni be the number of vertices of degree i, we want to determine n1 from ni, for i=3, 4, …
Number of Leaves of a Tree • Proof for the theorem. • We prove the formula using the concept of rooted tree. • Root can be chosen as any vertex, but it is convenient to choose the root as a vertex with degree 1. • The root has level zero.
Minimum Spanning Trees (MST) • Given a connected graph G, a spanning subgraph of G that is a tree is called a spanning tree. • Edges are often associated with weights. • MST is the spanning tree with the minimum total of the weights in the tree. • Can you think of an application for MST?
Creating Spanning Trees • We know that a tree with n vertices has n-1 edges. • Given graph G of n vertices and q edges, we need to delete q-(n-1) edges and none of which is a bridge. • A graph can have many spanning trees. • Let’s look at example 3.4
Example 3.4 b f a g b e d c
k-Deficient Vertices of ST • A vertex v is k-deficient if for T the spanning tree of graph G. • If k=0, v is a degree-preserving vertex. • Theorem: Let G be a connected graph on n vertices and q edges. The sum of deficiencies of the vertices of any spanning tree of G is 2(q-n+1). • Proof?
Minimum Spanning Tree (MST) • Minimum-Cost Spanning Tree • Each edge is given a weight, which is the cost of taking that edge. • The cost of the spanning tree is the sum of the weights of the edges of T. • An application is the construction of the subway system. • Each edge costs millions of dollars
Kruskal’s Algorithm • The algorithm is greedy • At each stage, always select the best edge not part of a cycle. • Algorithm: • Let e be the next edge on sorted list L for which and is acyclic. Let • If |S|=n-1, stop and output S. Otherwise, return to step2. Why it works?
Proof for Krustal’s Algorithm • Part I: Is the result a spanning tree? • Borrowing the result from our previous quiz. • Part II: Is it minimum? • Prove by contradiction • Suppose that is not minimum. • Let be the MST with the most edges in common with S. • The contradiction shows that there is another tree which has more edges in common with S.
Proof for Krustal’s Algorithm • Let be the first edge that enters S and not in R. • Consider . This set of edges induces a graph that has one cycle C (proof is the quiz) • Since is a tree, some edge of C is not in S. • induces a spanning tree by breaking the cycle C. • The weight of is . • …
Example • Let’s work out the MST for the following graph. 2 b a 4 1 1 g 4 2 e f 1 1 5 c 5 d
Prim’s Algorithm • Also greedy • The edge-induced graph is connected at every step. • The algorithm is equivalent to breadth-first search • When weights are all equal • Starting at a vertex, traversing down the tree by selecting the minimum-weight edge.
Prim’s Algorithm • Select a vertex v, and let • Among all , let e=uw be a minimum-weight edge joining u to v, where . Let and • If , stop and output E(T). Otherwise, return to step2 and add another vertex to the tree. Back to the previous exercise using Prim’s algorithm Let’s make the proof as part of your homework.