Agenda Review: –Planar Graphs Lecture Content:  Concepts of Trees  Spanning Trees  Binary Trees Exercise.

Slides:



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

Trees Chapter 11.
Chapter 9 Graphs.
9.7 Planar Graphs. Intro problem- 3 houses and 3 utilities K 3,3 problem: Can 3 houses be connected to 3 utilities so that no 2 lines cross? Similarly,
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.
1 Section 9.4 Spanning Trees. 2 Let G be a simple graph. A spanning subtree of G is a subgraph of G containing every vertex of G –must be connected; contains.
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 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.
Lists A list is a finite, ordered sequence of data items. Two Implementations –Arrays –Linked Lists.
Module #1 - Logic 1 Based on Rosen, Discrete Mathematics & Its Applications. Prepared by (c) , Michael P. Frank and Modified By Mingwu Chen Trees.
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.
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.
BCT 2083 DISCRETE STRUCTURE AND APPLICATIONS
Lecture 10 Trees –Definiton of trees –Uses of trees –Operations on a tree.
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
Dijkstra’s Algorithm. Announcements Assignment #2 Due Tonight Exams Graded Assignment #3 Posted.
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.
Chapter 6 Graph Theory R. Johnsonbaugh Discrete Mathematics 5 th edition, 2001.
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.
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.
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.
V Spanning Trees Spanning Trees v Minimum Spanning Trees Minimum Spanning Trees v Kruskal’s Algorithm v Example Example v Planar Graphs Planar Graphs v.
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.
15-853Page :Algorithms in the Real World Planar Separators I & II – Definitions – Separators of Trees – Planar Separator Theorem.
Planar Graphs Graph Coloring
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.
Unit – V Graph theory. Representation of Graphs Graph G (V, E,  ) V Set of vertices ESet of edges  Function that assigns vertices {v, w} to each edge.
An Introduction to Graph Theory
Graph Theory and Applications
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.
Chapter 20: Graphs. Objectives In this chapter, you will: – Learn about graphs – Become familiar with the basic terminology of graph theory – Discover.
Chapter 7 Planar Graphs 大葉大學 資訊工程系 黃鈴玲  7.2 Planar Embeddings  7.3 Euler’s Formula and Consequences  7.4 Characterization of Planar Graphs.
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.
Applied Discrete Mathematics Week 15: Trees
Chapter 5 : Trees.
Greedy Technique.
Discrete Mathematicsq
12. Graphs and Trees 2 Summary
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.
Chapter 10.7 Planar Graphs These class notes are based on material from our textbook, Discrete Mathematics and Its Applications, 7th ed., by Kenneth H.
Math 221 Huffman Codes.
Chapter 10.7 Planar Graphs These class notes are based on material from our textbook, Discrete Mathematics and Its Applications, 7th ed., by Kenneth H.
Chapter 10.7 Planar Graphs These class notes are based on material from our textbook, Discrete Mathematics and Its Applications, 7th ed., by Kenneth H.
Trees 11.1 Introduction to Trees Dr. Halimah Alshehri.
And the Final Subject is…
Chapter 10.7 Planar Graphs These class notes are based on material from our textbook, Discrete Mathematics and Its Applications, 8th ed., by Kenneth H.
N(S) ={vV|uS,{u,v}E(G)}
Chapter 10.7 Planar Graphs These class notes are based on material from our textbook, Discrete Mathematics and Its Applications, 7th ed., by Kenneth H.
Concepts of Computation
Agenda Review Lecture Content: Shortest Path Algorithm
Chapter 10.7 Planar Graphs These class notes are based on material from our textbook, Discrete Mathematics and Its Applications, 7th ed., by Kenneth H.
Presentation transcript:

Agenda Review: –Planar Graphs Lecture Content:  Concepts of Trees  Spanning Trees  Binary Trees Exercise

Review: Planar Graphs

Planar Graphs Definition: A graph is called planar if it can be drawn in the plane without any edges crossing (where a crossing of edges is the intersection of the lines or arcs representing them at a point other than their common endpoint). Such a drawing is called a planar representation of the graph

Example: Planar Graph

Example: Non-Planar Graph

Euler’s Formula A planar representation of a graph splits the plane into regions or faces, including an unbounded region Euler’s Formula: Let G be a connected planar simple graph with e edges and v vertices. Let r be the number of regions in a planar representation of G, then r = e – v + 2 Boundary is formed by cycle

Some inequalities for planar graphs Euler’s formula can be used to establish some inequalities that must be satisfied by planar graphs, i.e:

K 3,3 dan K 5  Last week, we showed that K 3,3 and K 5 are not planar (using inequalities on previous slide)  If a graph contains K 3,3 or K 5 as a subgraph, then it cannot be planar  The converse of statement above is not true  Use concept of homeomorphic graph

Homeomorphic Graph Definition  If a graph G has a vertex v of degree 2 and edges (v,v 1 ) and (v,v 2 ) with v 1 ≠ v 2,  edges (v,v 1 ) and (v,v 2 ) are in series  A series reduction consists of deleting vertex v from G and replacing edges (v,v 1 ) and (v,v 2 ) by the edge (v 1,v 2 ).  The graph G’ is said to be obtained from G by a series of reduction or elementary subdivision  Graphs G 1 and G 2 are homeomorphic if G 1 and G 2 can be reduced to isomorphic graphs by performing a sequence of series reduction Any graph is homeomorphic to itself Graphs G 1 and G 2 are homeomorphic if G 1 can be reduced to a graph isomorphic to G 2 or if G 2 can be reduced to a graph isomorphic to G 1

