1 / 12

Section 3.1

Section 3.1. Properties of Trees. Sarah Graham. root. a. b. c. e. f. d. i. h. g. j. Tree Talk: Vocabulary.

george
Download Presentation

Section 3.1

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Section 3.1 • Properties of Trees Sarah Graham

  2. root a b c e f d i h g j Tree Talk: Vocabulary • 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 Root = the unique vertex with in-degree of 0

  3. m f l d h b e j a i k c root g • Level Number: the length of the path from the root a to x • Parent: for any vertex except the root a parent of x is the vertex y with an edge (y,x) • Children: for any vertex say z with a connected edge with a parent (x,z) • Siblings: two vertices with the same parent children Level # 3 siblings parent 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 Root = a Vertices = 6 Edges = 6 – 1 = 5 b c d e f

  5. Leaves: vertices with no children • Internal Vertices: vertices with children excluding the root • M-ary Tree: when each internal vertex of a rooted tree has m children • Binary Tree: when m = 2 • Height of a Rooted Tree: the length of the longest path to the root • Level: A set distance form the root (ex: the vertices at level 3 is the set of vertices at distance 3 from the root) • 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. a b c 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] 5 ≤ 23 3 ≥ [log25] d e f h i g

  9. Theorem 4 There are nn-2 different undirected trees on n items. Prufer Sequence: There exists a sequence (s1, s2,…,sn-2) of length n-2. 1 Start with the smallest leaf (2). Its neighbor is 5. 5= s1Delete the edge. Take the next smallest leaf (4). Its neighbor is 3. 3= s2 Delete the edge. Continue like this. 3 5 7 2 4 6 8 (5,3,1,7,3,6)

  10. 1 6 3 8 5 7 2 4 Find the graph that goes to the Prufer Sequence (6,2,2,3,3,3) 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. 2 1 5 1 3 8 4 6 7 4 3 6 7 5 2 (5,6,1,1,5,6) 8 Create a graph from the Prufer Sequence: Create a Prufer Sequence from the graph: (3,3,3,3,3,5)

More Related