Minimum Spanning Tree Dr. Bernard Chen Ph.D. University of Central Arkansas Fall 2008.

Slides:



Advertisements
Similar presentations
Chapter 23 Minimum Spanning Tree
Advertisements

Comp 122, Spring 2004 Greedy Algorithms. greedy - 2 Lin / Devi Comp 122, Fall 2003 Overview  Like dynamic programming, used to solve optimization problems.
Minimum Spanning Tree CSE 331 Section 2 James Daly.
Data Structures, Spring 2004 © L. Joskowicz 1 Data Structures – LECTURE 13 Minumum spanning trees Motivation Properties of minimum spanning trees Kruskal’s.
Graph Algorithms: Minimum Spanning Tree We are given a weighted, undirected graph G = (V, E), with weight function w:
CSE 780 Algorithms Advanced Algorithms Minimum spanning tree Generic algorithm Kruskal’s algorithm Prim’s algorithm.
Minimum-Cost Spanning Tree weighted connected undirected graph spanning tree cost of spanning tree is sum of edge costs find spanning tree that has minimum.
Minimum Spanning Trees CIS 606 Spring Problem A town has a set of houses and a set of roads. A road connects 2 and only 2 houses. A road connecting.
CSE 326: Data Structures Spanning Trees Ben Lerner Summer 2007.
1 CSE 417: Algorithms and Computational Complexity Winter 2001 Lecture 11 Instructor: Paul Beame.
Design and Analysis of Algorithms Minimum Spanning trees
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.
Minimum Spanning Trees. Subgraph A graph G is a subgraph of graph H if –The vertices of G are a subset of the vertices of H, and –The edges of G are a.
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.
Minimum Spanning Trees What is a MST (Minimum Spanning Tree) and how to find it with Prim’s algorithm and Kruskal’s algorithm.
Minimum Spanning Tree in Graph - Week Problem: Laying Telephone Wire Central office.
1.1 Data Structure and Algorithm Lecture 13 Minimum Spanning Trees Topics Reference: Introduction to Algorithm by Cormen Chapter 13: Minimum Spanning Trees.
Graph Dr. Bernard Chen Ph.D. University of Central Arkansas.
0 Course Outline n Introduction and Algorithm Analysis (Ch. 2) n Hash Tables: dictionary data structure (Ch. 5) n Heaps: priority queue data structures.
Module 5 – Networks and Decision Mathematics Chapter 23 – Undirected Graphs.
Minimum spanning trees Aims: To know the terms: tree, spanning tree, minimum spanning tree. To understand that a minimum spanning tree connects a network.
1 Minimum Spanning Trees. Minimum- Spanning Trees 1. Concrete example: computer connection 2. Definition of a Minimum- Spanning Tree.
Minimum Spanning Trees Easy. Terms Node Node Edge Edge Cut Cut Cut respects a set of edges Cut respects a set of edges Light Edge Light Edge Minimum Spanning.
Spanning Trees CSIT 402 Data Structures II 1. 2 Two Algorithms Prim: (build tree incrementally) – Pick lower cost edge connected to known (incomplete)
Lecture 19 Greedy Algorithms Minimum Spanning Tree Problem.
1 Minimum Spanning Trees (some material adapted from slides by Peter Lee, Ananda Guna, Bettina Speckmann)
Lecture19: Graph III Bohyung Han CSE, POSTECH CSED233: Data Structures (2014F)
Minimum- Spanning Trees
1 22c:31 Algorithms Minimum-cost Spanning Tree (MST)
1 Week 3: Minimum Spanning Trees Definition of MST Generic MST algorithm Kruskal's algorithm Prim's algorithm.
WEEK 12 Graphs IV Minimum Spanning Tree Algorithms.
MST Lemma Let G = (V, E) be a connected, undirected graph with real-value weights on the edges. Let A be a viable subset of E (i.e. a subset of some MST),
Lecture 12 Algorithm Analysis Arne Kutzner Hanyang University / Seoul Korea.
Data Structures & Algorithms Graphs Richard Newman based on book by R. Sedgewick and slides by S. Sahni.
Lecture ? The Algorithms of Kruskal and Prim
Minimum Spanning Trees
Chapter 9 : Graphs Part II (Minimum Spanning Trees)
Introduction to Algorithms
Dr. Bernard Chen Ph.D. University of Central Arkansas Fall 2008
Minimum Spanning Tree Chapter 13.6.
Minimum Spanning Trees
Lecture 22 Minimum Spanning Tree
Minimum Spanning Trees
Minimum Spanning Trees
Lecture 12 Algorithm Analysis
Data Structures & Algorithms Graphs
Autumn 2016 Lecture 11 Minimum Spanning Trees (Part II)
Minimum-Cost Spanning Tree
Minimum Spanning Tree.
Minimum Spanning Trees
EMIS 8373: Integer Programming
Minimum Spanning Tree.
Minimum Spanning Tree.
Autumn 2015 Lecture 11 Minimum Spanning Trees (Part II)
CSE373: Data Structures & Algorithms Lecture 12: Minimum Spanning Trees Catie Baker Spring 2015.
CSE 373 Data Structures and Algorithms
Minimum-Cost Spanning Tree
Data Structures – LECTURE 13 Minumum spanning trees
Minimum-Cost Spanning Tree
Kruskal’s Minimum Spanning Tree Algorithm
Lecture 12 Algorithm Analysis
Minimum Spanning Trees
Minimum Spanning Tree.
CSE 373: Data Structures and Algorithms
Minimum spanning trees
Minimum Spanning Trees (MSTs)
Lecture 12 Algorithm Analysis
CSE 373: Data Structures and Algorithms
Lecture 14 Minimum Spanning Tree (cont’d)
Minimum-Cost Spanning Tree
Presentation transcript:

