Spanning Tree. Lecture19: Graph III. Minimum Spanning Tree (MSP)

Similar documents
CAD Algorithms. Shortest Path

Campus Tour. 1/18/2005 4:08 AM Campus Tour 1

A region is each individual area or separate piece of the plane that is divided up by the network.

Algorithm Analysis Graph algorithm. Chung-Ang University, Jaesung Lee

Campus Tour Goodrich, Tamassia. Campus Tour 1

Lecture 13. Reading: Weiss, Ch. 9, Ch 8 CSE 100, UCSD: LEC 13. Page 1 of 29

Minimum Spanning Trees and Shortest Paths

Chapter 9. Greedy Technique. Copyright 2007 Pearson Addison-Wesley. All rights reserved.

Minimum-Spanning-Tree problem. Minimum Spanning Trees (Forests) Minimum-Spanning-Tree problem

CSE 100 Minimum Spanning Trees Prim s and Kruskal

Week 9 Student Responsibilities. Mat Example: Minimal Spanning Tree. 3.3 Spanning Trees. Prim s Minimal Spanning Tree.

11/22/2016. Chapter 9 Graph Algorithms. Introduction. Definitions. Definitions. Definitions. Definitions

Chapter 9 Graph Algorithms

Outline and Reading. Minimum Spanning Tree. Minimum Spanning Tree. Cycle Property. Minimum Spanning Trees ( 12.7)

Single Source, Shortest Path Problem

Minimum Spanning Trees. CSE 373 Data Structures

Chapter 9 Graph Algorithms

Minimum Spanning Trees My T. UF

Note. Out of town Thursday afternoon. Willing to meet before 1pm, me if you want to meet then so I know to be in my office

Chapter 9 Graph Algorithms

Spanning Trees. CSE373: Data Structures & Algorithms Lecture 17: Minimum Spanning Trees. Motivation. Observations. Spanning tree via DFS

Minimum Spanning Trees and Shortest Paths

Decreasing a key FIB-HEAP-DECREASE-KEY(,, ) 3.. NIL. 2. error new key is greater than current key 6. CASCADING-CUT(, )

Graphs and Network Flows ISE 411. Lecture 7. Dr. Ted Ralphs

CSE 332: Data Structures & Parallelism Lecture 22: Minimum Spanning Trees. Ruth Anderson Winter 2018

CS1800: Graph Algorithms (2nd Part) Professor Kevin Gold

Minimum Spanning Trees

Minimum-Cost Spanning Tree. Example

22 Elementary Graph Algorithms. There are two standard ways to represent a

Example. Minimum-Cost Spanning Tree. Edge Selection Greedy Strategies. Edge Selection Greedy Strategies

Reference Sheet for CO142.2 Discrete Mathematics II

Greedy Algorithms. At each step in the algorithm, one of several choices can be made.

Theory of Computing. Lecture 10 MAS 714 Hartmut Klauck

Minimum Spanning Trees

22 Elementary Graph Algorithms. There are two standard ways to represent a

Algorithm Design and Analysis

Lecture 19. Broadcast routing

Design and Analysis of Algorithms

Week 11: Minimum Spanning trees

Graph ADT. Lecture18: Graph II. Adjacency Matrix. Representation of Graphs. Data Vertices and edges. Methods

10/31/18. About A6, Prelim 2. Spanning Trees, greedy algorithms. Facts about trees. Undirected trees

Spanning Trees, greedy algorithms. Lecture 20 CS2110 Fall 2018

23.2 Minimum Spanning Trees

Tree. number of vertices. Connected Graph. CSE 680 Prof. Roger Crawfis

Chapter 4. Greedy Algorithms. Slides by Kevin Wayne. Copyright 2005 Pearson-Addison Wesley. All rights reserved.

CS 5114: Theory of Algorithms. Graph Algorithms. A Tree Proof. Graph Traversals. Clifford A. Shaffer. Spring 2014

Minimum Spanning Trees

Chapter 14. Graphs Pearson Addison-Wesley. All rights reserved 14 A-1