Example

Kuratowski’s Theorem Theorem: A graph is nonplanar if and only if it contains a subgraph homeomorphic to K 3,3 or K 5 Example: Determine whether G is planar or nonplanar?

Trees

 Very useful in computer science applications: –File Computer file system –IP Multicast routing Multimedia transmission to a group of receivers –To construct efficient algorithm E.g.: searching: Depth-first search, breadth-first search –Construct efficient codes for data transmission and storage –Games –Decision making –Object-oriented programming: parent child relation

Trees Definition:  A (Free) Tree T is a simple graph satisfying the following: –If v and w are vertices in T, there is a unique simple path from v to w.  A Rooted Tree is a tree in which a particular vertex is designated the root, and every edge is directed away from the root  Note: The level of a vertex v is the length of the simple path from the root to v. The height of a rooted tree is the maximum level number that occurs

Which Ones are Trees?

Example Rooted Tree with root vertex = a Rooted Tree with root vertex = c

Terminology & Characterization of Trees Definition:  Let T be a tree with root v 0.  Suppose that x, y, and z are vertices in T and that (v 0, v 1,..., v n ) is a simple path in T.  Then (a) v n-1 is the parent of v n (b) v 0,..., v n-1 are ancestors of v n (c) v n is a child of v n-1 (d) If x is an ancestor of y, y is a descendant of x. (e) If x and y are children of z, x and y are siblings. (f) If x has no children, x is a terminal vertex (or a leaf). (g) If x is not a terminal vertex, x is an internal vertex (or branch) (h) The subtree of T rooted at x is the graph with vertex set V and edge set E, where V is x together with the descendants of x and E = {e| e is an edge on a simple path from x to some vertex in V}.

Terminology & Characterization of Trees Theorem:  Let T be a graph with n vertices. The following are equivalent. (a) T is a tree. (b) T is connected and acyclic (graph with no cycles) (c) T is connected and has n–1 edges. (d) T is acyclic and has n–1 edges.

Example

Spanning Trees

Definition  A tree T is a spanning tree of a graph G if T is a subgraph of G that contains all of the vertices of G. Theorem  A graph G has a spanning tree if and only if G is connected.

Find Spanning Tree of G Graph G Graph G is connected, but it is not a tree because it contains simple cycles/circuits

Removing edges to eliminate cycle/circuit A Spanning Tree

Other Spanning Trees of G

Algorithms for Creating Spanning Tree  Depth-First Search  Breadth-First Search

Depth-First Search Arbitrarily choose a vertex of the graph as the root. Form a path starting at this vertex by successively adding vertices and edges, where each new edge is incident with the last vertex in the path and a vertex not already in the path. Continue adding vertices and edges to this path as long as possible. Move back to the last vertex in the path, and, if possible, form a new path starting at this vertex passing through vertices that were not already visited. Move back another vertex in the path (two vertices in the path) and try again. Repeat this procedure  Backtracking

Example Arbitrarily choose f as the root

Breadth-First Search Arbitrarily choose a vertex of the graph as the root. Add all edges incident to this vertex. The new vertices added at this stage become the vertices at level 1 in the spanning tree. For each level in level 1, add all edges incident to this vertex to the tree as long as it does not produce a simple circuit. This produce the vertices at level 2 in the tree. Repeat this procedure

Example

Minimum Spanning Tree

Definition:  Let G be a weighted graph. A minimum spanning tree of G is a spanning tree of G with minimum weight. Algorithms:  Prim’s algorithm  Kruskal’s algorithm

Prim’s Algorithm

Example

Binary Trees

Definition:  A binary tree is a rooted tree in which each vertex has either no children, one child, or two children.  If a vertex has a child, that child is designated as either a left child or a right child (but not both).  If a vertex has two children, one child is designated a left child and the other child is designated a right child. Note:  A full binary tree is a binary tree in which each vertex has either two children or zero children.

Example

Binary Trees Theorem:  If T is a full binary tree with i internal vertices, then T has i+1 terminal vertices and 2i+1 total vertices. Theorem:  If a binary tree of height h has t terminal vertices, then lg 2 t ≤ h Example

Application: Huffman Coding  Huffman code represents characters by variable- length bit strings  alternatives to ASCII or other fixed-length codes  Objective to use fewer bits: to save minimize storage and transmission time  The idea is to use short bit strings to represent most frequently used characters and longer bit strings to represent less frequently used characters  Easily defined by binary tree

Example ? SOTO?

Algorithm to construct an optimal Huffman Code

Example  Construct Huffman code for the following characters, given the frequency of occurrence as follows:  Algorithm begins by repeatedly replacing the smallest two frequencies with the sum until two-element sequence is obtained 2,3,7,8,12  2+3,7,8,12 5,7,8,12  5+7, 8,12 8,12,12  8+12, 12 12, 20 CharacterFrequency #7 $8 %12 Construct tree as follows

Example

Binary Search Tree How should items in a list be stored so that an item can be easily located? Definition  A binary search tree is a binary tree T in which data are associated with the vertices. The data are arranged so that, for each vertex v in T, each data item in the left subtree of v is less than the data item in v, and each data item in the right subtree of v is greater than the data item in v Example  Construct a binary search tree from the following words: OLD PROGRAMMERS NEVER DIE THEY JUST LOSE THEIR MEMORIES

Example