Boruvka’s Algorithm:
Given that we have seen two algorithms (Kruskal’s and Prim’s) for solving
the MST problem, it may seem like complete overkill to consider yet another algorithm. This
one is called Boruvka’s algorithm. It is actually the oldest of the three algorithms (invented in
1926 by the Czech mathematician Otakar B˚
oruvka, well before the first digital computers!).
The reason for studying this algorithm is that of the three algorithms, it is the easiest to
implement on a parallel computer. Unlike Kruskal’s and Prim’s algorithms, which add edges
one at a time, Boruvka’s algorithm adds a whole set of edges all at once to the MST.
Boruvka’s algorithm is similar to Kruskal’s algorithm, in the sense that it works by main-
taining a collection of disconnected trees.
Let us call each subtree a
component
.
Initially,
each vertex is by itself in a one-vertex component. Recall that with each stage of Kruskal’s
algorithm, we add the (globally) lightest (minimum weight) edge that connects two differ-
ent components together. To prove Kruskal’s algorithm correct, we argued (from the MST
Lemma) that the lightest such edge will be
safe
to add to the MST.
In fact, a closer inspection of the proof reveals that the lightest edge exiting
any
component is
always safe. This suggests a more parallel way to grow the MST. Each component determines
the lightest edge that goes from inside the component to outside the component (we don’t
care where). We say that such an edge
leaves
the component.
Lecture Notes
44
CMSC 451

Note that two components might select the same edge by this process. By the above obser-
vation, all of these edges are safe, so we may add them all at once to the set
A
of edges in the
MST. If there are edges of equal weight, the algorithm might attempt to add two such edges
between the same two components, which would result in the generation of a cycle. (Each
edge individually is safe, but adding both simultaneously generates a cycle.) We make the
assumption that edge weights are distinct (or at least, there is some uniform rule for breaking
ties so the above problem cannot arise).
Note that in a single step of Boruvka’s algorithm many components can be merged together
into a single component.
We then apply DFS to the edges of
A
, to identify the new com-
ponents.
This process is repeated until only one component remains.
A fairly high-level
description of Boruvka’s algorithm is given below.
Boruvka’s Algorithm
BoruvkaMST(G=(V,E), w) {
initialize each vertex to be its own component
A = {}
// A holds edges of the MST
while (there are two or more components) {
for (each component C) {
find the lightest edge (u,v) with u in C and v not in C
add {u,v} to A (unless it is already there)
}
apply DFS to graph (V, A), to compute the new components
}
return A
// return final MST edges
There are a number of unspecified details in Boruvka’s algorithm, which we will not spell
out in detail, except to note that they can be solved in Θ(
n
+
m
) time through DFS. First,
we may apply DFS, but only traversing the edges of
A
to compute the components. Each


You've reached the end of your free preview.
Want to read all 181 pages?
- Fall '08
- staff
- The Land, lim, Big O notation, Analysis of algorithms