Let be a simple and connected undirected graph with a vertex set and an edge set such that each edge is weighted by a real value .
For a subset of vertices, let denote the set of edges between and .
For a subset of edges, define and .
Answer the following questions.
(i) Let , be a subtree of and assume that one of the minimum spanning trees of contains the tree .
Let be an edge with the minimum weight among the edges in .
Prove that one of the minimum spanning trees of contains
(ii) Describe Prim’s method for computing a minimum spanning tree and prove its correctness.
(iii) Let be a minimum spanning tree of .
Prove that holds for every spanning tree of .
Let be one minimum spanning tree that contains the tree .
If , then itself contains , so there is nothing to prove.
Since , the graph contains a cycle (called the fundamental cycle of ). Hence along the cycle , there must be another edge that also cross the same cut, i.e.,
We substitute edge by edge and let denote the tree after substitution, i.e. .
Since is an edge with the minimum weight among the edges in , we know that .
find an edge e = uv (u in X and v in V\X) of minimum weight among E(X)
F = F + {e}
X = X + {v}
output F
We prove the correctness of Prim's algorithm by induction.
The induction hypothesis will be that after each iteration, the tree is a subgraph of some minimum spanning tree .
This is trivially true at the start, since initially is just a single node and no edges.
Suppose that at some point in the algorithm we have which a subgraph of some minimum spanning tree .
Since the Prim's algorithm finds an edge of minimum weight, from (i) we know that there exists a minimum spanning tree of that contains . Therefore the induction hypothesis is preserved after this iteration.
When the algorithm terminates, we have . Since one new vertex and one new edge are added in each iteration, has edges and is a spanning tree. By the induction argument, is contained in some minimum spanning tree. Therefore Prim’s algorithm correctly outputs a minimum spanning tree of .