EMIS 8374 Optimal Trees updated 25 April 2006. slide 1 Minimum Spanning Tree (MST) Input –A (simple) graph G = (V,E) –Edge cost c ij for each edge e 

Slides:



Advertisements
Similar presentations
Lecture 15. Graph Algorithms
Advertisements

Chapter 23 Minimum Spanning Tree
Comp 122, Spring 2004 Greedy Algorithms. greedy - 2 Lin / Devi Comp 122, Fall 2003 Overview  Like dynamic programming, used to solve optimization problems.
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.
1 Greedy 2 Jose Rolim University of Geneva. Algorithmique Greedy 2Jose Rolim2 Examples Greedy  Minimum Spanning Trees  Shortest Paths Dijkstra.
Chapter 23 Minimum Spanning Trees
Graph Algorithms: Minimum Spanning Tree We are given a weighted, undirected graph G = (V, E), with weight function w:
3 -1 Chapter 3 The Greedy Method 3 -2 The greedy method Suppose that a problem can be solved by a sequence of decisions. The greedy method has that each.
Tree tree = connected graph with no cycle tree = connected graph with |V|-1 edges tree = graph with |V|-1 edges and no cycles.
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.
Greedy Algorithms Reading Material: Chapter 8 (Except Section 8.5)
Lecture 12 Minimum Spanning Tree. Motivating Example: Point to Multipoint Communication Single source, Multiple Destinations Broadcast – All nodes in.
Greedy Algorithms Like dynamic programming algorithms, greedy algorithms are usually designed to solve optimization problems Unlike dynamic programming.
1 CSE 417: Algorithms and Computational Complexity Winter 2001 Lecture 11 Instructor: Paul Beame.
Tirgul 13 Today we’ll solve two questions from last year’s exams.
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 Dr. Bernard Chen Ph.D. University of Central Arkansas Fall 2008.
Theory of Computing Lecture 10 MAS 714 Hartmut Klauck.
© The McGraw-Hill Companies, Inc., Chapter 3 The Greedy Method.
Chapter 9 – Graphs A graph G=(V,E) – vertices and edges
MST Many of the slides are from Prof. Plaisted’s resources at University of North Carolina at Chapel Hill.
CS 3343: Analysis of Algorithms Lecture 21: Introduction to Graphs.
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.
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.
Lecture 19 Greedy Algorithms Minimum Spanning Tree Problem.
5.5.2 M inimum spanning trees  Definition 24: A minimum spanning tree in a connected weighted graph is a spanning tree that has the smallest possible.
Minimum Spanning Trees CS 146 Prof. Sin-Min Lee Regina Wang.
EMIS 8373: Integer Programming Combinatorial Relaxations and Duals Updated 8 February 2005.
Data Structures & Algorithms Graphs Richard Newman based on book by R. Sedgewick and slides by S. Sahni.
Spanning Tree Algorithms William T. Trotter and Mitchel T. Keller Math 3012 – Applied Combinatorics Spring 2009.
1 22c:31 Algorithms Minimum-cost Spanning Tree (MST)
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.
::Network Optimization:: Minimum Spanning Trees and Clustering Taufik Djatna, Dr.Eng. 1.
Midwestern State University Minimum Spanning Trees Definition of MST Generic MST algorithm Kruskal's algorithm Prim's algorithm 1.
November 22, Algorithms and Data Structures Lecture XII Simonas Šaltenis Nykredit Center for Database Research Aalborg University
Kruskal’s Algorithm for Computing MSTs Section 9.2.
Graph Search Applications, Minimum Spanning Tree
Lecture ? The Algorithms of Kruskal and Prim
Introduction to Algorithms
Minimum Spanning Trees
Lecture 22 Minimum Spanning Tree
Lecture 12 Algorithm Analysis
Greedy Algorithms / Minimum Spanning Tree Yin Tat Lee
Topological Sort (topological order)
Minimum-Cost Spanning Tree
Minimum Spanning Tree.
EMIS 8373: Integer Programming
Minimum Spanning Tree.
Minimum-Cost Spanning Tree
Chapter 23 Minimum Spanning Tree
Minimum-Cost Spanning Tree
Lecture 12 Algorithm Analysis
Minimum Spanning Tree Algorithms
Minimum Spanning Trees
Minimum Spanning Tree.
Minimum Spanning Trees
Lecture 14 Shortest Path (cont’d) Minimum Spanning Tree
Minimum Spanning Trees (MSTs)
The Greedy Approach Young CS 530 Adv. Algo. Greedy.
Lecture 12 Algorithm Analysis
Lecture 13 Shortest Path (cont’d) Minimum Spanning Tree
Minimum-Cost Spanning Tree
Minimum Spanning Trees
Presentation transcript:

