Download presentation
1
Introduction to Graph Theory
Lecture 06: Properties of Trees and Minimum Spanning Trees
2
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 leaf 4
3
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 unique u-v path (geodesic). P4: A tree with n vertices has q=n-1 edges (minimally connected). Proof? (by induction)
4
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
5
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, … t b r c a
6
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.
7
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?
8
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
9
Example 3.4 b f a g b e d c
10
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?
11
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
12
Kruskal’s Algorithm The algorithm is greedy Algorithm:
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?
13
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.
14
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 …
15
Example Let’s work out the MST for the following graph. 2 b a 4 1 1 g
5 c 5 d
16
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.
17
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.
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.