(CSC 102) Lecture 32 Discrete Structures. Trees Previous Lecture  Matrices and Graphs  Matrices and Directed Graphs  Matrices and undirected Graphs.

Slides:



Advertisements
Similar presentations
Lecture 15. Graph Algorithms
Advertisements

22C:19 Discrete Math Graphs Fall 2014 Sukumar Ghosh.
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.
IKI 10100: Data Structures & Algorithms Ruli Manurung (acknowledgments to Denny & Ade Azurat) 1 Fasilkom UI Ruli Manurung (Fasilkom UI)IKI10100: Lecture10.
Lecture 21 Paths and Circuits CSCI – 1900 Mathematics for Computer Science Fall 2014 Bill Pine.
3.3 Spanning Trees Tucker, Applied Combinatorics, Section 3.3, by Patti Bodkin and Tamsen Hunter.
C++ Programming: Program Design Including Data Structures, Third Edition Chapter 21: Graphs.
1 Spanning Trees Lecture 20 CS2110 – Spring
Applied Discrete Mathematics Week 12: Trees
Discussion #36 Spanning Trees
Graph Algorithms: Minimum Spanning Tree We are given a weighted, undirected graph G = (V, E), with weight function w:
3/29/05Tucker, Sec Applied Combinatorics, 4th Ed. Alan Tucker Section 4.2 Minimal Spanning Trees Prepared by Amanda Dargie and Michele Fretta.
Tirgul 13 Today we’ll solve two questions from last year’s exams.
Chapter 9: Graphs Basic Concepts
MATH 310, FALL 2003 (Combinatorial Problem Solving) Lecture 10, Monday, September 22.
The Shortest Path Problem
Discrete Mathematics Lecture 9 Alexander Bukharovich New York University.
Chapter 15 Graph Theory © 2008 Pearson Addison-Wesley.
Chapter 15 Graph Theory © 2008 Pearson Addison-Wesley. All rights reserved.
Data Structures Using C++ 2E
Chapter 15 Graph Theory © 2008 Pearson Addison-Wesley.
Midwestern State University Minimum Spanning Trees Definition of MST Generic MST algorithm Kruskal's algorithm Prim's algorithm 1.
Copyright © Cengage Learning. All rights reserved.
Chapter 9 – Graphs A graph G=(V,E) – vertices and edges
Slide 14-1 Copyright © 2005 Pearson Education, Inc. SEVENTH EDITION and EXPANDED SEVENTH EDITION.
Graph Theory Topics to be covered:
BCT 2083 DISCRETE STRUCTURE AND APPLICATIONS
Dr. Amer Rasheed COMSATS Institute of Information Technology
Foundations of Discrete Mathematics
7.1 and 7.2: Spanning Trees. A network is a graph that is connected –The network must be a sub-graph of the original graph (its edges must come from the.
Prims’ spanning tree algorithm Given: connected graph (V, E) (sets of vertices and edges) V1= {an arbitrary node of V}; E1= {}; //inv: (V1, E1) is a tree,
Minimum Spanning Trees Prof. Sin-Min Lee Dept. of Computer Science, San Jose State University.
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.
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.
Fundamental Data Structures and Algorithms (Spring ’05) Recitation Notes: Graphs Slides prepared by Uri Dekel, Based on recitation.
Spanning Trees. A spanning tree for a connected, undirected graph G is a graph S consisting of the nodes of G together with enough edges of G such that:
Introduction to Graph Theory
Fall 2015 COMP 2300 Discrete Structures for Computation Donghyun (David) Kim Department of Mathematics and Physics North Carolina Central University 1.
Agenda Review: –Planar Graphs Lecture Content:  Concepts of Trees  Spanning Trees  Binary Trees Exercise.
COSC 2007 Data Structures II Chapter 14 Graphs I.
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.
© 2010 Pearson Prentice Hall. All rights reserved. CHAPTER 15 Graph Theory.
EXCURSIONS IN MODERN MATHEMATICS SIXTH EDITION Peter Tannenbaum 1.
Union-Find  Application in Kruskal’s Algorithm  Optimizing Union and Find Methods.
Aaron Tan 12. Graphs and Trees November 2015
Spanning Tree Algorithms William T. Trotter and Mitchel T. Keller Math 3012 – Applied Combinatorics Spring 2009.
Graph Theory Trees. WHAT YOU WILL LEARN Trees, spanning trees, and minimum-cost spanning 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.
MA/CSSE 473 Day 34 MST details: Kruskal's Algorithm Prim's Algorithm.
Chapter 20: Graphs. Objectives In this chapter, you will: – Learn about graphs – Become familiar with the basic terminology of graph theory – Discover.
Graphs Definition: a graph is an abstract representation of a set of objects where some pairs of the objects are connected by links. The interconnected.
(CSC 102) Lecture 30 Discrete Structures. Graphs.
Midwestern State University Minimum Spanning Trees Definition of MST Generic MST algorithm Kruskal's algorithm Prim's algorithm 1.
Trees.
Applied Discrete Mathematics Week 15: Trees
Minimum Spanning Tree Chapter 13.6.
Spanning Trees.
12. Graphs and Trees 2 Summary
Greedy Algorithms / Minimum Spanning Tree Yin Tat Lee
Autumn 2016 Lecture 11 Minimum Spanning Trees (Part II)
Spanning Trees.
Connected Components Minimum Spanning Tree
Autumn 2015 Lecture 11 Minimum Spanning Trees (Part II)
4-4 Graph Theory Trees.
Chapter 9: Graphs Basic Concepts
And the Final Subject is…
Chapter 15 Graph Theory © 2008 Pearson Addison-Wesley.
Winter 2019 Lecture 11 Minimum Spanning Trees (Part II)
Chapter 9: Graphs Basic Concepts
Autumn 2019 Lecture 11 Minimum Spanning Trees (Part II)
Presentation transcript:

(CSC 102) Lecture 32 Discrete Structures

Trees

Previous Lecture  Matrices and Graphs  Matrices and Directed Graphs  Matrices and undirected Graphs  Matrices and Connected Components  Trees  Characterizing Trees  Rooted Trees

Today’s Lecture  Rooted Trees  Binary Trees  Spanning Trees and Shortest Paths  Minimum Spanning Trees  Kruskal’s Algorithm  Prim’s Algorithm  Finding Minimum Spanning Trees

Rooted Trees

These terms are illustrated in the following Figure of Rooted Tree

Rooted Trees Example

Binary Trees

Representation of Algebraic Expressions a/b a/(c+d) ((a − b)·c) + (d/e)

Spanning Trees and Shortest Paths An East Coast airline company wants to expand service to the Midwest and has received permission from the Federal Aviation Authority to fly any of the routes shown in Figure

Spanning Trees and Shortest Paths The fact is that the graph of any system of routes that satisfies the company’s wishes is a tree, because if the graph were to contain a circuit, then one of the routes in the circuit could be removed without disconnecting the graph, and that would give a smaller total number of routes. But any tree with eight vertices has seven edges. Therefore, any system of routes that connects all eight vertices and yet minimizes the total number of routes consists of seven routes.

Spanning Trees and Shortest Paths Definition A spanning tree for a graph G is a subgraph of G that contains every vertex of G and is a tree. Theorem 1. Every connected graph has a spanning tree. 2. Any two spanning trees for a graph have the same number of edges.

Spanning Trees Example Find all spanning trees for the graph G pictured below. Solution The graph G has one circuit v 2 v 1 v 4 v 2, and removal of any edge of the circuit gives a tree. Thus, as shown below, there are three spanning trees for G.

Minimum Spanning Trees Now suppose the airline company wants to serve all the cities shown, but with a route system that minimizes the total mileage. More generally, a graph whose edges are labeled with numbers (known as weights) is called a weighed graph. A minimum-weight spanning tree, or simply a minimum spanning tree, is a spanning tree for which the sum of the weights of all the edges is as small as possible.

Minimum Spanning Trees

In Kruskal’s algorithm, the edges of a connected weighted graph are examined one by Courtesy of Joseph Kruskal (born 1928) one in order of increasing weight. At each stage the edge being examined is added to what will become the minimum spanning tree, provided that this addition does not create a circuit. After n − 1 edges have been added (where n is the number of vertices of the graph), these edges, together with the vertices of the graph, form a minimum spanning tree for the graph. Kruskal’s Algorithm

Describe the action of Kruskal’s algorithm on the graph shown in Figure, where n = 8.

Kruskal’s Algorithm

Prim’s Algorithm Prim’s algorithm works differently from Kruskal’s. It builds a minimum spanning tree T Courtesy of Alcatel- Lucent Technologies Robert Prim (born 1921) by expanding outward in connected links from some vertex. One edge and one vertex are added at each stage. The edge added is the one of least weight that connects the vertices already in T with those not in T, and the vertex is the endpoint of this edge that is not already in T.

Prim’s Algorithm

Describe the action of Prim’s algorithm for the graph in Figure using the Minneapolis vertex as a starting point. Prim’s Algorithm

Finding Minimum Spanning Trees Example Find all minimum spanning trees for the following graph. Use Kruskal’s algorithm and Prim’s algorithm starting at vertex a. Indicate the order in which edges are added to form each tree. Solution When Kruskal’s algorithm is applied, edges are added in one of the following two orders:

Finding Minimum Spanning Trees When Prim’s algorithm is applied starting at a, edges are added in one of the following two orders: Thus, as shown below, there are two distinct minimum spanning trees for this graph.

Lecture Summary  Rooted Trees  Binary Trees  Spanning Trees and Shortest Paths  Minimum Spanning Trees  Kruskal’s Algorithm  Prim’s Algorithm  Finding Minimum Spanning Trees

Syllabus (Topics to be covered in this course) LogicLogic Elementary Number Theory and Methods of ProofElementary Number Theory and Methods of Proof Set TheorySet Theory RelationsRelations Sequences and SummationSequences and Summation Mathematical InductionMathematical Induction CountingCounting Relations and Equivalence RelationsRelations and Equivalence Relations GraphsGraphs TreesTrees

Reference Books Discrete Mathematics and its Applications ( with Combinatorics and Graph Theory ) 6th Edition, The McGraw-Hill Companies, 2007, Kenneth H. Rosen. Discrete Mathematics with Applications 2nd Edition, Thomson Learning, 1995, Susanna S. Epp. Discrete Mathematics for Computer Scientists 2nd Edition, Addison-Wesley, 1999, John Truss.