Spanning Tree Algorithms William T. Trotter and Mitchel T. Keller Math 3012 – Applied Combinatorics Spring 2009.

Slides:



Advertisements
Similar presentations
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.
Advertisements

3.3 Spanning Trees Tucker, Applied Combinatorics, Section 3.3, by Patti Bodkin and Tamsen Hunter.
Chapter 23 Minimum Spanning Trees
1 Spanning Trees Lecture 20 CS2110 – Spring
Discussion #36 Spanning Trees
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:
1 7-MST Minimal Spanning Trees Fonts: MTExtra:  (comment) Symbol:  Wingdings: Fonts: MTExtra:  (comment) Symbol:  Wingdings:
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.
Lecture 12 Minimum Spanning Tree. Motivating Example: Point to Multipoint Communication Single source, Multiple Destinations Broadcast – All nodes in.
3/29/05Tucker, Sec Applied Combinatorics, 4th Ed. Alan Tucker Section 4.2 Minimal Spanning Trees Prepared by Amanda Dargie and Michele Fretta.
Two Discrete Optimization Problems Problem #2: The Minimum Cost Spanning Tree Problem.
Design and Analysis of Algorithms Minimum Spanning trees
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.
TECH Computer Science Graph Optimization Problems and Greedy Algorithms Greedy Algorithms  // Make the best choice now! Optimization Problems  Minimizing.
Minimum Spanning Trees What is a MST (Minimum Spanning Tree) and how to find it with Prim’s algorithm and Kruskal’s algorithm.
Minimal Spanning Trees What is a minimal spanning tree (MST) and how to find one.
Copyright © Cengage Learning. All rights reserved.
MST Many of the slides are from Prof. Plaisted’s resources at University of North Carolina at Chapel Hill.
2IL05 Data Structures Fall 2007 Lecture 13: Minimum Spanning Trees.
Spring 2015 Lecture 11: Minimum Spanning Trees
UNC Chapel Hill Lin/Foskey/Manocha Minimum Spanning Trees Problem: Connect a set of nodes by a network of minimal total length Some applications: –Communication.
Minimum Spanning Trees and Kruskal’s Algorithm CLRS 23.
Dijkstra’s Algorithm. Announcements Assignment #2 Due Tonight Exams Graded Assignment #3 Posted.
An Illustration of Kruskal’s Algorithm Prepared Spring 2006 by Sean Szumlanski Computer Science II, University of Central Florida.
EMIS 8374 Optimal Trees updated 25 April slide 1 Minimum Spanning Tree (MST) Input –A (simple) graph G = (V,E) –Edge cost c ij for each edge e 
Prim's Algorithm This algorithm starts with one node. It then, one by one, adds a node that is unconnected to the new graph to the new graph, each time.
Lecture 19 Greedy Algorithms Minimum Spanning Tree Problem.
Introduction to Graph Theory
Minimum Spanning Trees CS 146 Prof. Sin-Min Lee Regina Wang.
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.
Prims Algorithm for finding a minimum spanning tree
Lecture 12 Algorithm Analysis Arne Kutzner Hanyang University / Seoul Korea.
Minimum Spanning Trees
Minimum Spanning Tree Chapter 13.6.
Minimum Spanning Trees
Spanning Trees.
Lecture 22 Minimum Spanning Tree
Euler Circuits William T. Trotter and Mitchel T. Keller
COMP 6/4030 ALGORITHMS Prim’s Theorem 10/26/2000.
Lecture 12 Algorithm Analysis
Greedy Algorithms / Minimum Spanning Tree Yin Tat Lee
Short paths and spanning trees
Data Structures & Algorithms Graphs
Graph Algorithm.
Minimum-Cost Spanning Tree
Minimum Spanning Tree.
Minimum Spanning Trees
Connected Components Minimum Spanning Tree
Minimum Spanning Tree.
Spanning Trees.
Minimum-Cost Spanning Tree
4-4 Graph Theory Trees.
Data Structures – LECTURE 13 Minumum spanning trees
Kruskal’s Algorithm for finding a minimum spanning tree
Chapter 23 Minimum Spanning Tree
Minimum-Cost Spanning Tree
CS 583 Analysis of Algorithms
Lecture 12 Algorithm Analysis
Minimum Spanning Tree Algorithms
Minimum Spanning Trees
Minimum Spanning Tree.
Minimum Spanning Trees
Minimum Spanning Trees (MSTs)
Lecture 12 Algorithm Analysis
Lecture 14 Minimum Spanning Tree (cont’d)
Minimum-Cost Spanning Tree
Minimum Spanning Trees
Presentation transcript:

