Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between Boruvka and Kruskal in finding MST

I would like to know the difference between Boruvkas algorithm and Kruskals algorithm.

What they have in common:

  • both find the minimum spanning tree (MST) in a undirected graph
  • both add the shortest edge to the existing tree until the MST is found
  • both look at the graph in it`s entirety, unlike e.g. Prims algorithm, which adds one node after another to the MST
  • Both algorithmns are greedy

The only difference seems to be, that Boruvkas perspective is each individual node (from where it looks for the cheapest edge), instead of looking at the entire graph (like Kruskal does).

It therefore seems to be, that Boruvka should be relatively easy to do in parallel (unlike Kruskal). Is that true?

like image 739
User12547645 Avatar asked Apr 22 '18 16:04

User12547645


2 Answers

In case of Kruskal's algorithm, first of all we want to sort all edges from the cheapest to the most expensive ones. Then in each step we remove min-weight edge and if it doesn't create a cycle in our graph (which initially consits of |V|-1 separate vertices), then we add it to MST. Otherwise we just remove it.

Boruvka's algorithm looks for nearest neighbour of each component (initially vertex). It keeps selecting cheapest edge from each component and adds it to our MST. When we have only one connected component, it's done.

Finding cheapest outgoing edge from each node/component can be done easily in parallel. Then we can just merge new, obtained components and repeat finding phase till we find MST. That's why this algorithm is a good example for parallelism (in case of finding MST).

Regarding parallel processing using Kruskal's algorithm, we need to keep and check edges in strict order, that's why it's hard to achieve explicit parallelism. It's rather sequential and we can't do much about this (even if we still may consider e.g. parallel sorting). Although there were few approaches to implement this method in parallel way, those papers can be found easily to check their results.

like image 68
mtszkw Avatar answered Sep 30 '22 17:09

mtszkw


Your description is accurate, but one detail can be clarified: Boruvka's algorithm's perspective is each connected component rather than each individual node.

Your intuition about parallelization is also right -- this paper has more details. Excerpt from the abstract:

In this paper we design and implement four parallel MST algorithms (three variations of Boruvka plus our new approach) for arbitrary sparse graphs that for the first time give speedup when compared with the best sequential algorithm.

like image 32
k_ssb Avatar answered Sep 30 '22 17:09

k_ssb