EMIS 8374 Optimal Trees updated 25 April 2006

slide 1 Minimum Spanning Tree (MST) Input –A (simple) graph G = (V,E) –Edge cost c ij for each edge e  E Optimization Problem –Find a minimum-cost spanning tree Spanning tree: a set of |V|-1 edges T such that each vertex is incident to at least one edge in T, and T contains no cycles.

slide 2 MST Example: Input

slide 3 MST Example: Some Feasible Spanning Trees cost = 14 cost = 16 cost = 17

slide 4 MST Example: Optimal Solution cost = 12

slide 5 MST Optimality Conditions: Path Optimality c 25 > c 12 c 25 > c 15 c 24 > c 12 c 24 > c 15 c 24 > c 45 c 34 > c 23 c 34 > c 12 c 34 > c 15 c 34 > c 45

slide 6 Path Optimality Condition A spanning tree T is a minimum spanning tree if and only for every out-of-tree edge (i,j), c ij  c uv for every in-tree edge (u,v) on the path from i to j in T. This is clearly a necessary condition for a MST. If an out-of-tree edge (i, j) has a lower cost than any in-tree edge (u,v) on the path from i to j in T, then we can improve T by replacing edge (u,v) with edge (i, j).

slide 7 Path Optimality: Necessity Replacing in-tree edge (2,4) with out-of-tree edge (4,5) would decrease the cost of this tree. Therefore, it cannot be optimal.

slide 8 MST Optimality Conditions: Cut Optimality Removing an in-tree edge (u,v) creates a cut in the tree. For any out-of-tree edge (i,j) crossing the cut c ij  c uv c 25 >c 12 c 24 > c 12 c 45 > c 12

slide 9 Cut Optimality Given a spanning tree T, let C[u,v] be the set of edges in the cut formed by removing in-tree edge (u, v) from T. A spanning tree T is a MST if and only if every in-tree edge is a minimum cost edge in C[u,v].

slide 10 Cut Optimality: Necessity The in-tree edge (2, 4) is not a minimum cost edge in the cut formed by removing it from T If we remove in-tree edge (2, 4), we can restore connectivity by adding out-of-tree edge (4, 5).

slide 11 Cut Optimality: Necessity If we remove in-tree edge (2, 4), we can restore connectivity by adding out-of-tree edge (4, 5). Since the resulting tree has a lower total cost, the first tree could not have been optimal.

slide 12 Sufficiency of Cut and Path Optimality It is easy to see that any MST must satisfy the cut and path optimality conditions. If a tree T happens to satisfy these conditions, does that imply that T is a MST?

slide Sufficiency of Cut Optimality 3 G T*T* TCTC Let T * be a MST of G. Suppose that T C satisfies the cut optimality condition. Show that T C is also a MST.

slide Sufficiency of Cut Optimality 3 T*T* TCTC Since T * is a MST, it must satisfy the path optimality condition. So, c 25  c 24 (and c 25  c 45 ). Since T C satisfies the cut optimality condition, c 25  c 24 (and c 25  c 35 ). This implies c 25 = c 24. Replacing (2,4) with (2,5) in T * creates a new MST, T **.