Spanning Tree Algorithms William T. Trotter and Mitchel T. Keller Math 3012 – Applied Combinatorics Spring 2009

A Networking Problem Problem: The vertices represent 8 regional data centers which need to be connected with high-speed data lines. Feasibility studies show that the links illustrated above are possible, and the cost in millions of dollars is shown next to the link. Which links should be constructed to enable full communication (with relays allowed) and keep the total cost minimal.

Links Will Form a Spanning Tree Cost (T) = = 427

Minimum Weight Spanning Trees Problem: Given a connected graph with non-negative weights on the edges, find a spanning tree T for which the sum of the weights on the edges in T is as small as possible.

Why Not Try All Possibilities?  Suppose the graph has n vertices. Then the number of possible spanning trees can be as large as n n-2.  When n = 75, this means that the number of spanning trees can be as large as \ \

Kruskal’s Algorithm (Avoid Cycles)  Sort the edges by weight  Build a spanning forest (that eventually becomes a tree) by adding the edge of minimum weight which when added to those already chosen does not form a cycle.

Kruskal – Step 1

Kruskal – Step 2

Kruskal – Step 3

Kruskal – Step 4

Kruskal – Step 5

Kruskal – Step 6

Why Avoiding Cycles Matters Up to this point, we have simply taken the edges in order of their weight. But now we will have to reject an edge since it forms a cycle when added to those already chosen.

Forms a Cycle So we cannot take the blue edge having weight 55.

Kruskal – Step 7 DONE!! Weight (T) = = 282

Prim’s Algorithm (Build Tree)  Build a tree one vertex at a time.  Start with a trivial one point tree T.  Then add the edge of minimum weight among those with one endpoint in T and the other not in T.

Prim – Step 1

Prim – Step 2

Prim – Step 3

Prim – Step 4

Prim – Step 5

Prim – Step 6

Prim – Step 7 Done!! Weight (T) = = 282

The Exchange Principle (1)

The Exchange Principle (2) Consider any edge e not in the tree T. Then there is a unique path P in T from one endpoint of e to the other.

The Exchange Principle (3) Consider any edge f from T which belongs to the path P.

The Exchange Principle (4) Then T’ = T – f + e is again a tree.

Constrained Spanning Trees Some choices made by management. May or may not be good ones??!!

Constrained Spanning Trees Starting with this “handicap”, do the best you can from this point on.

Fundamental Lemma Lemma. Let G be a graph with non-negative weights on the edges, let F be a spanning forest of G and let C be a component of F. Also, among all edges with one endpoint in C and the other not in C, let edge e be one of minimum weight. Then among all the spanning trees of G that contain F, there is one of minimum weight that contains the edge e.

Applying the Exchange Principle Let T be a tree containing F with w(T) minimum and suppose that T does not contain the edge e = xy. On the path P in T from x to y, chose an edge f with one endpoint in C and the other not in C. Then w(e) ≤ w(f). It follows that T’ = T – f + e is a tree containing e with w(T’) ≤ w(T).

Data Structure and Computational Issues  Implementing Kruskal’s Algorithm seems to require sorting the edges by weight as a preliminary step. Are there alternatives?  Implementing Prim’s algorithm seems to require keeping track of the edge of minimum weight with one endpoint in a component, but the components are changing. How does one do this?