And the Final Subject is…

Slides:



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

Trees Chapter 11.
Chapter 10: Trees. Definition A tree is a connected undirected acyclic (with no cycle) simple graph A collection of trees is called forest.
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.
Discrete Structures Lecture 13: Trees Ji Yanyan United International College Thanks to Professor Michael Hvidsten.
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.
Graph Algorithms: Minimum Spanning Tree We are given a weighted, undirected graph G = (V, E), with weight function w:
Rooted Trees. More definitions parent of d child of c sibling of d ancestor of d descendants of g leaf internal vertex subtree root.
Module #1 - Logic 1 Based on Rosen, Discrete Mathematics & Its Applications. Prepared by (c) , Michael P. Frank and Modified By Mingwu Chen Trees.
1 Section 9.2 Tree Applications. 2 Binary Search Trees Goal is implementation of an efficient searching algorithm Binary Search Tree: –binary tree in.
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.
Applied Discrete Mathematics Week 13: Boolean Algebra
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
Module 5 – Networks and Decision Mathematics Chapter 23 – Undirected Graphs.
Week 11 - Wednesday.  What did we talk about last time?  Graphs  Euler paths and tours.
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.
Copyright © Cengage Learning. All rights reserved. CHAPTER 10 GRAPHS AND TREES.
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.
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.
Trees – Chapter 9 Slides courtesy of Dr. Michael P. Frank University of Florida Dept. of Computer & Information Science & Engineering.
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)
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.
Graphs Discrete Structure CS203. Adjacency Matrix We already saw a way of representing relations on a set with a Boolean matrix: R digraph(R) M R1234.
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.
Discrete Mathematics Chapter 5 Trees.
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.
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.
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)
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
Discrete Mathematics Trees.
Applied Discrete Mathematics Week 15: Trees
Graph Graphs and graph theory can be used to model:
Chapter 5 : Trees.
Minimum Spanning Tree Chapter 13.6.
Discrete Mathematicsq
Trees Chapter 11.
12. Graphs and Trees 2 Summary
Introduction to Trees Section 11.1.
Discrete Maths 10. Trees 242/ , Semester 2, Objective
Taibah University College of Computer Science & Engineering Course Title: Discrete Mathematics Code: CS 103 Chapter 10 Trees Slides are adopted from “Discrete.
Trees.
Graphs Discrete Structure CS203.
Trees L Al-zaid Math1101.
Trees 11.1 Introduction to Trees Dr. Halimah Alshehri.
Trees 11.1 Introduction to Trees Dr. Halimah Alshehri.
Minimum Spanning Tree.
Trees Chapter 11.
Presentation transcript:

And the Final Subject is… Trees December 11, 2018 Applied Discrete Mathematics Week 14: Trees

Applied Discrete Mathematics Week 14: Trees Definition: A tree is a connected undirected graph with no simple circuits. Since a tree cannot have a simple circuit, a tree cannot contain multiple edges or loops. Therefore, any tree must be a simple graph. Theorem: An undirected graph is a tree if and only if there is a unique simple path between any of its vertices. December 11, 2018 Applied Discrete Mathematics Week 14: Trees

Applied Discrete Mathematics Week 14: Trees Example: Are the following graphs trees? Yes. No. No. Yes. December 11, 2018 Applied Discrete Mathematics Week 14: Trees

Applied Discrete Mathematics Week 14: Trees Definition: An undirected graph that does not contain simple circuits and is not necessarily connected is called a forest. In general, we use trees to represent hierarchical structures. We often designate a particular vertex of a tree as the root. Since there is a unique path from the root to each vertex of the graph, we direct each edge away from the root. Thus, a tree together with its root produces a directed graph called a rooted tree. December 11, 2018 Applied Discrete Mathematics Week 14: Trees

