Minimum Spanning Trees: Kruskal, Prim & Cut Properties
“Cut Property, Cycle Property, Kruskal with DSU, Prim with priority queues, and uniqueness theorems.”
1.Spanning Tree Axioms & Fundamental Cut/Cycle Theorems
§ 3.1.For a connected, undirected weighted graph G = (V, E, w):
A Spanning Tree is an acyclic subgraph connecting all |V| vertices, having exactly |V| - 1 edges. An MST minimizes w(T) = sum_{e in T} w(e).
Theorem 1 (The Cut Property):
Let (S, V setminus S) be any cut of G. If edge e = (u, v) is the strictly minimum-weight edge crossing the cut (u in S, v in V setminus S), then e belongs to every MST of G.
Proof: Suppose an MST T does not contain e. Adding e to T creates a cycle C. This cycle must cross the cut at least once more via another edge e'. Since w(e) < w(e'), replacing e' with e creates a new spanning tree T' = T cup {e} setminus {e'} with w(T') < w(T), contradicting the optimality of T.
Theorem 2 (The Cycle Property):
Let C be any cycle in G. If edge e is the strictly heaviest edge on C, then e cannot belong to any MST of G.
2.Kruskal vs Prim: Algorithmic Mechanics & Complexities
§ 3.2.Kruskal's Algorithm (Edge-Centric):
1. Sort all edges in non-decreasing order of weight.
2. Maintain a Disjoint Set Union (DSU) of vertices.
3. For each edge (u, v): if Find(u) != Find(v), union the sets and add (u, v) to the MST.
Union-by-rank with path compression achieves O(alpha(V)) amortized time per operation. Total time: O(E log E) = O(E log V).
Prim's Algorithm (Vertex-Centric):
1. Start with an arbitrary root vertex s. Set key[s] = 0, key[v] = inf for all v != s.
2. Extract min vertex u from priority queue.
3. For each adjacent edge (u, v): if v is in the queue and w(u, v) < key[v], update key[v] = w(u, v) and parent[v] = u (Decrease-Key).
Complexity with Binary Min-Heap: O(V log V + E log V) = O(E log V).
3. Worked Problem: Minimum Weight Spanning Tree Edge Inclusion
Always verify whether the cut property isolates a subset. If multiple edges share the minimum weight across a cut, any of them may appear in some MST, but not necessarily all.
Problem: Graph G has 5 vertices {A, B, C, D, E} and edges with weights: (A, B)=1, (B, C)=2, (C, D)=3, (D, E)=4, (E, A)=5, (A, C)=2, (B, D)=3, (C, E)=4. Find the total weight of the MST and check whether it is unique.
Step 1: Sort edges in non-decreasing order:
(A, B): 1
(A, C): 2, (B, C): 2
(C, D): 3, (B, D): 3
(D, E): 4, (C, E): 4
(E, A): 5
Step 2: Execute Kruskal's algorithm:
- Add (A, B) wt 1. Components: {A, B}, {C}, {D}, {E}. MST wt = 1.
- Consider wt 2: (A, C) connects {A, B} and {C}. Add (A, C) wt 2. Components: {A, B, C}, {D}, {E}. MST wt = 3.
- Consider (B, C) wt 2: Both B and C are already in {A, B, C}. Forms cycle (A-B-C-A). Discard.
- Consider wt 3: (C, D) connects {A, B, C} and {D}. Add (C, D) wt 3. Components: {A, B, C, D}, {E}. MST wt = 6.
- Consider (B, D) wt 3: Both B and D are in {A, B, C, D}. Forms cycle. Discard.
- Consider wt 4: (D, E) connects {A, B, C, D} and {E}. Add (D, E) wt 4. Components: {A, B, C, D, E}. MST wt = 10.
Step 3: Verification:
Edges selected: (A, B)=1, (A, C)=2, (C, D)=3, (D, E)=4.
Total MST weight = 1 + 2 + 3 + 4 = 10.
Alternative tie: if at wt 2 we picked (B, C)=2 instead of (A, C)=2, we get edges (A, B)=1, (B, C)=2, (C, D)=3, (D, E)=4 with total weight 10. Hence MST is NOT unique, but the minimum weight 10 is unique.
Primary Academic References & Exam Sources
Every concept in Notes From a B.Tech Brain is synthesized from authoritative academic texts, seminal peer-reviewed research, verified exam archives, and renowned university lectures.
Curated for clarity, rigorous numerical solving, and semester excellence:
Best visual explanations of algorithm design and complexity analysis.
Exam-focused with GATE PYQ numericals on every major algorithm.