Minimum Spanning Trees. Minimum Spanning Trees. Minimum Spanning Trees. Minimum Spanning Trees

CSC 1700 Analysis of Algorithms: Minimum Spanning Tree

Greedy Algorithms Part Three

Routing. Effect of Routing in Flow Control. Relevant Graph Terms. Effect of Routing Path on Flow Control. Effect of Routing Path on Flow Control

SPANNING TREES. Lecture 21 CS2110 Spring 2016

Announcements Problem Set 5 is out (today)!

CSC 8301 Design & Analysis of Algorithms: Kruskal s and Dijkstra s Algorithms

CS302 - Data Structures using C++

MST & Shortest Path -Prim s -Djikstra s

Lecture 20: Other Algorithms on Graphs. Undirected Trees. Spanning Trees

We have already seen the transportation problem and the assignment problem. Let us take the transportation problem, first.

Algorithms and Data Structures (INF1) Lecture 15/15 Hua Lu

Minimum Spanning Trees

NP-Hard (A) (B) (C) (D) 3 n 2 n TSP-Min any Instance V, E Question: Hamiltonian Cycle TSP V, n 22 n E u, v V H

L10 Graphs. Alice E. Fischer. April Alice E. Fischer L10 Graphs... 1/37 April / 37

Chapter 4. Greedy Algorithms. Slides by Kevin Wayne. Copyright 2005 Pearson-Addison Wesley. All rights reserved.

6.1 Minimum Spanning Trees

Introduction: (Edge-)Weighted Graph

UC Berkeley CS 170: Efficient Algorithms and Intractable Problems Handout 8 Lecturer: David Wagner February 20, Notes 8 for CS 170

Best known solution time is Ω(V!) Check every permutation of vertices to see if there is a graph edge between adjacent vertices

Today More about Trees. Introduction to Computers and Programming. Spanning trees. Generic search algorithm. Prim s algorithm Kruskal s algorithm

CSE331 Introduction to Algorithms Lecture 15 Minimum Spanning Trees

1. trees does the network shown in figure (a) have? (b) How many different spanning. trees does the network shown in figure (b) have?

Algorithm Design Techniques. Hwansoo Han

Spanning Trees, greedy algorithms. Lecture 22 CS2110 Fall 2017

Lecture 34 Fall 2018 Wednesday November 28

CSE 21: Mathematics for Algorithms and Systems Analysis

CS/ENGRD 2110 Object-Oriented Programming and Data Structures Spring 2012 Thorsten Joachims. Lecture 25: Review and Open Problems

COP 4531 Complexity & Analysis of Data Structures & Algorithms

2 Approximation Algorithms for Metric TSP

Chapter 9. Greedy Algorithms: Spanning Trees and Minimum Spanning Trees


Introduction to Algorithms

Spanning Trees 4/19/17. Prelim 2, assignments. Undirected trees

Spanning Trees. Lecture 22 CS2110 Spring 2017

Computer Science & Engineering 423/823 Design and Analysis of Algorithms

Autumn Minimum Spanning Tree Disjoint Union / Find Traveling Salesman Problem

Minimum Spanning Trees

CS 5114: Theory of Algorithms. Graph Algorithms. A Tree Proof. Graph Traversals. Clifford A. Shaffer. Spring 2014

Introduction to Algorithms

Elementary Graph Algorithms: Summary. Algorithms. CmSc250 Intro to Algorithms

Undirected Graphs. Hwansoo Han

Partha Sarathi Mandal

CS200: Graphs. Rosen Ch , 9.6, Walls and Mirrors Ch. 14

CHAPTER 14 GRAPH ALGORITHMS ORD SFO LAX DFW

Introduction to Algorithms

Week 12: Minimum Spanning trees and Shortest Paths

CSC 8301 Design & Analysis of Algorithms: Warshall s, Floyd s, and Prim s algorithms

Outline. Graphs. Divide and Conquer.

Partha Sarathi Manal

managing an evolving set of connected components implementing a Union-Find data structure implementing Kruskal s algorithm

15 211: RECITATION7, SECTION M. Hui Han Chin,