Minimum Spanning Tree Dr. Bernard Chen Ph.D. University of Central Arkansas Fall 2008

Minimum Spanning Tree

Example of MST

Problem: Laying Telephone Wire Central office

Wiring: Naïve Approach Central office Expensive!

Wiring: Better Approach Central office Minimize the total length of wire connecting the customers

Growing an MST: general idea GENERIC-MST(G,w) 1. A  {} 2. while A does not form a spanning tree 3. do find an edge (u,v) that is safe for A 4. A  A U {(u,v)} 5. return A

Tricky part How do you find a safe edge? This safe edge is part of the minimum spanning tree

Algorithms for MST Prim’s Grow a MST by adding a single edge at a time Kruskal’s Choose a smallest edge and add it to the forest If an edge is formed a cycle, it is rejected

Prim’s greedy algorithm Start from some (any) vertex. Build up spanning tree T, one vertex at a time. At each step, add to T the lowest-weight edge in G that does not create a cycle. Stop when all vertices in G are touched

Prim’s MST algorithm

Example A B D G C F I E H

Min Edge Pick a root A B D G C F I E H = in heap

Min Edge = 1 A B D G C F I E H

Min Edge = 2 A B D G C F I E H

A B D G C F I E H

Min Edge = 3 A B D G C F I E H

Min Edge = 4 A B D G C F I E H

Min Edge = 3 A B D G C F I E H

Min Edge = 4 A B D G C F I E H

Min Edge = 6 A B D G C F I E H

Example II

Kruskal’s Algorithm Choose the smallest edge and add it to a forest Keep connecting components until all vertices connected If an edge would form a cycle, it is rejected.

Example A B D G C F I E H

Min Edge = 1 A B D G C F I E H

Min Edge = 2 A B D G C F I E H

A B D G C F I E H

Min Edge = 3 A B D G C F I E H Now have 2 disjoint components: ABFG and CH

Min Edge = 3 A B D G C F I E H

Min Edge = 4 A B D G C F I E H Two components now merged into one.

Min Edge = 4 A B D G C F I E H

Min Edge = 5 A B D G C F I E H Rejected due to a cycle BFGB

Min Edge = 6 A B D G C F I E H