Spanning Trees and Minimum Spanning Trees
Spanning trees provide a minimal connected subgraph that reaches all vertices, making them fundamental for network design, broadcasting protocols, and optimization problems in weighted graphs.
A spanning tree of a connected graph is a subgraph that is a tree. Thus includes all vertices of and edges that maintain connectivity without cycles.
Every connected graph has at least one spanning tree. A graph with vertices and edges can have spanning trees if and only if and the graph is connected.
For a complete graph , Cayley's formula gives the number of distinct spanning trees:
For example, has spanning trees. This formula shows the exponential growth in network design options.
Given a weighted graph where assigns weights to edges, a minimum spanning tree is a spanning tree that minimizes the total weight:
MSTs are not necessarily unique, but all MSTs of have the same total weight.
Consider connecting 5 cities with roads where edge weights represent construction costs. The complete graph has possible roads. An MST selects exactly 4 roads that connect all cities with minimum total cost. If weights are for edges in increasing order, Kruskal's algorithm would select edges with weights (if they don't form cycles), giving total cost 10.
A cut partitions vertices into two sets. A crossing edge has one endpoint in and one in .
Cut Property: For any cut with no MST edges crossing it, the minimum-weight crossing edge must be in some MST. This property underlies both Prim's and Kruskal's algorithms.
Prim's Algorithm grows an MST from a single vertex by repeatedly adding the minimum-weight edge connecting the tree to a new vertex. Kruskal's Algorithm sorts all edges by weight and adds edges that don't create cycles, using a union-find data structure. Both run in time with appropriate data structures.
Cycle Property: For any cycle in , the maximum-weight edge in is not in any MST (unless multiple edges tie for maximum weight).
This provides a complementary perspective to the cut property and enables alternative MST algorithms and proofs of correctness.
Spanning trees and MSTs are central to network optimization, circuit design, approximation algorithms, and serve as building blocks for more complex graph algorithms like traveling salesman problem approximations.