Transcription:

Spanning Tree (015) Lecture1: Graph III ohyung Han S, POSTH bhhan@postech.ac.kr efinition and property Subgraph that contains all vertices of the original graph and is a tree Often, a graph has many different spanning trees. 1 15 Graph 1 ost of spanning tree: the sum of the edge weights in the spanning tree: + + 1 + 15 + = 5 Useful in constructing networks: a minimum spanning tree gives the way to connect a set of points with the smallest total amount of wire 1 15 Spanning tree Minimum Spanning Tree (MSP) spanning tree with the minimum cost 1 ost: + + + + = inding the minimum spanning tree Graph Prim s algorithm Kruskal s algorithms 15 1 Minimum spanning tree Prim s lgorithm Prim s algorithm builds the MST one vertex at a time. Prim s algorithm keeps track of:, the set of vertices included in the MST so far, and, the set of vertices not in the MST yet and, for each such vertex, the cheapest edge connecting to any vertex in Procedure egin with t each step Look at all the vertices in hoose the vertex with the cheapest edge,, and dd to unless creates a cycle fter steps (where is the number of vertices), the chosen vertices and their cheapest edges form a MST for the graph.

Key procedure in each step Prim s lgorithm ind a vertex in with the cheapest edge connecting it to any vertex in Keep the vertices in in a priority queue. The priority of a vertex in the priority queue is the cost of the cheapest edge connecting and some vertex in. If there is no such edge, then s priority is infinity. Record the edge that gives a vertex its priority, because when a vertex is removed from the priority queue, its recorded edge becomes a spanning tree edge. Goal cheapest edge: the lowest cost is the highest priority Use a min heap. n xample ind a minimum spanning tree of the following weighted graph using Prim s algorithm. 1 5 n xample n xample Starting from dd the first priority vertex,. 1 1 Vertex Priority 1 inf inf inf dge (,) (,) Vertex Priority inf 1 inf dge (,) (,)

n xample n xample 1 1 Vertex Vertex Priority 1 inf Priority 1 dge (,) (,) dge (,) (,) n xample n xample 1 1 Vertex Priority 1 dge (,) 1

Kruskal s lgorithm Kruskal s algorithm builds the MST one vertex at a time. reate a forest (a set of trees), where each vertex in the graph is a separate tree reate a set containing all the edges in the graph while is nonempty and is not yet spanning Remove an edge with minimum weight from If that edge connects two different trees, then add it to the forest, combining two trees into a single tree Otherwise discard that edge. t the termination of the algorithm, the forest forms a minimum spanning forest of the graph. n xample ind a minimum spanning tree of the following weighted graph using Kruskal s algorithm. 1 dge (,) (,) (,) (,) (,) (,) (,) (,) (,) Priority 1 5 5 1 1 n xample n xample Start with the edge with minimum weight. dd the first priority edge as long as it does not create a cycle. 1 1 dge (,) (,) (,) (,) (,) (,) (,) (,) Priority 1 dge (,) (,) (,) (,) (,) (,) (,) Priority 1 5 15 1

n xample n xample 1 1 dge (,) (,) (,) (,) (,) (,) Priority 1 5 dge (,) (,) (,) (,) (,) Priority inf inf 1 1 1 n xample nalysis of MST lgorithms 1 Greedy algorithm: Making the locally optimal choice at each stage No backtracking However, the solution is optimal. Time complexity Prim s algorithm: log or with adjacency matrix log with binary heap and adjacency list log with ibonacci heap and adjacency list Kruskal s algorithm: log dge (,) (,) (,) (,) Priority inf inf inf inf 1 0

Hamiltonian ycle cycle that goes through every vertex exactly once efinition Traveling Salesperson Problem (TSP) The problem of finding the minimum cost Hamiltonian circuit in a weighted graph Properties Intractable problem NP: There is no polynomial time algorithm. Many other problems are in this class. Time complexity of TSP where is the number of vertices Time complexity of naïve algorithm:! Time complexity of the best known algorithm: Greedy algorithm Time complexity: Not necessarily optimal 1