08 - Kruskal's MST Algorithm

# 08 - Kruskal's MST Algorithm - Part II: Graph Algorithms...

This preview shows pages 1–8. Sign up to view the full content.

Part II: Graph Algorithms Lecture 8: Kruskal’s MST Algorithm Lecture 8: Kruskal’s MST Algorithm Part II: Graph Algorithms

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Objective and Outline Objective : Discuss another algorithm for the MST problem, i.e. Kruskal’s algorithm. Reference Kruskal’s MST algorithm The idea The algorithm Correctness The Disjoint Set Union-Find data structure. The basic implementation An improvement Lecture 8: Kruskal’s MST Algorithm Part II: Graph Algorithms
Recalling the Generic Algorithm start with an empty graph try to add edges one at a time, always making sure that what is built remains acyclic. if we are sure every time the resulting graph is always a subset of some minimum spanning tree, we are done. Lemma G = ( V , E ) be a connected, undirected graph with a real-valued weight function w deﬁned on E A be a subset of E that is included in some minimum spanning tree for G. Let ( S , V - S ) be any cut of G that respects A ( u , v ) be a light edge crossing the cut ( S , V - S ) Then, edge ( u , v ) is safe for A. Lecture 8: Kruskal’s MST Algorithm Part II: Graph Algorithms

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Idea of Kruskal’s Algorithm The Kruskal’s Algorithm is based directly on the generic algorithm. Unlike Prim’s algorithm, which grows one tree, Kruskal’s algorithm grows a collection of trees (a forest ). Initially, trees of the forest are the vertices (no edges). In each step add the cheapest edge that does not create a cycle . Continue until the forest ‘merge to’ a single tree. Lecture 8: Kruskal’s MST Algorithm Part II: Graph Algorithms
Example Lecture 8: Kruskal’s MST Algorithm Part II: Graph Algorithms

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Outline Kruskal’s MST algorithm The idea The algorithm Correctness The Disjoint Set Union-Find data structure. The basic implementation An improvement Lecture 8: Kruskal’s MST Algorithm Part II: Graph Algorithms
1 Set A = and F = E , the set of all edges. 2 Choose an edge e in F of minimum weight, and check whether adding e to A creates a cycle . If “yes”, remove e from F . If “no”, move e from F to A . 3 If F = , stop and output the minimal spanning tree ( V , A ). Otherwise go to Step 2. Remark : Will see later, after each step, ( V , A ) is a subgraph of a MST. Questions How does algorithm choose edge e F with minimum weight? How does algorithm check whether adding e to A creates a cycle? Lecture 8: Kruskal’s MST Algorithm

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

## This note was uploaded on 10/18/2009 for the course COMP 271 taught by Professor Arya during the Spring '07 term at HKUST.

### Page1 / 27

08 - Kruskal's MST Algorithm - Part II: Graph Algorithms...

This preview shows document pages 1 - 8. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online