# Borůvka's algorithm

Graph and tree search algorithms |
---|

Listings |

Related topics |

**Borůvka's algorithm** is an algorithm for finding a minimum spanning tree in a graph for which all edge weights are distinct.

It was first published in 1926 by Otakar Borůvka as a method of constructing an efficient electricity network for Moravia.^{[1]}^{[2]}^{[3]} The algorithm was rediscovered by Choquet in 1938;^{[4]} again by Florek, Łukasiewicz, Perkal, Steinhaus, and Zubrzycki^{[5]} in 1951; and again by Sollin ^{[6]} in 1965. Because Sollin was the only computer scientist in this list living in an English speaking country, this algorithm is frequently called **Sollin's algorithm**, especially in the parallel computing literature.

The algorithm begins by first examining each vertex and adding the cheapest edge from that vertex to another in the graph, without regard to already added edges, and continues joining these groupings in a like manner until a tree spanning all vertices is completed.

## Pseudocode

Designating each vertex or set of connected vertices a "component", pseudocode for Borůvka's algorithm is:

```
0 Input: A connected graph G whose edges have distinct weights
1 Initialize a forest T to be a set of one-vertex trees, one for each vertex of the graph.
2 While T has more than one component:
3 For each component C of T:
4 Begin with an empty set of edges S
5 For each vertex v in C:
6 Find the cheapest edge from v to a vertex outside of C, and add it to S
7 Add the cheapest edge in S to T
8 Output: T is the minimum spanning tree of G.
```

As in Kruskal's algorithm, tracking components of T can be done efficiently using a disjoint-set data structure. In graphs where edges have identical weights, edges with equal weights can be ordered based on the lexicographic order of their endpoints.

## Complexity

Borůvka's algorithm can be shown to take O(log *V*) iterations of the outer loop until it terminates, and therefore to run in time O(*E* log *V*), where *E* is the number of edges, and *V* is the number of vertices in *G*. In planar graphs, and more generally in families of graphs closed under graph minor operations, it can be made to run in linear time, by removing all but the cheapest edge between each pair of components after each stage of the algorithm.^{[7]}

## Example

## Other algorithms

Other algorithms for this problem include Prim's algorithm and Kruskal's algorithm. Fast parallel algorithms can be obtained by combining Prim's algorithm with Borůvka's.^{[8]}

A faster randomized minimum spanning tree algorithm based in part on Borůvka's algorithm due to Karger, Klein, and Tarjan runs in expected O(*E*) time.^{[9]} The best known (deterministic) minimum spanning tree algorithm by Bernard Chazelle is also based in part on Borůvka's and runs in O(*E* α(*E*,*V*)) time, where α is the inverse of the Ackermann function.^{[10]} These randomized and deterministic algorithms combine steps of Borůvka's algorithm, reducing the number of components that remain to be connected, with steps of a different type that reduce the number of edges between pairs of components.

## Notes

- ↑ Borůvka, Otakar (1926). "O jistém problému minimálním (About a certain minimal problem)".
*Práce mor. přírodověd. spol. v Brně III*(in Czech and German summary).**3**: 37&ndash, 58. <templatestyles src="Module:Citation/CS1/styles.css"></templatestyles> - ↑ Borůvka, Otakar (1926). "Příspěvek k řešení otázky ekonomické stavby elektrovodních sítí (Contribution to the solution of a problem of economical construction of electrical networks)".
*Elektronický Obzor*(in Czech).**15**: 153&ndash, 154. <templatestyles src="Module:Citation/CS1/styles.css"></templatestyles> - ↑
**Lua error in Module:Citation/CS1/Identifiers at line 47: attempt to index field 'wikibase' (a nil value).** - ↑ Choquet, Gustave (1938). "Étude de certains réseaux de routes".
*Comptes-rendus de l’Académie des Sciences*(in French).**206**: 310&ndash, 313. <templatestyles src="Module:Citation/CS1/styles.css"></templatestyles> - ↑ Florek, Kazimierz (1951). "Sur la liaison et la division des points d'un ensemble fini".
*Colloquium Mathematicum 2 (1951)*(in French): 282&ndash, 285. <templatestyles src="Module:Citation/CS1/styles.css"></templatestyles> - ↑ Sollin, M. (1965). "Le tracé de canalisation".
*Programming, Games, and Transportation Networks*(in French). <templatestyles src="Module:Citation/CS1/styles.css"></templatestyles> - ↑ Eppstein, David (1999). "Spanning trees and spanners". In Sack, J.-R.; Urrutia, J.
*Handbook of Computational Geometry*. Elsevier. pp. 425–461.<templatestyles src="Module:Citation/CS1/styles.css"></templatestyles>; Mareš, Martin (2004). "Two linear time algorithms for MST on minor closed graph classes" (PDF).*Archivum mathematicum*.**40**(3): 315–320.<templatestyles src="Module:Citation/CS1/styles.css"></templatestyles>. - ↑
**Lua error in Module:Citation/CS1/Identifiers at line 47: attempt to index field 'wikibase' (a nil value).** - ↑
**Lua error in Module:Citation/CS1/Identifiers at line 47: attempt to index field 'wikibase' (a nil value).** - ↑