Boruvka's algorithm
Borůvka's algorithm is an algorithm for finding minimum spanning trees. It was first published in 1926 by Otakar Borůvka as a method of efficiently electrifying Bohemia.Borůvka's algorithm, in pseudocode, given a graph , is:
- Copy the vertices of into a new graph, , with no edges.
- While is not connected (e.g., is a forest of more than one tree):
- For each subtree in , find the smallest edge in connecting a vertex in to one outside it.
- Add that edge to , reducing the number of trees in by one.
- Add that edge to , reducing the number of trees in by one.
- For each subtree in , find the smallest edge in connecting a vertex in to one outside it.
Other algorithms for this problem include Prim's algorithm and Kruskal's algorithm. Faster algorithms can be obtained by combining Prim's algorithm with Borůvka's. A faster randomized algorithm due to Karger, Klein and Tarjan runs in expected time.