Applied Discrete Mathematics Week 14: Trees Tree Terminology If v is a vertex in a rooted tree other than the root, the parent of v is the unique vertex u such that there is a directed edge from u to v. When u is the parent of v, v is called the child of u. Vertices with the same parent are called siblings. The ancestors of a vertex other than the root are the vertices in the path from the root to this vertex, excluding the vertex itself and including the root. December 11, 2018 Applied Discrete Mathematics Week 14: Trees

Applied Discrete Mathematics Week 14: Trees Tree Terminology The descendants of a vertex v are those vertices that have v as an ancestor. A vertex of a tree is called a leaf if it has no children. Vertices that have children are called internal vertices. If a is a vertex in a tree, then the subtree with a as its root is the subgraph of the tree consisting of a and its descendants and all edges incident to these descendants. December 11, 2018 Applied Discrete Mathematics Week 14: Trees

Applied Discrete Mathematics Week 14: Trees Tree Terminology The level of a vertex v in a rooted tree 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 vertices. December 11, 2018 Applied Discrete Mathematics Week 14: Trees

Applied Discrete Mathematics Week 14: Trees Example I: Family tree James Christine Bob Frank Joyce Petra December 11, 2018 Applied Discrete Mathematics Week 14: Trees

Applied Discrete Mathematics Week 14: Trees Example II: File system / usr bin temp bin spool ls December 11, 2018 Applied Discrete Mathematics Week 14: Trees

Applied Discrete Mathematics Week 14: Trees Example III: Arithmetic expressions  + - y z x y This tree represents the expression (y + z)(x - y). December 11, 2018 Applied Discrete Mathematics Week 14: Trees

Applied Discrete Mathematics Week 14: Trees Definition: A rooted tree is called an m-ary tree if every internal vertex has no more than m children. The tree is called a full m-ary tree if every internal vertex has exactly m children. An m-ary tree with m = 2 is called a binary tree. Theorem: A tree with n vertices has (n – 1) edges. Theorem: A full m-ary tree with i internal vertices contains n = mi + 1 vertices. December 11, 2018 Applied Discrete Mathematics Week 14: Trees

Applied Discrete Mathematics Week 14: Trees Binary Search Trees If we want to perform a large number of searches in a particular list of items, it can be worthwhile to arrange these items in a binary search tree to facilitate the subsequent searches. A binary search tree is a binary tree in which each child of a vertex is designated as a right or left child, and each vertex is labeled with a key, which is one of the items. When we construct the tree, vertices are assigned keys so that the key of a vertex is both larger than the keys of all vertices in its left subtree and smaller than the keys of all vertices in its right subtree. December 11, 2018 Applied Discrete Mathematics Week 14: Trees

Applied Discrete Mathematics Week 14: Trees Binary Search Trees Example: Construct a binary search tree for the strings math, computer, power, north, zoo, dentist, book. math December 11, 2018 Applied Discrete Mathematics Week 14: Trees

Applied Discrete Mathematics Week 14: Trees Binary Search Trees Example: Construct a binary search tree for the strings math, computer, power, north, zoo, dentist, book. math computer December 11, 2018 Applied Discrete Mathematics Week 14: Trees

Applied Discrete Mathematics Week 14: Trees Binary Search Trees Example: Construct a binary search tree for the strings math, computer, power, north, zoo, dentist, book. math power computer December 11, 2018 Applied Discrete Mathematics Week 14: Trees

Applied Discrete Mathematics Week 14: Trees Binary Search Trees Example: Construct a binary search tree for the strings math, computer, power, north, zoo, dentist, book. math power computer north December 11, 2018 Applied Discrete Mathematics Week 14: Trees

Applied Discrete Mathematics Week 14: Trees Binary Search Trees Example: Construct a binary search tree for the strings math, computer, power, north, zoo, dentist, book. math power computer north zoo December 11, 2018 Applied Discrete Mathematics Week 14: Trees

Applied Discrete Mathematics Week 14: Trees Binary Search Trees Example: Construct a binary search tree for the strings math, computer, power, north, zoo, dentist, book. math power computer dentist north zoo December 11, 2018 Applied Discrete Mathematics Week 14: Trees

