Transcript Document
Applied Combinatorics, 4th Ed. Alan Tucker Section 3.1 Properties of Trees Prepared by Joshua Schoenly and Kathleen McNamara 03/01/2005 Tucker, Sec. 3.1 1 Definitions Tree: a tree is a special type of graph that contains designated vertex called a root so that there is a unique path from the root to any other vertex in the tree. Equivalently, a tree graph contains no circuits. Rooted Tree: a directed tree graph with all edges directed away from the root a Root = the unique vertex with inb c degree of 0 e f d j 03/01/2005 g Tucker, Sec. 3.1 h i 2 Level Number: the length of the path from the root a to x Parent: the vertex y is a parent of x if they are connected by an edge y, x Children: the vertex y is a child of x if they are connected by an edge x, y Siblings: two vertices with the same parent a Parent of g and h b Level 2 e h Children of d 03/01/2005 Level 1 f d g c i j Level 3 k Siblings of each other Tucker, Sec. 3.1 3 Theorem 1 A tree with n vertices has n – 1 edges. Proof Choose a root, and direct all edges away from the root. Since each vertex except the root has a single incoming edge, there are n –1 non-root vertices and hence n –1 edges. b a d a c Root = a f b d c e f e 03/01/2005 Tucker, Sec. 3.1 4 Definitions Leaves: vertices with no children Internal Vertices: vertices with children m-ary Tree: when each internal vertex of a rooted tree has m children Binary Tree: when m = 2 Internal vertices Leaves 03/01/2005 Tucker, Sec. 3.1 5 Definitions Height of a Rooted Tree: the length of the longest path to the root. Balanced Tree (“good”): if all the leaves are at levels h and h-1, where h is the height of the tree. Height (h) is 3 h-1 h 03/01/2005 Tucker, Sec. 3.1 6 Theorem 2 If T is an m-ary tree with n vertices, of which i vertices are internal, then, n = mi + 1. Proof Each vertex in a tree, other than the root, is the child of a unique vertex. Each of the i internal vertices has m children, so there are a total of mi children. Adding the root gives n = mi + 1 m=3 i=3 n = 10 03/01/2005 Tucker, Sec. 3.1 7 Corollary T is a m-ary tree with n vertices, consisting of i internal vertices and l leaves. Given i, then l m 1 i 1 and n mi 1 l 1 Given l , then i m 1 n 1 Given n, then i m ml 1 and n m 1 m 1 n 1 and l m Note: The proof of the corollary’s formulas follow directly from n=mi+1 (Theorem 2) and the fact that l+i=n 03/01/2005 Tucker, Sec. 3.1 8 Example 1 If 56 people sign up for a tennis tournament, how many matches will be played in the tournament? Setting up as a binary tree, there will be 56 leaves and i matches with two entrants entering a match. l 56 and m 2 By the corollary of Theorem 2: Entrants Matches l 1 i m 1 56 1 i 55 matches 2 1 Shortened Graph 03/01/2005 Tucker, Sec. 3.1 9 Theorem 3 T is a m-ary tree of height h with l leaves. l ≤ mh and if all leaves are at height h, l = mh h ≥ `élogmlù and if the tree is balanced, h = élogmlù l=5 h=3 m=2 a b d 03/01/2005 c i e h 5 23 8 f g Tucker, Sec. 3.1 3 log 2 5 3 10 Prufer Sequence There exists a sequence (s1, s2,…,sn-2) of length n-2. This is called a Prufer Sequence. 1 3 5 7 2 6 4 Start with the leaf of the smallest label (2). Its neighbor is 5. 5 = s1 Delete the edge. Take the next smallest leaf (4). Its neighbor is 3. 3 = s2 Delete the edge. Continue like this obtaining, (5,3,1,7,3,6) 8 03/01/2005 Note: There is a 1:1 correspondence to the Prufer Sequence and the tree Tucker, Sec. 3.1 11 Example 2 Find the graph that has the Prufer Sequence (6, 2, 2, 3, 3, 3) 1 1 4 6 3 8 5 7 2 4 5 2 6 7 3 8 03/01/2005 Tucker, Sec. 3.1 12 Theorem 4 There are nn-2 different undirected trees on n items. 1 3 8 6 5 6 3 2 8 4 4 1 7 2 7 5 Two different trees on 8 items. 03/01/2005 Tucker, Sec. 3.1 13 Proof of Theorem 4 There are nn-2 different undirected trees on n items. We showed there is a 1-to-1 correspondence between trees on n items and Prufer sequences of length n-2. Count Prufer sequences. (__, __, __, __, __, __) n choices … n choices This means there are nn-2 different Prufer sequences. Since each tree has a unique Prufer Sequence, there are nn-2 different trees. 03/01/2005 Tucker, Sec. 3.1 14 Class Problem Create a Prufer Sequence from the graph: 2 1 5 8 6 4 7 3 03/01/2005 Tucker, Sec. 3.1 15 Solution Create a Prufer Sequence from the graph: 2 1 5 8 6 4 7 3 (5,6,1,1,5,6) 03/01/2005 Tucker, Sec. 3.1 16