Upcoming SlideShare
Loading in...5
×

# chapter23.ppt

1,321
-1

Published on

0 Comments
0 Likes
Statistics
Notes
• Full Name
Comment goes here.

Are you sure you want to Yes No
Your message goes here
• Be the first to comment

• Be the first to like this

No Downloads
Views
Total Views
1,321
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
37
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

### chapter23.ppt

1. 1. Introduction to Algorithms Second Edition by Cormen, Leiserson, Rivest & Stein Chapter 23
2. 2. Minimum Spanning Tree We then wish to find an acyclic subset T є E that connects all of the vertices and whose total weight is minimized.
3. 3. Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
4. 4. Minimum Spanning Tree Assume that we have a connected, undirected graph G = ( V, E ) with a weight function w : E -> R , and we wish to find a minimum spanning tree for G . At each step, we determine an edge ( u, v ) that can be added to A without violating this invariant, in the sense that A U {( u, v )} is also a subset of a minimum spanning tree.
5. 5. Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
6. 6. Minimum Spanning Tree A cut ( S, V - S ) of an undirected graph G = ( V , E ) is a partition of V . We say that an edge ( u , v ) ε E crosses the cut ( S , V - S ) if one of its endpoints is in S and the other is in V - S .
7. 7. Minimum Spanning Tree We say that a cut respects a set A of edges if no edge in A crosses the cut. An edge is a light edge crossing a cut if its weight is the minimum of any edge crossing the cut.
8. 8. Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
9. 9. Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
10. 10. Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
11. 11. Minimum Spanning Tree It finds a safe edge to add to the growing forest by finding, of all the edges that connect any two trees in the forest, an edge ( u , v ) of least weight.
12. 12. Kruskal’s Algorithm It uses a disjoint-set data structure to maintain several disjoint sets of elements. Each set contains the vertices in a tree of the current forest. The operation FIND-SET( u ) returns a representative element from the set that contains u . Thus, we can determine whether two vertices u and v belong to the same tree by testing whether FIND-SET( u ) equals FIND-SET( v ). The combining of trees is accomplished by the UNION procedure.
13. 13. Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
14. 14. Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
15. 15. Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
16. 16. Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
1. #### A particular slide catching your eye?

Clipping is a handy way to collect important slides you want to go back to later.