Use Greedy algorithm to find the minimum spanning tree.

Running time analysis

For a graph , it depends on the specific implementation of the disjoint-set data structure.

Prim’s Algorithm