08 - Minimum spanning tree; Kruskal’s algorithm

08 - Minimum spanning tree; Kruskal’s...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
1/30/08 - Minimum spanning tree; Krus. .. Lecture: Minimum spanning tree; Kruskal's algorithm. Reading: Chapter 4.5 cs482-01-30-08-Audio.mp4 Minimum spanning tree Given G = (V,E) undirected, connected Costs c e > 0 for every e E. Goal: output connected subgraph H=(V,F) of minimum cost Lemma: If H = (V,F) is a min-cost connected subgraph of G, then H is a tree. Proof: If H contains a cycle, remove one edge to reduce cost Proposed algorithms: (1) KRUSKAL’s algorithm Sort edges by increasing cost. Add an edge to the tree if it connects two nodes that weren’t already connected. 7-1 7
Background image of page 1

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

View Full DocumentRight Arrow Icon
There is a second interpretation to (1) which does the wrong thing in this instance. (2) PRIM’s algorithm Initiate W = {r}. //(w,f) is connected. While W V Find cheapest edge joining W to V - W let e = (u,v) be this edge, u W, v W W <- W U {V} F <- F U {e} endwhile Correctness of Kruskal and Prim: Assume for now: all costs are distinct. Lemma: If V is partitioned into nonempty A,B. then every MST contains the cheapest edge from A to B.
Background image of page 2
Background image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Proof. Let A,B be such a partition. Let e be the cheapest edge from A to B. Let T be any tree that avoids e. Then T U {e} must contain a cycle. The most expensive edge on this cycle is e e (The cycle crosses from A to B at least twice.) c e &amp;gt; c e . 7-2 Therefore T - {e} U {e} is a cheaper spanning tree. Correctness of K&amp;amp;P Approach: Prove the algorithm outputs a subgraph which is (i) connected (ii) contained in the MST. PRIM's (1) (W,F) is always connected. (2) At termination W = V. -&amp;gt; (i) (3) Whenever we add e, it is the cheapest edge from W to V W. -&amp;gt; (ii) KRUSKAL (1) If (A,B) is any partition of V, we pick at least one A-B edge. (the first one encountered in the loop). -&amp;gt; (i) (2) When alg. Picks edge e = (u,v) Let A = {vertices reachable from u at that stage B = all other vertices. e is the cheapest A-B edge. (If e were cheaper, we would have already looked at it and picked it.) -&amp;gt; (ii) v 7-3...
View Full Document

This note was uploaded on 10/02/2008 for the course CS 482 taught by Professor Kleinberg during the Spring '08 term at Cornell University (Engineering School).

Page1 / 3

08 - Minimum spanning tree; Kruskal&amp;acirc;€™s...

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

View Full Document Right Arrow Icon
Ask a homework question - tutors are online