Algorithm
Kruskal's Algorithm:
- Sort all the edges in non-decreasing order of their weight.
- Initialize an empty set to store the edges of the Minimum Spanning Tree (MST).
- For each edge in the sorted list:
- Check if adding the edge to the MST forms a cycle using a union-find data structure.
- If it does not form a cycle, add the edge to the MST.
- Repeat until the MST contains exactly (V - 1) edges, where V is the number of vertices in the graph.
Example:

Fig. 1: Step-by-Step Process of Kruskal's Algorithm
Note: Kruskal's Algorithm is efficient for sparse graphs and uses a union-find data structure to detect cycles.