Minimum Spanning Trees: Correctness of Prim's Algorithm (Part I)
Minimum Spanning Trees: Correctness of Prim's Algorithm (Part I)
Spanning Trees
Correctness of Prim’s
Algorithms: Design
and Analysis, Part II Algorithm (Part I)
Cuts
Claim: Prim’s algorithm outputs a spanning tree.
A B
Edges that
cross (A, B)
Tim Roughgarden
Quiz on Cuts
Question: Roughly how many cuts does a graph with n vertices
have?
Tim Roughgarden
Empty Cut Lemma
Empty Cut Lemma: A graph is not connected ⇐⇒ ∃ cut (A, B)
with no crossing edges.
Proof: (⇐) Assume the RHS. Pick any u ∈ A and v ∈ B. Since no
edges cross (A, B) there is no u, v path in G . ⇒ G not connected.
A B
u v
u v
QED!
Tim Roughgarden
Two Easy Facts
Double-Crossing Lemma: Suppose the cycle C ⊆ E has an edge
crossing the cut (A, B): then so does some other edge of C .
A B
e
Tim Roughgarden
Proof of Part I
Claim: Prim’s algorithm outputs a spanning tree.
[Not claiming MST yet]
Proof: (1) Algorithm maintains invariant that T spans X
[straightforward induction - you check]
T lonely in this cut!
X V −X
e