Minimum Spanning Trees

Similar documents
Minimum Spanning Trees. Application: Connecting a Network

Minimum Spanning Trees

Minimum Spanning Trees

Heaps. Presentation for use with the textbook Algorithm Design and Applications, by M. T. Goodrich and R. Tamassia, Wiley, 2015

Graphs. Minimum Spanning Trees. Slides by Rose Hoberman (CMU)

Graphs ORD SFO LAX DFW

Greedy Algorithms. Interval Scheduling. Greedy Algorithms. Interval scheduling. Greedy Algorithms. Interval Scheduling

Lecturers: Sanjam Garg and Prasad Raghavendra Feb 21, Midterm 1 Solutions

Graph Terminology and Representations

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

6.854J / J Advanced Algorithms Fall 2008

Minimum Spanning Trees

Hash Tables. Presentation for use with the textbook Algorithm Design and Applications, by M. T. Goodrich and R. Tamassia, Wiley, 2015.

Minimum Spanning Trees

Minimum Spanning Trees

Graphs ORD SFO LAX DFW. Lecture notes adapted from Goodrich and Tomassia. 3/14/18 10:28 AM Graphs 1

15-859E: Advanced Algorithms CMU, Spring 2015 Lecture #2: Randomized MST and MST Verification January 14, 2015

CHAPTER 14 GRAPH ALGORITHMS ORD SFO LAX DFW

CIS 121 Data Structures and Algorithms with Java Spring Stacks and Queues Monday, February 12 / Tuesday, February 13

n n B. How many subsets of C are there of cardinality n. We are selecting elements for such a

CIS 121 Data Structures and Algorithms with Java Spring Stacks, Queues, and Heaps Monday, February 18 / Tuesday, February 19

Prim & Kruskal Algorithm

MAXIMUM MATCHINGS IN COMPLETE MULTIPARTITE GRAPHS

Lecture 5. Counting Sort / Radix Sort

CHAPTER 13 GRAPH ALGORITHMS

Design and Analysis of Algorithms Notes

The isoperimetric problem on the hypercube

Administrative UNSUPERVISED LEARNING. Unsupervised learning. Supervised learning 11/25/13. Final project. No office hours today

Combination Labelings Of Graphs

On (K t e)-saturated Graphs

Graphs Weighted Graphs. Reading: 12.5, 12.6, 12.7

Ones Assignment Method for Solving Traveling Salesman Problem

Graph Algorithms shortest paths, minimum spanning trees, etc.

Perhaps the method will give that for every e > U f() > p - 3/+e There is o o-trivial upper boud for f() ad ot eve f() < Z - e. seems to be kow, where

Random Graphs and Complex Networks T

CHAPTER IV: GRAPH THEORY. Section 1: Introduction to Graphs

Strong Complementary Acyclic Domination of a Graph

Graphs. Shortest Path and Topological Sort

Counting the Number of Minimum Roman Dominating Functions of a Graph

1 Graph Sparsfication

THE PROBLEM THE PROBLEM (1) THE PROBLEM (2) THE MINIMUM ENERGY BROADCAST PROBLEM THE MINIMUM SPANNING TREE

Priority Queues. Binary Heaps

Lecture 6. Lecturer: Ronitt Rubinfeld Scribes: Chen Ziv, Eliav Buchnik, Ophir Arie, Jonathan Gradstein

. Written in factored form it is easy to see that the roots are 2, 2, i,

Data Structures Week #9. Sorting

Examples and Applications of Binary Search

Sorting 9/15/2009. Sorting Problem. Insertion Sort: Soundness. Insertion Sort. Insertion Sort: Running Time. Insertion Sort: Soundness

Chapter 9. Pointers and Dynamic Arrays. Copyright 2015 Pearson Education, Ltd.. All rights reserved.

Computational Geometry

CSC165H1 Worksheet: Tutorial 8 Algorithm analysis (SOLUTIONS)

DATA STRUCTURES. amortized analysis binomial heaps Fibonacci heaps union-find. Data structures. Appetizer. Appetizer

Load balanced Parallel Prime Number Generator with Sieve of Eratosthenes on Cluster Computers *

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

Spanning Maximal Planar Subgraphs of Random Graphs

Minimum Spanning Trees My T. UF

Pattern Recognition Systems Lab 1 Least Mean Squares

3. b. Present a combinatorial argument that for all positive integers n : : 2 n

Image Segmentation EEE 508

15-850: Advanced Algorithms CMU, Spring 2017 Lecture #2: Randomized MST and Directed MSTs January 27, 2017

Graph Algorithms shortest paths, minimum spanning trees, etc.

Chapter 10. Defining Classes. Copyright 2015 Pearson Education, Ltd.. All rights reserved.

c-dominating Sets for Families of Graphs

