Minimum-cost spanning tree

Slides:



Advertisements
Similar presentations
© 2004 Goodrich, Tamassia Minimum Spanning Trees1 JFK BOS MIA ORD LAX DFW SFO BWI PVD
Advertisements

© 2004 Goodrich, Tamassia Minimum Spanning Trees1 JFK BOS MIA ORD LAX DFW SFO BWI PVD
Spring 2007Shortest Paths1 Minimum Spanning Trees JFK BOS MIA ORD LAX DFW SFO BWI PVD
Shortest Paths and Dijkstra's Algorithm CS 110: Data Structures and Algorithms First Semester,
Shortest Paths1 C B A E D F
Graph Algorithms: Minimum Spanning Tree We are given a weighted, undirected graph G = (V, E), with weight function w:
CSC 213 Lecture 23: Shortest Path Algorithms. Weighted Graphs Each edge in weighted graph has numerical weight Weights can be distances, building costs,
Minimum Spanning Trees1 JFK BOS MIA ORD LAX DFW SFO BWI PVD
© 2004 Goodrich, Tamassia Shortest Paths1 Shortest Paths (§ 13.6) Given a weighted graph and two vertices u and v, we want to find a path of minimum total.
© 2004 Goodrich, Tamassia Minimum Spanning Trees1 Minimum Spanning Trees (§ 13.7) Spanning subgraph Subgraph of a graph G containing all the vertices of.
Minimum Spanning Trees1 JFK BOS MIA ORD LAX DFW SFO BWI PVD
CSC311: Data Structures 1 Chapter 13: Graphs II Objectives: Graph ADT: Operations Graph Implementation: Data structures Graph Traversals: DFS and BFS Directed.
Shortest Paths1 C B A E D F
© 2004 Goodrich, Tamassia Shortest Paths1 C B A E D F
CSC 213 Lecture 24: Minimum Spanning Trees. Announcements Final exam is: Thurs. 5/11 from 8:30-10:30AM in Old Main 205.
1 Minimum Spanning Trees Longin Jan Latecki Temple University based on slides by David Matuszek, UPenn, Rose Hoberman, CMU, Bing Liu, U. of Illinois, Boting.
1 Minimum Spanning Trees Longin Jan Latecki Temple University based on slides by David Matuszek, UPenn, Rose Hoberman, CMU, Bing Liu, U. of Illinois, Boting.
Weighted Graphs In a weighted graph, each edge has an associated numerical value, called the weight of the edge Edge weights may represent, distances,
Graphs CS /02/05 Graphs Slide 2 Copyright 2005, by the authors of these slides, and Ateneo de Manila University. All rights reserved Definition.
© 2010 Goodrich, Tamassia Shortest Paths1 C B A E D F
1 Shortest Path Problem Topic 11 ITS033 – Programming & Algorithms C B A E D F Asst. Prof. Dr. Bunyarit Uyyanonvara IT Program,
1 Minimum Spanning Tree Problem Topic 10 ITS033 – Programming & Algorithms Asst. Prof. Dr. Bunyarit Uyyanonvara IT Program, Image and Vision Computing.
Lecture17: Graph I Bohyung Han CSE, POSTECH CSED233: Data Structures (2014F)
CSC 213 – Large Scale Programming. Today’s Goals  Discuss what is meant by weighted graphs  Where weights placed within Graph  How to use Graph ’s.
Module 5 – Networks and Decision Mathematics Chapter 23 – Undirected Graphs.
Minimum-Cost Spanning Tree CS 110: Data Structures and Algorithms First Semester,
Shortest Paths and Dijkstra’s Algorithm CS 105. SSSP Slide 2 Single-source shortest paths Given a weighted graph G and a source vertex v in G, determine.
1 Dijkstra’s Algorithm Dr. Ying Lu RAIK 283 Data Structures & Algorithms.
Chapter 8 Dynamic Programming Copyright © 2007 Pearson Addison-Wesley. All rights reserved.
CSC 213 – Large Scale Programming. Today’s Goals  Discuss what is meant by weighted graphs  Where weights placed within Graph  How to use Graph ’s.
© 2010 Goodrich, Tamassia Minimum Spanning Trees1 JFK BOS MIA ORD LAX DFW SFO BWI PVD
CSC 213 – Large Scale Programming. Minimum Spanning Tree (MST)  Spanning subgraph  Subgraph w/ all vertices ORD PIT ATL STL DEN DFW DCA
Union-Find  Application in Kruskal’s Algorithm  Optimizing Union and Find Methods.
CHAPTER 13 GRAPH ALGORITHMS ACKNOWLEDGEMENT: THESE SLIDES ARE ADAPTED FROM SLIDES PROVIDED WITH DATA STRUCTURES AND ALGORITHMS IN C++, GOODRICH, TAMASSIA.
Tree Diagrams A tree is a connected graph in which every edge is a bridge. There can NEVER be a circuit in a tree diagram!
© 2010 Goodrich, Tamassia Shortest Paths1 C B A E D F
© 2010 Goodrich, Tamassia Minimum Spanning Trees1 JFK BOS MIA ORD LAX DFW SFO BWI PVD
1 COMP9024: Data Structures and Algorithms Week Twelve: Graphs (II) Hui Wu Session 1, 2014
CSE 373 Data Structures and Algorithms
Shortest Paths C B A E D F Shortest Paths
Minimum-Cost Spanning Tree and Kruskal’s Algorithm
COMP9024: Data Structures and Algorithms
Minimum Spanning Trees
Shortest Path 6/18/2018 4:22 PM Presentation for use with the textbook Data Structures and Algorithms in Java, 6th edition, by M. T. Goodrich, R. Tamassia,
Shortest Paths C B A E D F Shortest Paths 1
Minimum Spanning Trees
Minimum Spanning Tree Chapter 13.6.
Chapter 14 Graph Algorithms
Minimum Spanning Tree 11/3/ :04 AM Minimum Spanning Tree
Short paths and spanning trees
Shortest Paths C B A E D F
Minimum Spanning Tree.
Connected Components Minimum Spanning Tree
Minimum Spanning Tree.
Shortest Paths C B A E D F Shortest Paths
Minimum Spanning Trees
Spanning Trees.
Kruskal’s Algorithm for finding a minimum spanning tree
Chapter 13 Graph Algorithms
CSE 373: Data Structures and Algorithms
Minimum Spanning Tree Section 7.3: Examples {1,2,3,4}
Graphs Part 2.
Graph Algorithms shortest paths, minimum spanning trees, etc.
Minimum Spanning Trees
Single-source shortest paths
Minimum Spanning Trees
Shortest Paths.
Minimum Spanning Trees
Weighted Graphs C B A E D F Sequences
Minimum Spanning Trees (MSTs)
Presentation transcript:

Minimum-cost spanning tree Given a weighted graph G, determine a spanning tree with minimum total edge cost Recall: spanning subgraph means all vertices are included, tree means the graph is connected and has no cycles Useful in applications that ensure connectivity of nodes at optimal cost Copyright 2005, by the authors of these slides, and Ateneo de Manila University. All rights reserved Graphs Slide 1

Kruskal’s algorithm Solves the minimum-cost spanning tree problem Strategy: repeatedly select the lowest-cost edge as long as it does not form a cycle with previously selected edges Stop when n-1 edges have been selected (recall n is the number of vertices) Use a priority queue of edges to facilitate selection of lowest-edge cost (just discard edges that form a cycle) Time complexity: O( m log m ) => O( m log n ) Copyright 2005, by the authors of these slides, and Ateneo de Manila University. All rights reserved Graphs Slide 2

Kruskal’s algorithm BOS ORD PVD JFK SFO BWI DFW LAX MIA 2704 867 849 187 1846 144 740 621 802 JFK SFO 1464 184 1258 1391 337 BWI 1090 DFW 1235 LAX 946 1121 MIA 2342 Copyright 2005, by the authors of these slides, and Ateneo de Manila University. All rights reserved Graphs Slide 3

Kruskal’s algorithm BOS ORD PVD PVD JFK JFK SFO BWI DFW LAX MIA 2704 867 ORD 849 PVD PVD 187 1846 144 740 621 802 JFK JFK SFO 1464 184 1258 1391 337 BWI 1090 DFW 1235 LAX 946 1121 MIA 2342 Copyright 2005, by the authors of these slides, and Ateneo de Manila University. All rights reserved Graphs Slide 4

