Proving MST algorithms correct [00OI]
- October 9, 2026
Proving the correctness of all the algorithms mentioned above relies on one crucial property.
Definition Cut [00OL]
- October 9, 2026
A cut in a graph G = (V,E) is a partition of the vertices V into two sets S and T, that is, every vertex is in either S or T but not both. We say that an edge e crosses the cut (S,T) if one vertex of e is in S and the other is in T.
Theorem Cut property [00OJ]
- October 9, 2026
Let G = (V,E) be an undirected, weighted graph with positive weights. Suppose S and T partition V, and let e = (x,y) be an edge crossing the (S,T) cut, such that the weight of e is strictly smaller than the weight of any other edge crossing the (S,T) cut. Then every minimum spanning tree of G must contain e.
Proof.
- October 9, 2026
Let G be a weighted, undirected graph G = (V,E), let S and T be an arbitrary partition of V into two sets, and suppose e = (x,y) is the smallest-weight edge with one endpoint in S and one in T. We wish to show that any MST of G must contain e.
We will prove the contrapositive. Suppose M is a spanning tree of G which does not contain the edge e; we will show that M is not a minimum spanning tree. Since M is a tree, it contains a unique path between any two vertices. So consider the unique path in M between x and y. It must cross the cut at least once since it starts in S and ends in T; suppose it crosses at e' = (x',y'),with x' \in S and y' \in T. We know that the weight of e is smaller than the weight of e', since e was defined to be the smallest-weight edge crossing the (S,T) cut. Now take M and replace e' with e; the result is still connected (because any path using e' can be rerouted through e), but it has a smaller total weight because the weight of e is less than e'.
So, we have shown that any spanning tree M which does not contain the edge e can be made into a smaller one, which means that M is not a minimum spanning tree.
Remark Exchange arguments [00OK]
- October 9, 2026
This is an exchange argument, which is a general technique for proving that something is not minimal (and, more generally, for proving that greedy algorithms are correct)—find appropriate things to exchange so the total becomes smaller (while preserving any relevant properties).
In this particular example, note that we can’t exchange e with any edge across the cut! We particularly found the edge on the path from x to y since that guarantees we can exchange it with e while preserving connectivity.
Theorem Kruskal's Algorithm is correct [00OM]
- October 9, 2026
Kruskal’s Algorithm is correct (when all edges have distinct weights).
Proof.
- October 9, 2026
Remark Kruskal on graphs with repeated weights [00ON]
- October 9, 2026
The previous theorem applies only to graphs where every edge has a distinct weight, but it is not too much harder to show that Kruskal's Algorithm works even when there are repeated weights.
Remark Prim and Reverse-Delete are correct [00OP]
- October 9, 2026
Prim's Algorithm and the Reverse-Delte algorithm are correct as well, by similar arguments.