CS200: Hash Tables. Prichard Ch CS200 - Hash Tables 1

Big-O Analysis. Asymptotics

CSE 417: Algorithms and Computational Complexity

Data Structures and Algorithms. Analysis of Algorithms

Global Support Guide. Verizon WIreless. For the BlackBerry 8830 World Edition Smartphone and the Motorola Z6c

Chapter 8. Strings and Vectors. Copyright 2014 Pearson Addison-Wesley. All rights reserved.

Week 12: Minimum Spanning trees and Shortest Paths

Data Structures and Algorithms Part 1.4

Name of the Student: Unit I (Logic and Proofs) 1) Truth Table: Conjunction Disjunction Conditional Biconditional

Some non-existence results on Leech trees

Symmetric Class 0 subgraphs of complete graphs

The Magma Database file formats

5.3 Recursive definitions and structural induction

Multiprocessors. HPC Prof. Robert van Engelen

Chapter 11. Friends, Overloaded Operators, and Arrays in Classes. Copyright 2014 Pearson Addison-Wesley. All rights reserved.

CSE 2320 Notes 8: Sorting. (Last updated 10/3/18 7:16 PM) Idea: Take an unsorted (sub)array and partition into two subarrays such that.

Protected points in ordered trees

Cluster Analysis. Andrew Kusiak Intelligent Systems Laboratory

1/27/12. Vectors: Outline and Reading. Chapter 6: Vectors, Lists and Sequences. The Vector ADT. Applications of Vectors. Array based Vector: Insertion

Fundamentals of Media Processing. Shin'ichi Satoh Kazuya Kodama Hiroshi Mo Duy-Dinh Le

Transitioning to BGP

CIS 121. Introduction to Trees

Order statistics. Order Statistics. Randomized divide-andconquer. Example. CS Spring 2006

of types having a total order and a predecessor and a successor function. In the

A study on Interior Domination in Graphs

A Note on Chromatic Transversal Weak Domination in Graphs

Chapter 8. Strings and Vectors. Copyright 2015 Pearson Education, Ltd.. All rights reserved.

Computer Science Foundation Exam. August 12, Computer Science. Section 1A. No Calculators! KEY. Solutions and Grading Criteria.

What are we going to learn? CSC Data Structures Analysis of Algorithms. Overview. Algorithm, and Inputs

Homework 1 Solutions MA 522 Fall 2017

condition w i B i S maximum u i

Chapter 1. Introduction to Computers and C++ Programming. Copyright 2015 Pearson Education, Ltd.. All rights reserved.

Elementary Educational Computer

Analysis of Algorithms

Data Structures Week #5. Trees (Ağaçlar)

Parabolic Path to a Best Best-Fit Line:

Big-O Analysis. Asymptotics

1.2 Binomial Coefficients and Subsets

Transcription:

Presetatio for use with the textbook, lgorithm esig ad pplicatios, by M. T. Goodrich ad R. Tamassia, Wiley, 0 Miimum Spaig Trees 0 Goodrich ad Tamassia Miimum Spaig Trees

pplicatio: oectig a Network Suppose the remote moutai coutry of Vectoria has bee give a major grat to istall a large Wi-i the ceter of each of its moutai villages. ommuicatio cables ca ru from the mai Iteret access poit to a village tower ad cables ca also ru betwee pairs of towers. The challege is to itercoect all the towers ad the Iteret access poit as cheaply as possible. 0 Goodrich ad Tamassia Miimum Spaig Trees

pplicatio: oectig a Network We ca model this problem usig a graph, G, where each vertex i G is the locatio of a Wi-i the Iteret access poit, ad a edge i G is a possible cable we could ru betwee two such vertices. ach edge i G could the be give a weight that is eual to the cost of ruig the cable that that edge represets. Thus, we are iterested i fidig a coected acyclic subgraph of G that icludes all the vertices of G ad has miimum total cost. Usig the laguage of graph theory, we are iterested i fidig a miimum spaig tree (MST) of G. 0 Goodrich ad Tamassia Miimum Spaig Trees

Miimum Spaig Trees Spaig subgraph Subgraph of a graph G cotaiig all the vertices of G Spaig tree OR 0 PIT Spaig subgraph that is itself a (free) tree Miimum spaig tree (MST) Spaig tree of a weighted graph with miimum total edge weight N STL pplicatios ommuicatios etworks Trasportatio etworks W TL 0 Goodrich ad Tamassia Miimum Spaig Trees

ycle Property ycle Property: Let T be a miimum spaig tree of a weighted graph G Let e be a edge of G that is ot i T ad let be the cycle formed by e with T or every edge f of, weight(f) weight(e) Proof: y cotradictio If weight(f) > weight(e) we ca get a spaig tree of smaller weight by replacig e with f 0 Goodrich ad Tamassia Miimum Spaig Trees f f e Replacig f with e yields a better spaig tree e