Applied Discrete Mathematics Week 14: Trees Binary Search Trees Example: Construct a binary search tree for the strings math, computer, power, north, zoo, dentist, book. math power computer book dentist north zoo December 11, 2018 Applied Discrete Mathematics Week 14: Trees

Applied Discrete Mathematics Week 14: Trees Binary Search Trees To perform a search in such a tree for an item x, we can start at the root and compare its key to x. If x is less than the key, we proceed to the left child of the current vertex, and if x is greater than the key, we proceed to the right one. This procedure is repeated until we either found the item we were looking for, or we cannot proceed any further. In a balanced tree representing a list of n items, search can be performed with a maximum of log(n + 1) steps (compare with binary search). December 11, 2018 Applied Discrete Mathematics Week 14: Trees

Applied Discrete Mathematics Week 14: Trees Spanning Trees Definition: 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. Note: A spanning tree of G = (V, E) is a connected graph on V with a minimum number of edges (|V| - 1). Example: Since winters in Boston can be very cold, six universities in the Boston area decide to build a tunnel system that connects their libraries. December 11, 2018 Applied Discrete Mathematics Week 14: Trees

Applied Discrete Mathematics Week 14: Trees Spanning Trees The complete graph including all possible tunnels: Brandeis Harvard MIT BU Tufts UMass The spanning trees of this graph connect all libraries with a minimum number of tunnels. December 11, 2018 Applied Discrete Mathematics Week 14: Trees

Applied Discrete Mathematics Week 14: Trees Spanning Trees Example for a spanning tree: Brandeis Harvard MIT Tufts BU UMass Since there are 6 libraries, 5 tunnels are sufficient to connect all of them. December 11, 2018 Applied Discrete Mathematics Week 14: Trees

Applied Discrete Mathematics Week 14: Trees Spanning Trees Now imagine that you are in charge of the tunnel project. How can you determine a tunnel system of minimal cost that connects all libraries? Definition: A minimum spanning tree in a connected weighted graph is a spanning tree that has the smallest possible sum of weights of its edges. How can we find a minimum spanning tree? December 11, 2018 Applied Discrete Mathematics Week 14: Trees

Applied Discrete Mathematics Week 14: Trees Spanning Trees The complete graph with cost labels (in billion $): Brandeis Harvard MIT Tufts BU UMass 7 8 9 6 4 5 3 2 The least expensive tunnel system costs $20 billion. December 11, 2018 Applied Discrete Mathematics Week 14: Trees

Applied Discrete Mathematics Week 14: Trees Spanning Trees Prim’s Algorithm: Begin by choosing any edge with smallest weight and putting it into the spanning tree, successively add to the tree edges of minimum weight that are incident to a vertex already in the tree and not forming a simple circuit with those edges already in the tree, stop when (n – 1) edges have been added. December 11, 2018 Applied Discrete Mathematics Week 14: Trees

Applied Discrete Mathematics Week 14: Trees Spanning Trees Kruskal’s Algorithm: Kruskal’s algorithm is identical to Prim’s algorithm, except that it does not demand new edges to be incident to a vertex already in the tree. Both algorithms are guaranteed to produce a minimum spanning tree of a connected weighted graph. December 11, 2018 Applied Discrete Mathematics Week 14: Trees

Applied Discrete Mathematics Week 14: Trees Spanning Trees Prim vs. Kruskal: The two algorithms differ in the way they can be implemented and their efficiency under different conditions. As a rule of thumb, Prim’s algorithm is more efficient when initially there are many more edges than vertices. For graphs with initially only few edges in comparison to the number of vertices, Kruskal’s algorithm typically performs more efficiently. December 11, 2018 Applied Discrete Mathematics Week 14: Trees

Applied Discrete Mathematics Week 14: Trees The End December 11, 2018 Applied Discrete Mathematics Week 14: Trees