5.5.2 M inimum spanning trees  Definition 24: A minimum spanning tree in a connected weighted graph is a spanning tree that has the smallest possible.

Slides:



Advertisements
Similar presentations
Chapter 11 Trees Graphs III (Trees, MSTs) Reading: Epp Chp 11.5, 11.6.
Advertisements

Trees Chapter 11.
 Theorem 5.9: Let G be a simple graph with n vertices, where n>2. G has a Hamilton circuit if for any two vertices u and v of G that are not adjacent,
Chapter 10: Trees. Definition A tree is a connected undirected acyclic (with no cycle) simple graph A collection of trees is called forest.
Greedy Algorithms Greed is good. (Some of the time)
10.4 Spanning Trees. Def Def: Let G be a simple graph. A spanning tree of G is a subgraph of G that is a tree containing every vertex of G See handout.
22C:19 Discrete Structures Trees Spring 2014 Sukumar Ghosh.
Graphs III (Trees, MSTs) (Chp 11.5, 11.6)
3.3 Spanning Trees Tucker, Applied Combinatorics, Section 3.3, by Patti Bodkin and Tamsen Hunter.
CMPS 2433 Discrete Structures Chapter 5 - Trees R. HALVERSON – MIDWESTERN STATE UNIVERSITY.
1 Chapter 10 Trees. Tree Definition 1. A tree is a connected undirected graph with no simple circuits. Theorem 1. An undirected graph is a tree if and.
1 Copyright M.R.K. Krishna Rao 2003 Ch 9 - Trees Definition: A tree is a connected undirected graph with no simple circuits. Since a tree cannot have a.
1 Section 9.1 Introduction to Trees. 2 Tree terminology Tree: a connected, undirected graph that contains no simple circuits –must be a simple graph:
Discrete Mathematics Transparency No. 8-1 Chapter 8 Trees.
Discussion #36 Spanning Trees
Lists A list is a finite, ordered sequence of data items. Two Implementations –Arrays –Linked Lists.
Rooted Trees. More definitions parent of d child of c sibling of d ancestor of d descendants of g leaf internal vertex subtree root.
03/01/2005Tucker, Sec Applied Combinatorics, 4th Ed. Alan Tucker Section 3.1 Properties of Trees Prepared by Joshua Schoenly and Kathleen McNamara.
Discrete Mathematics Lecture 9 Alexander Bukharovich New York University.
KNURE, Software department, Ph , N.V. Bilous Faculty of computer sciences Software department, KNURE The trees.
Trees and Tree Traversals Prof. Sin-Min Lee Department of Computer Science San Jose State University.
Let G be a pseudograph with vertex set V, edge set E, and incidence mapping f. Let n be a positive integer. A path of length n between vertex v and vertex.
May 5, 2015Applied Discrete Mathematics Week 13: Boolean Algebra 1 Dijkstra’s Algorithm procedure Dijkstra(G: weighted connected simple graph with vertices.
5.4 Shortest-path problem  Let G=(V,E,w) be a weighted connected simple graph, w is a function from edges set E to position real numbers set. We denoted.
BCT 2083 DISCRETE STRUCTURE AND APPLICATIONS
Section 10.1 Introduction to Trees These class notes are based on material from our textbook, Discrete Mathematics and Its Applications, 6 th ed., by Kenneth.
May 1, 2002Applied Discrete Mathematics Week 13: Graphs and Trees 1News CSEMS Scholarships for CS and Math students (US citizens only) $3,125 per year.
Foundations of Discrete Mathematics
Trees and Distance. 2.1 Basic properties Acyclic : a graph with no cycle Forest : acyclic graph Tree : connected acyclic graph Leaf : a vertex of degree.
Tree A connected graph that contains no simple circuits is called a tree. Because a tree cannot have a simple circuit, a tree cannot contain multiple.
CSCI 115 Chapter 7 Trees. CSCI 115 §7.1 Trees §7.1 – Trees TREE –Let T be a relation on a set A. T is a tree if there exists a vertex v 0 in A s.t. there.
Discrete Structures Lecture 12: Trees Ji Yanyan United International College Thanks to Professor Michael Hvidsten.
 Rooted tree and binary tree  Theorem 5.19: A full binary tree with t leaves contains i=t-1 internal vertices.
Trees Dr. B. Prabhakaran Application Examples Useful for locating items in a list Used in Huffman coding algorithm Study games like.
5.5.3 Rooted tree and binary tree  Definition 25: A directed graph is a directed tree if the graph is a tree in the underlying undirected graph.  Definition.
Discrete Structures Trees (Ch. 11)
Introduction to Graph Theory
Chap 8 Trees Def 1: A tree is a connected,undirected, graph with no simple circuits. Ex1. Theorem1: An undirected graph is a tree if and only if there.
Agenda Review: –Planar Graphs Lecture Content:  Concepts of Trees  Spanning Trees  Binary Trees Exercise.
Chapter 7. Trees Weiqi Luo ( 骆伟祺 ) School of Software Sun Yat-Sen University : Office : A309
5.5.2 M inimum spanning trees  Definition 24: A minimum spanning tree in a connected weighted graph is a spanning tree that has the smallest possible.
CS 103 Discrete Structures Lecture 23 Trees (1). Second Midterm Exam 1 st Lecture in December (same time as the lecture) 75 minute duration Will cover.
Foundation of Computing Systems
1 Slides by Sylvia Sorkin, Community College of Baltimore County - Essex Campus Trees.
Trees Dr. Yasir Ali. A graph is called a tree if, and only if, it is circuit-free and connected. A graph is called a forest if, and only if, it is circuit-free.
 Quotient graph  Definition 13: Suppose G(V,E) is a graph and R is a equivalence relation on the set V. We construct the quotient graph G R in the follow.
Chapter 10: Trees A tree is a connected simple undirected graph with no simple circuits. Properties: There is a unique simple path between any 2 of its.
CHAPTER 11 TREES INTRODUCTION TO TREES ► A tree is a connected undirected graph with no simple circuit. ► An undirected graph is a tree if and only.
 Hamilton paths.  Definition 20: A Hamilton paths is a path that contains each vertex exactly once. A Hamilton circuit is a circuit that contains.
Discrete Mathematics Chapter 10 Trees. Outline 10.1 Introduction to Trees 10.2 Applications of Trees 10.3 Tree Traversal 10.4 Spanning Trees 10.5 Minimal.
Discrete Mathematics Chapter 10 Trees.
Chapter 11. Chapter Summary  Introduction to trees (11.1)  Application of trees (11.2)  Tree traversal (11.3)  Spanning trees (11.4)
5.6 Prefix codes and optimal tree Definition 31: Codes with this property which the bit string for a letter never occurs as the first part of the bit string.
Chapter 11. Chapter Summary Introduction to Trees Applications of Trees (not currently included in overheads) Tree Traversal Spanning Trees Minimum Spanning.
Section10.1: Introduction to Trees
Trees.
Applied Discrete Mathematics Week 15: Trees
Chapter 5 : Trees.
Greedy Technique.
Minimum Spanning Tree Chapter 13.6.
Discrete Mathematicsq
12. Graphs and Trees 2 Summary
Introduction to Trees Section 11.1.
Advanced Algorithms Analysis and Design
Taibah University College of Computer Science & Engineering Course Title: Discrete Mathematics Code: CS 103 Chapter 10 Trees Slides are adopted from “Discrete.
Connected Components Minimum Spanning Tree
Theorem 5.13: For vT‘, l’(v)= min{l(v), l(vk)+w(vk, v)}
Trees 11.1 Introduction to Trees Dr. Halimah Alshehri.
And the Final Subject is…
Presentation transcript:

5.5.2 M inimum spanning trees  Definition 24: A minimum spanning tree in a connected weighted graph is a spanning tree that has the smallest possible sum of weights of its edges.  Prim algorithms  Kruskal’s algorithms

 1.Prim’s algorithms  Let T={e} where e is minimum-weighted edge in G  for i=1 to n-2  begin e i = an edge of minimum weight incident to a vertex in T and not forming a simple circuit in T if added to T  T:=T ∪ {e i }  end

Theorem 5.17: Prim’s algorithm produces a minimum spanning tree of a connected weighted graph.

 2.Kruskal’s algorithm  T= .  For i=1 to n-1  begin  e i = an edge of minimum weight in E(G)-E(T) and not forming a simple circuit in T if added to T  T:=T ∪ {e i }  end

 Theorem 5.18: Kruskal’s algorithm produces a minimum spanning tree of a connected weighted graph.  Proof: Let G be a connected weighted graph, and T be the graph which is produced by Kruskal’s algorithm.  By theorem 5.14  T is a spanning tree of G.

 Now we prove T is a minimum spanning tree  Suppose T that is not a minimum spanning tree. Thus there is a spanning tree S of G such that w(S)<w(T).  w(e 1 ) ≤w(e 2 ) ≤  ≤w(e k ) ≤  ≤w(e n-1 )  Suppose e k that is the first edge  S, i.e. e 1,e 2, ,e k-1 are common edges of T and S.  There is a simple circuit C that is in E(S ∪ {e k }. Then there is an edge e' of C that e'  S and e'  T.  e 1,e 2, ,e k-1, e'  S, thus e 1,e 2, ,e k-1 and e'  any circuit.  By Kruskal’s algorithm, w(e k )≤w(e')

 We have a spanning tree S’ which is obtained from S ∪ e k by omitting the edge e'.  Because w(e k )≤w(e'), w(S')≤w(S), and the number of common edges of S’ and T are added 1.  W(T)≤W(S),  Suppose: W(S)<W(T)  contradiction  Rooted tree and binary tree  Prefix codes and optimal tree

5.5.3 Rooted tree and binary tree  Definition 25: A directed graph is a directed tree if the graph is a tree in the underlying undirected graph.  Definition 26: A rooted tree is a directed tree if there are exactly a vertex that is 0 in-degree, and other vertices that are 1 in-degree. The vertex of 0 in-degree is called root. And the vertices of 0 out-degree are called leaves. The vertices that are not 0 out-degree are called internal vertices.  There is a unique path from the root to each vertex of the rooted tree by the definition 25

 Definition 27: Let u be an internal vertex. If there is a directed edge (u,w) from u to w, then w is called child of u, and u is called the parent of w. If the vertices w 1 and w 2 are child of u, then w 1 and w 2 are called brothers. If there a directed path from u to z, then z is called descendant of u. and u is called ancestors of w. The level of a vertex v is the length of the unique path from the root to this vertex. The level of the root is defined to be zero. The height of a rooted tree is the maximum of the levels of all vertices.  Note: The parent of w is unique.

 Root:1  Leaf: 6, 8, 9, 10, 11, 12  internal vertices: 1, 2, 3, 4, 5, 7  the levels of 2, 3 are 1, the levels of 4, 5, 6, 7, 8 are 2,  the levels of 9, 10, 11, 12 are 3 。  The height of a rooted tree is 3

 Definition 28: If v be a vertex of a rooted tree, then the subtree with v as its root is the subgraph of the tree consisting of v and its descendants and all edges incident to these descendants.

 Definition 29: An ordered rooted tree is a rooted tree where the children of each internal vertex are ordered. Ordered rooted trees are drawn so that the children of each internal vertex and edges are shown in order from left to right, and these edges are marked on 1,2, ,i, 

 Definition 30: An ordered rooted tree is called an m-ary tree if every vertex has no more than m children. The tree is called a full m-ary tree if every vertex has exactly m children. An m-ary tree with m=2 is called a binary tree.  Left subtree, right subtree

 a-(b+(c/d)+(e/f))

 Theorem 5.19: A full binary tree with t leaves contains i=t-1 internal vertices.  Proof: Let the number vertices be n.  The sum of children of all internal vertices equals n-1,  internal vertices and leaves  the number vertices n=i+t,  i.e. 2i=i+t-1,  Thus i=t-1 。  A full m-ary tree with t leaves contains i=(t-1)/(m-1) internal vertices.

 Theorem 5.20: Let T be a full binary tree. We denote the sum of length of simple paths from root to all internal vertices by I, and the sum of length of simple paths from root to all leaves by E. Then E=I+2i, where i is the number of internal vertices.  Proof: Let us apply induction on the number i of internal vertices.  E=2 and I=0 when i=1

 Suppose that result holds for i=k-1  For i=k, we chose internal vertex v so that its children are leaves. We have a new tree which is obtained by omitting edges of incident v and its children.  We denote the length of path from root to v by l.  E'=E- l-2, I'=I-l.  By the inductive hypothesis, E'=I'+2(k-1)  E= E'+l+2=I'+2(k-1)+l+2=I-l+2(k-1)+l+2=I+2k 。  Let T be a full m-ary tree. Then E=(m-1)I+mi, where i is the number of internal vertices.

5.6 Prefix codes and optimal tree  a b c d e   The set {00,110,010,10,01} is called code   ead or cc?  The string of e is prefix of string of c  c: 111  The set {00,110,111,10,01} is called prefix code

 Definition 31: Codes with this property which the bit string for a letter never occurs as the first part of the bit string for another letter are called prefix codes.  Theorem 5.21: We can construct a prefix code from any binary tree, and we can construct a binary tree from the prefix codes.  Proof: (1) We can construct a prefix code from any binary tree where the left edge at each internal vertex is labeled by 0 and the right edge by a 1 and where the leaves are labeled by characters  (2)We can construct a binary tree from the prefix codes

 Next: Optimal tree and Transport Networks 8.4 P321 (Sixth) OR P307(Fifth)  Exercise P300(Sixth) OR P285(Fifth) 2,5,11,14,18,20,21,24  P274(Sixth) OR P259(Fifth) 23  1.A full m-ary tree with t leaves contains i=(t-1)/(m-1) internal vertices.  2.Let T be a full m-ary tree. We denote the sum of length of simple paths from root to all internal vertices by I, and the sum of length of simple paths from root to all leaves by E. Then E=(m-1)I+2i, (m-1)i=t-1, where i is the number of internal vertices and t is the number of leaves