spanning tree algorithms william t. trotter and mitchel t. keller math 3012 – applied...
DESCRIPTION
Links Will Form a Spanning Tree Cost (T) = = 427TRANSCRIPT
![Page 1: Spanning Tree Algorithms William T. Trotter and Mitchel T. Keller Math 3012 – Applied Combinatorics Spring 2009](https://reader036.vdocuments.site/reader036/viewer/2022062306/5a4d1ae87f8b9ab059979da6/html5/thumbnails/1.jpg)
Spanning Tree Algorithms
William T. Trotter and Mitchel T. KellerMath 3012 – Applied Combinatorics
Spring 2009
![Page 2: Spanning Tree Algorithms William T. Trotter and Mitchel T. Keller Math 3012 – Applied Combinatorics Spring 2009](https://reader036.vdocuments.site/reader036/viewer/2022062306/5a4d1ae87f8b9ab059979da6/html5/thumbnails/2.jpg)
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.
![Page 3: Spanning Tree Algorithms William T. Trotter and Mitchel T. Keller Math 3012 – Applied Combinatorics Spring 2009](https://reader036.vdocuments.site/reader036/viewer/2022062306/5a4d1ae87f8b9ab059979da6/html5/thumbnails/3.jpg)
Links Will Form a Spanning Tree
Cost (T) = 47 + 23 + 75 + 74 + 55 + 74 + 79 = 427
![Page 4: Spanning Tree Algorithms William T. Trotter and Mitchel T. Keller Math 3012 – Applied Combinatorics Spring 2009](https://reader036.vdocuments.site/reader036/viewer/2022062306/5a4d1ae87f8b9ab059979da6/html5/thumbnails/4.jpg)
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.
![Page 5: Spanning Tree Algorithms William T. Trotter and Mitchel T. Keller Math 3012 – Applied Combinatorics Spring 2009](https://reader036.vdocuments.site/reader036/viewer/2022062306/5a4d1ae87f8b9ab059979da6/html5/thumbnails/5.jpg)
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
7576562804644601479086318651590413464814067\83308840339247043281018024279971356804708193\5219466686248779296875
![Page 6: Spanning Tree Algorithms William T. Trotter and Mitchel T. Keller Math 3012 – Applied Combinatorics Spring 2009](https://reader036.vdocuments.site/reader036/viewer/2022062306/5a4d1ae87f8b9ab059979da6/html5/thumbnails/6.jpg)
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.
![Page 7: Spanning Tree Algorithms William T. Trotter and Mitchel T. Keller Math 3012 – Applied Combinatorics Spring 2009](https://reader036.vdocuments.site/reader036/viewer/2022062306/5a4d1ae87f8b9ab059979da6/html5/thumbnails/7.jpg)
Kruskal – Step 1
![Page 8: Spanning Tree Algorithms William T. Trotter and Mitchel T. Keller Math 3012 – Applied Combinatorics Spring 2009](https://reader036.vdocuments.site/reader036/viewer/2022062306/5a4d1ae87f8b9ab059979da6/html5/thumbnails/8.jpg)
Kruskal – Step 2
![Page 9: Spanning Tree Algorithms William T. Trotter and Mitchel T. Keller Math 3012 – Applied Combinatorics Spring 2009](https://reader036.vdocuments.site/reader036/viewer/2022062306/5a4d1ae87f8b9ab059979da6/html5/thumbnails/9.jpg)
Kruskal – Step 3
![Page 10: Spanning Tree Algorithms William T. Trotter and Mitchel T. Keller Math 3012 – Applied Combinatorics Spring 2009](https://reader036.vdocuments.site/reader036/viewer/2022062306/5a4d1ae87f8b9ab059979da6/html5/thumbnails/10.jpg)
Kruskal – Step 4
![Page 11: Spanning Tree Algorithms William T. Trotter and Mitchel T. Keller Math 3012 – Applied Combinatorics Spring 2009](https://reader036.vdocuments.site/reader036/viewer/2022062306/5a4d1ae87f8b9ab059979da6/html5/thumbnails/11.jpg)
Kruskal – Step 5
![Page 12: Spanning Tree Algorithms William T. Trotter and Mitchel T. Keller Math 3012 – Applied Combinatorics Spring 2009](https://reader036.vdocuments.site/reader036/viewer/2022062306/5a4d1ae87f8b9ab059979da6/html5/thumbnails/12.jpg)
Kruskal – Step 6
![Page 13: Spanning Tree Algorithms William T. Trotter and Mitchel T. Keller Math 3012 – Applied Combinatorics Spring 2009](https://reader036.vdocuments.site/reader036/viewer/2022062306/5a4d1ae87f8b9ab059979da6/html5/thumbnails/13.jpg)
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.
![Page 14: Spanning Tree Algorithms William T. Trotter and Mitchel T. Keller Math 3012 – Applied Combinatorics Spring 2009](https://reader036.vdocuments.site/reader036/viewer/2022062306/5a4d1ae87f8b9ab059979da6/html5/thumbnails/14.jpg)
Forms a Cycle
So we cannot take the blue edge having weight 55.
![Page 15: Spanning Tree Algorithms William T. Trotter and Mitchel T. Keller Math 3012 – Applied Combinatorics Spring 2009](https://reader036.vdocuments.site/reader036/viewer/2022062306/5a4d1ae87f8b9ab059979da6/html5/thumbnails/15.jpg)
Kruskal – Step 7 DONE!!
Weight (T) = 23 + 29 + 31 + 32 + 47 + 54 + 66 = 282
![Page 16: Spanning Tree Algorithms William T. Trotter and Mitchel T. Keller Math 3012 – Applied Combinatorics Spring 2009](https://reader036.vdocuments.site/reader036/viewer/2022062306/5a4d1ae87f8b9ab059979da6/html5/thumbnails/16.jpg)
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.
![Page 17: Spanning Tree Algorithms William T. Trotter and Mitchel T. Keller Math 3012 – Applied Combinatorics Spring 2009](https://reader036.vdocuments.site/reader036/viewer/2022062306/5a4d1ae87f8b9ab059979da6/html5/thumbnails/17.jpg)
Prim – Step 1
![Page 18: Spanning Tree Algorithms William T. Trotter and Mitchel T. Keller Math 3012 – Applied Combinatorics Spring 2009](https://reader036.vdocuments.site/reader036/viewer/2022062306/5a4d1ae87f8b9ab059979da6/html5/thumbnails/18.jpg)
Prim – Step 2
![Page 19: Spanning Tree Algorithms William T. Trotter and Mitchel T. Keller Math 3012 – Applied Combinatorics Spring 2009](https://reader036.vdocuments.site/reader036/viewer/2022062306/5a4d1ae87f8b9ab059979da6/html5/thumbnails/19.jpg)
Prim – Step 3
![Page 20: Spanning Tree Algorithms William T. Trotter and Mitchel T. Keller Math 3012 – Applied Combinatorics Spring 2009](https://reader036.vdocuments.site/reader036/viewer/2022062306/5a4d1ae87f8b9ab059979da6/html5/thumbnails/20.jpg)
Prim – Step 4
![Page 21: Spanning Tree Algorithms William T. Trotter and Mitchel T. Keller Math 3012 – Applied Combinatorics Spring 2009](https://reader036.vdocuments.site/reader036/viewer/2022062306/5a4d1ae87f8b9ab059979da6/html5/thumbnails/21.jpg)
Prim – Step 5
![Page 22: Spanning Tree Algorithms William T. Trotter and Mitchel T. Keller Math 3012 – Applied Combinatorics Spring 2009](https://reader036.vdocuments.site/reader036/viewer/2022062306/5a4d1ae87f8b9ab059979da6/html5/thumbnails/22.jpg)
Prim – Step 6
![Page 23: Spanning Tree Algorithms William T. Trotter and Mitchel T. Keller Math 3012 – Applied Combinatorics Spring 2009](https://reader036.vdocuments.site/reader036/viewer/2022062306/5a4d1ae87f8b9ab059979da6/html5/thumbnails/23.jpg)
Prim – Step 7 Done!!
Weight (T) = 23 + 29 + 31 + 32 + 47 + 54 + 66 = 282
![Page 24: Spanning Tree Algorithms William T. Trotter and Mitchel T. Keller Math 3012 – Applied Combinatorics Spring 2009](https://reader036.vdocuments.site/reader036/viewer/2022062306/5a4d1ae87f8b9ab059979da6/html5/thumbnails/24.jpg)
The Exchange Principle (1)
![Page 25: Spanning Tree Algorithms William T. Trotter and Mitchel T. Keller Math 3012 – Applied Combinatorics Spring 2009](https://reader036.vdocuments.site/reader036/viewer/2022062306/5a4d1ae87f8b9ab059979da6/html5/thumbnails/25.jpg)
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.
![Page 26: Spanning Tree Algorithms William T. Trotter and Mitchel T. Keller Math 3012 – Applied Combinatorics Spring 2009](https://reader036.vdocuments.site/reader036/viewer/2022062306/5a4d1ae87f8b9ab059979da6/html5/thumbnails/26.jpg)
The Exchange Principle (3)
Consider any edge f from T which belongs to the path P.
![Page 27: Spanning Tree Algorithms William T. Trotter and Mitchel T. Keller Math 3012 – Applied Combinatorics Spring 2009](https://reader036.vdocuments.site/reader036/viewer/2022062306/5a4d1ae87f8b9ab059979da6/html5/thumbnails/27.jpg)
The Exchange Principle (4)
Then T’ = T – f + e is again a tree.
![Page 28: Spanning Tree Algorithms William T. Trotter and Mitchel T. Keller Math 3012 – Applied Combinatorics Spring 2009](https://reader036.vdocuments.site/reader036/viewer/2022062306/5a4d1ae87f8b9ab059979da6/html5/thumbnails/28.jpg)
Constrained Spanning Trees
Some choices made by management. May or may not be good ones??!!
![Page 29: Spanning Tree Algorithms William T. Trotter and Mitchel T. Keller Math 3012 – Applied Combinatorics Spring 2009](https://reader036.vdocuments.site/reader036/viewer/2022062306/5a4d1ae87f8b9ab059979da6/html5/thumbnails/29.jpg)
Constrained Spanning Trees
Starting with this “handicap”, do the best you can from this point on.
![Page 30: Spanning Tree Algorithms William T. Trotter and Mitchel T. Keller Math 3012 – Applied Combinatorics Spring 2009](https://reader036.vdocuments.site/reader036/viewer/2022062306/5a4d1ae87f8b9ab059979da6/html5/thumbnails/30.jpg)
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.
![Page 31: Spanning Tree Algorithms William T. Trotter and Mitchel T. Keller Math 3012 – Applied Combinatorics Spring 2009](https://reader036.vdocuments.site/reader036/viewer/2022062306/5a4d1ae87f8b9ab059979da6/html5/thumbnails/31.jpg)
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).
![Page 32: Spanning Tree Algorithms William T. Trotter and Mitchel T. Keller Math 3012 – Applied Combinatorics Spring 2009](https://reader036.vdocuments.site/reader036/viewer/2022062306/5a4d1ae87f8b9ab059979da6/html5/thumbnails/32.jpg)
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?