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 .
From the connectivity of , we know that there exists an edge that connects and , i.e. .
We substitute edge by edge and let denote thetree after substitution, i.e. .
Since is an edge with the minimum weight among the edges in , we know that .
PrimAlgorithm(G=(V, E)): choose an arbitrary vertex s in V F = {} X = {s} while X is not equal to V do: 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 . This maintains the induction, so proves the correctness.