MST
Tags: #◇Computer Science #◇CCDSALG #◇MST #◇Conceptual #◇M6
◇Overview
A Spanning Tree is an acyclic graph that connects all the vertices of a connected graph. A Minimum Spanning Tree (MST) is a spanning tree whose total edge weight is minimized. The document introduces two greedy algorithms for finding the MST: Prim's algorithm, which grows the tree from an arbitrary root vertex, and Kruskal's algorithm.
◇Important Formulas
MST Definition:
For a connected, undirected weighted graph , find an acyclic subgraph connecting all vertices such that:
- A spanning tree for vertices always contains exactly edges.
Cut Property (Theoretical Foundation):
Let be any cut that respects . If is a light edge crossing , then is safe for .
Algorithmic Complexities:
| Algorithm | Strategy | Data Structure | Time Complexity | Preferred Graph Type |
|---|---|---|---|---|
| Kruskal's | Edge-centric (Global sort) | Disjoint-Set / Union-Find | Sparse graphs () | |
| Prim's | Vertex-centric (Grows single tree) | Min-Priority Queue | (Binary Heap) / (Fibonacci Heap) | Dense graphs () |
◇Theoretical Framework: MST Construction Paradigms
Kruskal's Cycle-Detection Execution Pipeline (Union-Find)
◇Worked Examples
- Kruskal's Step-by-Step Trace:
- Graph with vertices and sorted edges: , , , , .
- Pick (weight 1): Sets are . Add . Union: .
- Pick (weight 2): Set of is , set of is . Distinct Add . Union: .
- Pick (weight 3): Set of is , set of is . Same set! Reject to avoid cycle .
- Pick (weight 4): Set of is , set of is . Distinct Add . Union: .
- edges chosen. Total MST Weight: .
◇References & Navigation
- Related Notes: ◇Minimum Spanning Trees