What Correctness Requires
Boruvka’s algorithm repeatedly examines the components of a current forest and chooses an outgoing edge of minimum weight for each component. Its efficiency comes from making several choices in one round. To prove correctness, we need to establish three facts: a component’s choice is safe, the choices in a round do not create a cycle, and every round that is not finished reduces the number of components.
Throughout, \(G=(V,E)\) is a finite, connected, simple, undirected graph with \(n=|V|\ge 1\), and each edge has a real weight \(w(e)\). A spanning tree is a connected, acyclic subgraph containing every vertex. A minimum spanning tree (MST) is a spanning tree of least total edge weight. At least one MST exists: a connected finite graph has a spanning tree, and there are only finitely many spanning trees over which to minimize the weight.
A forest is an acyclic graph, not necessarily connected. The algorithm’s current forest \(F\) starts with vertex set \(V\) and no edges. An edge is safe relative to \(F\) if \(F+e\) is contained in some MST. The key invariant will be that the current forest is contained in an MST.
Why a Component’s Choice Is Safe
The cut associated with a component \(C\) is the partition \((C,V\setminus C)\). Its crossing edges are exactly the edges outgoing from \(C\). We prove the safety fact directly, including the role of the current forest.
Proof. If \(e\in E(T)\), then \(T\) already contains \(F+e\). Otherwise, adding \(e\) to the tree \(T\) creates a cycle: the cycle consists of \(e\) and the unique path in \(T\) between its endpoints. That path starts in \(C\) and ends outside \(C\), so it contains an edge \(f\) crossing the cut \((C,V\setminus C)\). Because \(e\) is a minimum-weight crossing edge, \(w(e)\le w(f)\).
No edge of \(F\) crosses this cut: \(C\) is a component of \(F\), so an edge of \(F\) cannot join \(C\) to another component. In particular, \(f\notin E(F)\). Remove \(f\) from \(T+e\). Removing an edge from that cycle leaves a spanning tree \(T'=T+e-f\), and \(T'\) still contains every edge of \(F\), as well as \(e\). Its weight is \(w(T')=w(T)+w(e)-w(f)\le w(T)\). Since \(T\) is an MST, \(T'\) cannot have smaller weight than \(T\); hence \(T'\) is also an MST. Therefore \(F+e\) is contained in an MST. \(\square\)
The lemma gives safety for one component’s choice. Boruvka adds choices from several components in the same round, so we also need to show that the whole batch can be added without losing the invariant.
Choices in a Round Preserve a Forest
At the start of a round, contract each component of \(F\) to one vertex. The chosen edges then connect these contracted vertices. Regard each component as choosing its selected edge toward the other component at that edge’s endpoint. If both endpoints select the same edge, it is included only once.
Proof. Suppose the selected edges created a cycle among the components of \(F\). On that cycle, every edge must have been selected by at least one of its endpoint components. A cycle with \(k\) edges has \(k\) vertices, and each component selects just one edge. Thus every cycle edge must be selected exactly once by a component on the cycle, and no such component selects an edge outside the cycle. The selections therefore point around the cycle in one direction. At each component, its selected edge is strictly earlier in the tie-breaking order than the other cycle edge leaving that component. Going around the cycle would give a strictly decreasing sequence of edge positions that returns to its starting edge, which is impossible. So there is no cycle among the contracted components. Since \(F\) itself is acyclic, adding edges whose contracted graph is acyclic leaves a forest. \(\square\)
For the invariant, acyclicity alone is not enough: the new forest must still be contained in an MST. Process the distinct selected edges in the fixed order. Suppose the edges before \(e\) in this order have already been added while preserving containment in an MST. Let \(C\) be the component that selected \(e\) at the start of the round. None of the earlier selected edges crosses \((C,V\setminus C)\): any such edge would be an outgoing edge from \(C\) earlier than its selected edge \(e\), contradicting the choice of \(e\). Also, no edge of the starting forest \(F\) crosses this cut.
Take an MST containing \(F\) and all the earlier edges. If it does not contain \(e\), adding \(e\) creates a cycle. The cycle’s path between the endpoints of \(e\) crosses the cut, so it contains some crossing edge \(f\). The preceding paragraph shows that \(f\) is not one of the edges already required in the forest. Since \(e\) has minimum weight across the cut, \(w(e)\le w(f)\). Replacing \(f\) by \(e\) gives a spanning tree of no greater weight, hence another MST, now also containing \(e\). Repeating this argument for each selected edge proves that the entire round’s choices can be added while preserving containment in an MST.
Worked Example: Two Rounds and a Minimum Spanning Tree
Let \(V=\{1,2,3,4,5\}\), with edge weights \(w(12)=1\), \(w(23)=2\), \(w(34)=1\), \(w(45)=2\), \(w(15)=10\), \(w(13)=4\), \(w(25)=6\), and \(w(24)=5\). Fix any tie-breaking order; the choices below contain no ties.
Initially each vertex is its own component. The outgoing-edge comparisons give: vertex \(1\) chooses \(12\), of weight \(1\), rather than \(13\) of weight \(4\) or \(15\) of weight \(10\); vertex \(2\) chooses \(12\), of weight \(1\), rather than \(23\) of weight \(2\), \(24\) of weight \(5\), or \(25\) of weight \(6\). Vertex \(3\) chooses \(34\), of weight \(1\), rather than \(23\) of weight \(2\) or \(13\) of weight \(4\). Vertex \(4\) chooses \(34\), of weight \(1\), rather than \(45\) of weight \(2\) or \(24\) of weight \(5\). Vertex \(5\) chooses \(45\), of weight \(2\), rather than \(25\) of weight \(6\) or \(15\) of weight \(10\).
After duplicate choices are counted once, round 1 adds \(12,34,45\). These form components \(\{1,2\}\) and \(\{3,4,5\}\). Their crossing edges are \(23\) of weight \(2\), \(13\) of weight \(4\), \(24\) of weight \(5\), \(25\) of weight \(6\), and \(15\) of weight \(10\). Both components choose \(23\), so round 2 adds it once. The resulting tree has edges \(12,23,34,45\), with total weight \(1+2+1+2=6\).
Check: The chosen edges form a path through all five vertices, so they are connected and acyclic. As an independent check of the minimum weight, process all edges in increasing weight as in Kruskal’s algorithm: \(12\) and \(34\) (each weight \(1\)) are accepted; \(23\) and \(45\) (each weight \(2\)) are accepted and complete the tree. The next edge has weight \(4\), so it cannot replace any of these accepted edges in Kruskal’s process. The resulting total is \(1+1+2+2=6\), agreeing with Boruvka’s result.
Termination and Correctness
Proof. We maintain the invariant that the current graph \(F\) is a forest contained in some MST. Initially \(F\) has no edges, so it is a forest and is contained in every MST. If a round is performed, the forest-preservation lemma shows that the selected edges keep \(F\) acyclic. The batch-safety argument shows that the enlarged forest remains contained in an MST. Thus the invariant holds after every round.
If \(F\) has more than one component, each component has an outgoing edge. Indeed, if one component had none, no edge of \(G\) would join it to its complement, contradicting the connectedness of \(G\). Every component therefore selects an edge to a different component. Consequently at least two old components merge, and the number of components strictly decreases. It is a positive integer, so this strict decrease can occur only finitely many times. When there is one component, \(F\) is connected as well as acyclic and contains every vertex; it is a spanning tree.
By the invariant, this final tree is contained in an MST. Both are spanning trees on the same vertex set, so containment means they have exactly the same edges. The output is therefore an MST. If \(n=1\), the initial empty-edge forest is already connected on its one vertex and is the spanning tree, so the algorithm terminates immediately. \(\square\)
Worked Example: Resolving Equal Weights
Let \(V=\{A,B,C\}\), with \(E=\{AB,BC,CA\}\) and \(w(AB)=w(BC)=w(CA)=1\). Set the tie-breaking order to \(AB<BC<CA\). In round 1, \(A\) compares \(AB\) with \(CA\) and chooses \(AB\); \(B\) compares \(AB\) with \(BC\) and chooses \(AB\); \(C\) compares \(BC\) with \(CA\) and chooses \(BC\). After counting \(AB\) once, the selected edges are \(AB\) and \(BC\).
These edges connect all three vertices and contain no cycle, so the algorithm terminates with a tree of weight \(1+1=2\). A spanning tree on three vertices has two edges. Since each available edge has weight \(1\), every spanning tree has weight \(1+1=2\); this independently confirms optimality.
Check: If the three vertices each chose arbitrarily among tied edges, they could choose \(AB,BC,CA\), which would create a cycle. The fixed order prevents that: the choices in this example are \(AB,AB,BC\), and the repeated choice is included only once.
A Round with Several Simultaneous Merges
Worked Example: Following All Components Through the Final Merge
Let \(V=\{1,2,3,4,5,6\}\), and let the edge weights be \(w(12)=3\), \(w(23)=1\), \(w(34)=4\), \(w(45)=2\), \(w(56)=1\), \(w(16)=5\), \(w(14)=3\), \(w(36)=2\), and \(w(25)=4\). For the tie \(w(12)=w(14)=3\), place \(12\) first in the fixed order.
In round 1, vertex \(1\) chooses \(12\) (weight \(3\), ahead of \(14\) by the tie rule and lighter than \(16\), weight \(5\)). Vertex \(2\) chooses \(23\) (weight \(1\), rather than \(12\) of weight \(3\) or \(25\) of weight \(4\)). Vertex \(3\) chooses \(23\) (weight \(1\), rather than \(36\) of weight \(2\) or \(34\) of weight \(4\)). Vertex \(4\) chooses \(45\) (weight \(2\), rather than \(14\) of weight \(3\) or \(34\) of weight \(4\)). Vertex \(5\) chooses \(56\) (weight \(1\), rather than \(45\) of weight \(2\) or \(25\) of weight \(4\)). Vertex \(6\) chooses \(56\) (weight \(1\), rather than \(36\) of weight \(2\) or \(16\) of weight \(5\)). Thus round 1 adds \(12,23,45,56\), leaving components \(\{1,2,3\}\) and \(\{4,5,6\}\).
The crossing edges in round 2 are \(36\) of weight \(2\), \(14\) of weight \(3\), \(25\) of weight \(4\), and \(16\) of weight \(5\). Both components choose \(36\), so it is added once. The final edges are \(12,23,36,45,56\); their total weight is \(3+1+2+2+1=9\). They connect all six vertices and contain five edges, and the construction has kept them acyclic, so they form a spanning tree.
Check: Kruskal’s independent check accepts, in order, \(23\) and \(56\) (each weight \(1\)), \(45\) and \(36\) (each weight \(2\)), then \(12\) (weight \(3\)). These five edges connect all six vertices, and their weight is \(1+1+2+2+3=9\), the same total.
Common Pitfall
Do not treat arbitrary tied choices as automatically cycle-free. In the equal-weight triangle, it is possible for the three vertices to choose \(AB\), \(BC\), and \(CA\), respectively. Adding all three produces a cycle, not a forest. The correction is to fix a strict tie-breaking order before making choices and include each selected edge only once. The proof above then ensures that a round preserves acyclicity and that its additions remain contained in an MST. Without a tie rule or another explicit cycle-handling procedure, the forest invariant has not been established.
The connectedness assumption matters as well. If the input graph is disconnected, a component with no outgoing edge may never merge with the others, so there is no spanning tree of the whole graph. Running the same merging process separately within each connected component instead produces a minimum spanning forest.
Check Your Understanding
For each question, explain which invariant or argument justifies your answer.
- Why can the edge \(f\) removed in the cut-exchange proof not belong to the current forest \(F\)?
- What role does the strict tie-breaking order play in proving that a round’s choices are acyclic?
- In a connected graph, why must every component of a forest with more than one component have an outgoing edge?
- How does the safety argument extend from one selected edge to all the choices in a round?
- What does the algorithm return if the connected input graph has exactly one vertex?