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.

Slides:



Advertisements
Similar presentations
Introduction to Algorithms
Advertisements

Trees Chapter 11.
Chapter 9 Graphs.
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)
22C:19 Discrete Structures Trees Spring 2014 Sukumar Ghosh.
Introduction to Trees Chapter 6 Objectives
Data Structures: A Pseudocode Approach with C 1 Chapter 6 Objectives Upon completion you will be able to: Understand and use basic tree terminology and.
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:
Last time: terminology reminder w Simple graph Vertex = node Edge Degree Weight Neighbours Complete Dual Bipartite Planar Cycle Tree Path Circuit Components.
Discrete Mathematics Transparency No. 8-1 Chapter 8 Trees.
1 Huffman Codes. 2 Introduction Huffman codes are a very effective technique for compressing data; savings of 20% to 90% are typical, depending on the.
Section 3.1 Properties of Trees Sarah Graham. Tree Talk: Vocabulary oTree: a tree is a special type of graph that contains designated vertex called a.
Lists A list is a finite, ordered sequence of data items. Two Implementations –Arrays –Linked Lists.
Graph Colouring Lecture 20: Nov 25.
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.
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.
May 5, 2015Applied Discrete Mathematics Week 13: Boolean Algebra 1 Dijkstra’s Algorithm procedure Dijkstra(G: weighted connected simple graph with vertices.
COSC2007 Data Structures II
CS 2210(22C:19) Discrete Math Graphs
Graph Theory Topics to be covered:
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
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.
Data Structures and Algorithms Lecture (BinaryTrees) Instructor: Quratulain.
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.
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.
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.
Planar Graphs Graph Coloring
Agenda Review: –Planar Graphs Lecture Content:  Concepts of Trees  Spanning Trees  Binary Trees Exercise.
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.
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.
1 Slides by Sylvia Sorkin, Community College of Baltimore County - Essex Campus Trees.
 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.
Great Theoretical Ideas in Computer Science for Some.
What is the chromatic number of this graph?. We have found a four-coloring. How do we know the chromatic number is not less than four?
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.
Planar Graphs Hubert Chan (Chapter 9.7) [O2 Proof Techniques]
Applied Discrete Mathematics Week 15: Trees
Graph Graphs and graph theory can be used to model:
Chapter 5 : Trees.
Discrete Mathematicsq
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.
Math 221 Huffman Codes.
Trees 11.1 Introduction to Trees Dr. Halimah Alshehri.
And the Final Subject is…
Presentation transcript:

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 w in G is a sequence e 1, e 2, …, e n of edges in E for which f(e 1 ) = {v 0, v 1 }, f(e 2 ) = {v 1, v 2 }, …, f(e n ) = {v n-1,v n }, for some set of vertices v 0, v 1, v 2, …, v n-1, v n in V, with v 0 = v and v n = w. (For loops e i, we would have v i-1 = v i, and f(e i ) would be a singleton set) A circuit of length n is simply a path of length n which ends where it started. In the above definition we simply have v = w. A simple path or simple circuit is one in which there are no repeated edges. Some Definitions from 9.4

Connectedness in Undirected Graphs We say that an undirected graph G is connected provided…

9.7 Planar Graphs Definition Water, Electricity, Gas

Examples:

Euler’s Formula

K 5 and K 3,3

Kuratowski’s Theorem

9.8 Graph Coloring Planar Dual Graph of a map

Coloring Define a coloring of a graph Define the chromatic number of a graph

The Four Color Theorem Appel and Haken, 1976 If there is a counterexample, then there is a minimal counterexample. A reducible configuration is a subgraph which cannot occur in a minimal counterexample. Appel and Haken proved that every planar graph contains one of 1936 reducible configurations. The proof was constructed by a computer program.

Three colors is not enough Can you come up with a quick proof of that fact?

Example:

Other Facts Since Appel and Haken’s proof, an O(n 2 ) algorithm has been discovered for 4- coloring planar graphs. The problem of finding a 3-coloring of a planar graph or deciding such does not exist is NP-complete. The problem of finding a 4-coloring of a general (non-planar) graph or deciding such does not exist is NP-complete.

Computing the Chromatic Number Can you come up with a simple algorithm for coloring a graph with a reasonably small number of colors?

Applications Scheduling rooms, final exams, etc. Assigning roles in a play Frequency assignments for TV stations

Example There are three meeting rooms in the lodge where the Royal Squid Captains hold their annual convention. Seven meetings are scheduled. There are four officers: The Exalted Octopus, the Revered Clam, the Mighty Sea Bass, and the Mystic Eel. The Exalted Octopus must be present for talks 1, 3, and 7. The Mystic Eel must attend talks 2, 4, and 1. The Revered Clam can’t afford to miss talk 2 or talk 5. Finally, the Mighty Sea Bass must be present for talks 1, 4, and 6. What is the minimum number of time slots needed in which to conduct the meetings, so that each officer will be able to attend all the meetings he must attend?

10.1 Introduction to Trees Definition: A tree is a connected undirected graph with no simple circuits Theorem: An undirected graph is a tree if and only if any two vertices are joined by a unique simple path.

Rooted Trees A rooted tree is a directed graph with all vertices except one having indegree one. The exception is the root, which has indegree zero. All other nodes are accessible from the root via a unique path Canonical tree drawing is…

Tree Terms Node, parent, child, sibling, ancestor, descendant Internal vertex, leaf

Tree Terms, Continued m-ary tree, binary tree Full m-ary tree

Ordered Trees An ordered tree is like a rooted tree, except that an ordering is assigned to the children of every node, so that the terms first child, left child, right child, etc, make sense.

Properties of Trees Theorem: A tree with n vertices has n-1 edges Theorem: A full m -ary tree with i internal vertices has n = mi+1 vertices

Relationships Between i, n, and l Let i, n, and l be the number of internal vertices, the total number of vertices, and the number of leaves, respectively. Theorem: In a full m -ary tree, all of the following formulae apply: a)i = (n – 1)/m and l = ((m – 1)n + 1)/m b)n = mi + 1 and l = (m – 1)i + 1 c)n = (m l – 1) / (m – 1) and i = ( l – 1)/(m – 1) In other words, with m fixed, any two of the attributes i, n, and l of a full m -ary tree can be computed given the remaining attribute