slide Sufficiency of Cut Optimality 3 T ** TCTC Since T ** is a MST, it must satisfy the path optimality condition. So, c 23  c 35 (and c 23  c 25 ). Since T C satisfies the cut optimality condition, c 23  c 35 (and c 25  c 13 ). This implies c 23 = c 35. Replacing (3,5) with (2,3) in T ** creates a new MST, T ***.

slide Sufficiency of Cut Optimality 3 T *** TCTC Since T C is identical to T ***, it is optimal. This argument can be formalized to apply to the general case and show that any tree that satisfies the cut optimality condition must be optimal. Thus, cut optimality is a sufficient condition for a tree to be a MST.

slide 17 Kruskal’s Algorithm (Path Optimality) F := E T := {} Repeat Until |T| = |V| - 1 Begin Select (i,j)  F such that c ij = min(c uv : (u,v)  F) F := F \ {(i,j)} If T  {(i,j)} does not contain a cycle then T := T  {(i,j)} End Can be implemented in O(|E|+|V| log |V}) time plus the time for sorting the edges.

slide 18 Kruskal’s Algorithm: Example

slide 19 Testing for Cycles Let G T be the subgraph of G induced by the set of edges in T. As edges are added to T, the algorithm creates a forest (i.e., a collection of trees). Each tree in the forest forms a connected component of G T. By keeping track of which component each node is in, we can quickly, and easily determine whether or not adding a new edge to T will create a cycle.

slide 20 Testing for Cycles Initialize component[i] = 0 for all i  V. When edge (i,j) is inspected, there are 5 cases to 1.component[i] = component[j] = 0 Add (i,j) to T; (i,j) becomes a new component of G T. 2.component[i] = 0, component[j] > 0. Add (i,j) to T; vertex i will go into the same component as j. 3.component[i] > 0, component[j] = 0. Add (i,j) to T; vertex j will go into the same component as i. 4.component[i] > 0, component[j] > 0, component[i]  component[j] Add (i,j) to T; merge components. 5.component[i] = component[j] > 0 Adding (i,j) would create a cycle.

slide 21 Kruskal’s Algorithm: Example

slide 22 Kruskal’s Algorithm: Example (2, 3) creates a cycle because vertices 2 and 3 are in the same connected component.

slide 23 Kruskal’s Algorithm: Example (2, 4) does not create a cycle because vertices 2 and 4 are in different connected components.

slide 24 Kruskal’s Algorithm: Example Merge components 1 and 2.

slide 25 Prim’s Algorithm (Cut Optimality) Choose any node v in V. S 1 := {v} T := {} k := 1 Repeat Until |T| = |V| - 1 Begin Select a minimum cost edge (i,j) in the cut [S k,V\{S k }] T := T  {(i,j)} If i  S k then S k+1 := S k  {j} Else If j  S k then S k+1 := S k  {i} k := k+1 End Can be implemented in O(|E|+|V| log |V}) time.

slide 26 Prim’s Algorithm S 1 = {3} S 2 = {1,3}

slide 27 Prim’s Algorithm S 3 = {1, 2, 3} S 2 = {1,3}

slide 28 Prim’s Algorithm S 3 = {1, 2, 3} S 4 = {1, 2, 3, 4}

slide 29 Prim’s Algorithm S 4 = {1, 2, 3, 4} S 5 = {1, 2, 3, 4, 5}

slide 30 Directed Spanning Tree (DST) Input –A network (directed graph) G = (N,A) –Arc cost c ij for each edge arc (i,j)  A –A designated root node s  N Optimization Problem –Find a minimum-cost directed-out tree T = (N, A * ) rooted at node s. Directed-Out Tree: T = (N, A * ) contains a unique, directed path from s to every other node in N (every other node in the tree has in-degree = 1).

slide 31 Is DST a (Pure) Network Flow Problem? Suggestion: –Let b(s) = |N| - 1 –Let b(i) = -1 for i in N\{s} –Let ij = 0 –Let u ij = |N| –Each node gets 1 unit of flow –Total cost of flow is minimized –Arcs carrying flow form a directed spanning tree

slide 32 DST Example s