Kruskal’s algorithm BOS ORD PVD JFK SFO BWI BWI DFW LAX MIA 2704 867 849 PVD 187 1846 144 740 621 802 JFK SFO 1464 184 1258 1391 337 BWI BWI 1090 DFW 1235 LAX 946 1121 MIA 2342 Copyright 2005, by the authors of these slides, and Ateneo de Manila University. All rights reserved Graphs Slide 5

Kruskal’s algorithm BOS BOS ORD PVD JFK SFO BWI DFW LAX MIA 2704 867 849 PVD 187 1846 144 740 621 802 JFK SFO 1464 184 1258 1391 337 BWI 1090 DFW 1235 LAX 946 1121 MIA 2342 Copyright 2005, by the authors of these slides, and Ateneo de Manila University. All rights reserved Graphs Slide 6

Kruskal’s algorithm BOS ORD PVD JFK SFO SFO BWI DFW LAX LAX MIA 2704 867 ORD 849 PVD 187 1846 144 740 621 802 JFK SFO SFO 1464 184 1258 1391 337 BWI 1090 DFW 1235 LAX LAX 946 1121 MIA 2342 Copyright 2005, by the authors of these slides, and Ateneo de Manila University. All rights reserved Graphs Slide 7

Kruskal’s algorithm BOS ORD ORD PVD JFK SFO BWI DFW LAX MIA 2704 867 849 PVD 187 1846 144 740 621 802 JFK SFO 1464 184 1258 1391 337 BWI 1090 DFW 1235 LAX 946 1121 MIA 2342 Copyright 2005, by the authors of these slides, and Ateneo de Manila University. All rights reserved Graphs Slide 8

Kruskal’s algorithm BOS ORD PVD JFK SFO BWI DFW LAX MIA 2704 867 849 187 1846 144 740 621 802 JFK SFO 1464 184 1258 1391 337 BWI 1090 DFW 1235 LAX 946 1121 MIA 2342 Copyright 2005, by the authors of these slides, and Ateneo de Manila University. All rights reserved Graphs Slide 9

Kruskal’s algorithm BOS ORD PVD JFK SFO BWI DFW DFW LAX MIA 2704 867 849 PVD 187 1846 144 740 621 802 JFK SFO 1464 184 1258 1391 337 BWI 1090 DFW DFW 1235 LAX 946 1121 MIA 2342 Copyright 2005, by the authors of these slides, and Ateneo de Manila University. All rights reserved Graphs Slide 10

Kruskal’s algorithm BOS ORD PVD JFK SFO BWI DFW LAX MIA MIA 2704 867 849 PVD 187 1846 144 740 621 802 JFK SFO 1464 184 1258 1391 337 BWI 1090 DFW 1235 LAX 946 1121 MIA MIA 2342 Copyright 2005, by the authors of these slides, and Ateneo de Manila University. All rights reserved Graphs Slide 11

Kruskal’s algorithm BOS ORD PVD JFK SFO BWI DFW LAX MIA 2704 867 849 187 1846 144 740 621 802 JFK SFO 1464 184 1258 1391 337 BWI 1090 DFW 1235 LAX 946 1121 MIA 2342 Copyright 2005, by the authors of these slides, and Ateneo de Manila University. All rights reserved Graphs Slide 12

Kruskal’s algorithm BOS ORD PVD JFK SFO BWI DFW LAX MIA 2704 867 849 187 1846 144 740 621 802 JFK SFO 1464 184 1258 1391 337 BWI 1090 DFW 1235 LAX 946 1121 MIA 2342 Copyright 2005, by the authors of these slides, and Ateneo de Manila University. All rights reserved Graphs Slide 13