Download presentation
Presentation is loading. Please wait.
1
Section 3.1 Properties of Trees Sarah Graham
2
Tree Talk: Vocabulary oTree: 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. oRooted Tree: a directed tree graph a bc d ef g h i j root Root = the unique vertex with in- degree of 0
3
oLevel Number: the length of the path from the root a to x oParent: for any vertex except the root a parent of x is the vertex y with an edge (y,x) oChildren: for any vertex say z with a connected edge with a parent (x,z) oSiblings: two vertices with the same parent a b c d e f g h i j k l m root children siblings parent Level # 3 Level #2
4
Theorem 1: A tree with n vertices has n – 1 edges. Assume that the tree is rooted. Since each vertex except the root has such a unique incoming edge, there are n – 1 nonroot vertices and hence n- 1 edges. a b c d e f Root = a Vertices = 6 Edges = 6 – 1 = 5
5
o Leaves: vertices with no children o Internal Vertices: vertices with children excluding the root o M-ary Tree: when each internal vertex of a rooted tree has m children o Binary Tree: when m = 2 o Height of a Rooted Tree: the length of the longest path to the root oLevel: A set distance form the root (ex: the vertices at level 3 is the set of vertices at distance 3 from the root) o Balanced Tree (“good”): if all the leaves are at levels h and h-1 Binary tree
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, and there are a total of mi children. Adding the root gives n = mi + 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 Given l, then i = (l –1)/(m – 1) and n = (ml –1)/(m – 1) Given n, then i = (n – 1)/m and l = [(m – 1)n + 1]/m n = m + l n – m = l m(i) +1 – m = l
8
Theorem 3 T is a m-ary tree of height h with l leaves. l ≤ m h and if all leaves are at height h, l = m h h ≥ [log m l] and if the tree is balanced, h = [log m l] a b c 5 ≤ 2 3 3 ≥ [log 2 5] d e f g h i
9
Theorem 4 There are n n-2 different undirected trees on n items. Prufer Sequence: There exists a sequence (s 1, s 2,…,s n-2 ) of length n-2. 1 2 3 4 5 6 7 8 Start with the smallest leaf (2). Its neighbor is 5. 5= s 1 Delete the edge. Take the next smallest leaf (4). Its neighbor is 3. 3= s 2 Delete the edge. Continue like this. (5,3,1,7,3,6)
10
Find the graph that goes to the Prufer Sequence (6,2,2,3,3,3) 1 3 2 6 4 5 7 8 Set aside 1 4 5 2 6 7
11
Show that any tree with more than 1 vertex has at least 2 vertices of degree 1. By the corollary of theorem 2: l= ((m-1)n+1)/m Assume l=1 and n≥2 Then: l=((m-1)n+1)/m m=(m-1)n+1 (m-1)=(m-1)n 1=n
12
Create a Prufer Sequence from the graph: Create a graph from the Prufer Sequence: 1 2 3 4 5 6 7 8(3,3,3,3,3,5) (5,6,1,1,5,6) 1 2 3 4 5 8 6 7
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.