Boruvka’s Algorithm is a greedy algorithm used for finding Minimum Spanning Tree (MST) for
a connected, weighted, and undirected graph.
The goal of the algorithm is to connect “components” using the shortest or cheapest edge between
the components. It begins with all of the vertices considered as separate components.
Boruvka’s algorithm is parallel in nature. It operates in phases. In each phase, it selects
the cheapest edge from each component, adds all of these to the MST at once, and then contracts
each connected component into a single component.
We make use of a Union-Find data structure to keep track of the components.
This program takes a connected, weighted, and undirected graph as input and prints the total weight of edges in MST.