Partitio Property Partitio Property: osider a partitio of the vertices of G ito subsets U ad V Let e be a edge of miimum weight across the partitio There is a miimum spaig tree of G cotaiig edge e Proof: Let T be a MST of G If T does ot cotai e, cosider the cycle formed by e with T ad let f be a edge of across the partitio y the cycle property, weight(f) weight(e) Thus, weight(f) = weight(e) We obtai aother MST by replacig f with e 0 Goodrich ad Tamassia Miimum Spaig Trees U U f e f e V Replacig f with e yields aother MST V

Prim-Jarik s lgorithm Similar to ijkstra s algorithm We pick a arbitrary vertex s ad we grow the MST as a cloud of vertices, startig from s We store with each vertex v label d(v) represetig the smallest weight of a edge coectig v to a vertex i the cloud t each step: We add to the cloud the vertex u outside the cloud with the smallest distace label We update the labels of the vertices adjacet to u 0 Goodrich ad Tamassia Miimum Spaig Trees

Prim-Jarik Pseudo-code 0 Goodrich ad Tamassia Miimum Spaig Trees

0 Goodrich ad Tamassia Miimum Spaig Trees xample 0 0 0 0

0 Goodrich ad Tamassia Miimum Spaig Trees 0 xample (cotd.) 0 0

alysis Graph operatios We cycle through the icidet edges oce for each vertex Label operatios We set/get the distace, paret ad locator labels of vertex z O(deg(z)) times Settig/gettig a label takes O() time Priority ueue operatios ach vertex is iserted oce ito ad removed oce from the priority ueue, where each isertio or removal takes O(log ) time The key of a vertex w i the priority ueue is modified at most deg(w) times, where each key chage takes O(log ) time Prim-Jarik s algorithm rus i O(( + m) log ) time provided the graph is represeted by the adjacecy list structure Recall that Σ v deg(v) = m The ruig time is O(m log ) sice the graph is coected 0 Goodrich ad Tamassia Miimum Spaig Trees

Kruskal s pproach Maitai a partitio of the vertices ito clusters Iitially, sigle-vertex clusters Keep a MST for each cluster Merge closest clusters ad their MSTs priority ueue stores the edges outside clusters (or you could eve sort the edges) Key: weight lemet: edge t the ed of the algorithm Oe cluster ad oe MST 0 Goodrich ad Tamassia Miimum Spaig Trees

Kruskal s lgorithm 0 Goodrich ad Tamassia Miimum Spaig Trees

0 Goodrich ad Tamassia ampus Tour xample of Kruskal s lgorithm G 0 G 0 G 0 G 0 H H H H

0 Goodrich ad Tamassia ampus Tour xample (cotd.) five steps G 0 G 0 G 0 G 0 H H H H

ata Structure for Kruskal s lgorithm The algorithm maitais a forest of trees priority ueue extracts the edges by icreasig weight edge is accepted it if coects distict trees We eed a data structure that maitais a partitio, i.e., a collectio of disjoit sets, with operatios: makeset(u): create a set cosistig of u fid(u): retur the set storig u uio(, ): replace sets ad with their uio 0 Goodrich ad Tamassia Miimum Spaig Trees

List-based Partitio ach set is stored i a seuece ach elemet has a referece back to the set operatio fid(u) takes O() time, ad returs the set of which u is a member. i operatio uio(,), we move the elemets of the smaller set to the seuece of the larger set ad update their refereces the time for operatio uio(,) is mi(, ) Wheever a elemet is processed, it goes ito a set of size at least double, hece each elemet is processed at most log times 0 Goodrich ad Tamassia Miimum Spaig Trees

Partitio-ased Implemetatio Partitio-based versio of Kruskal s lgorithm luster merges as uios luster locatios as fids Ruig time O(( + m) log ) Priority Queue operatios: O(m log ) Uio-id operatios: O( log ) 0 Goodrich ad Tamassia Miimum Spaig Trees

lterative Implemetatio 0 Goodrich ad Tamassia Miimum Spaig Trees

aruvka s lgorithm Like Kruskal s lgorithm, aruvka s algorithm grows may clusters at oce ad maitais a forest T ach iteratio of the while loop halves the umber of coected compoets i forest T The ruig time is O(m log ) lgorithm aruvkamst(g) T V {just the vertices of G} while T has fewer tha - edges do for each coected compoet i T do Let edge e be the smallest-weight edge from to aother compoet i T if e is ot already i T the dd edge e to T retur T 0 Goodrich ad Tamassia Miimum Spaig Trees 0

0 Goodrich ad Tamassia xample of aruvka s lgorithm (aimated) Miimum Spaig Trees Slide by Matt Stallma icluded with permissio.