Example: Suppose that someone starts a chain letter. Each person who receives the letter is asked to send it on to four other people. Some people do this, but others do not send any letters. How many people have seen the letter, including the first person, if no one receives more than one letter and if the chain letter ends after there have been 100 people who read it but did not send it out? How many people sent out the letter?

Levels The level of a node is its distance from the root. The root is at level 0, its children are at level 1, their children are at level 2, etc. The height of a tree is the maximum of all the levels of its nodes A tree of height h is balanced provided all its leaves are either at height h or height h – 1.

Examples:

Leaves in an m -ary Tree Theorem: There are at most m h leaves in an m -ary tree of height h. Corollary: If an m -ary tree of height h has l leaves, then. If the tree is full and balanced, then

10.2 Applications of Trees

Binary Search Trees Maude Louise Ken Isaac George Zack Mary

Decision Trees

The Complexity of “Compare and Swap” Sorting Algorithms Theorem: A sorting algorithm based on binary comparisons requires at least __________ comparisons. Corollary: The number of comparisons used by a sorting algorithm to sort n elements based on binary comparisons is ________________.

Prefix Codes and Huffman Encoding Binary code assigns a bit string to each character. Variable- length code can be used to compress a document- shorter codes for more frequent characters. One example is a prefix code where no code appears as the prefix of another.

'a'.12 'c'.02 'd'.08 'o'.14 'p'.03 'r'.11 's'.20 't'.30 Example of Huffman Coding:

Game Trees