Kruskal’s Algorithm
Kruskal's Algorithm is a greedy algorithm used to find the Minimum Spanning Tree (MST) for a weighted undirected graph. A Minimum Spanning Tree is a subset of the edges that connects all the vertices with the minimum total edge weight, without forming any cycles.
How Kruskal's Algorithm Works
- Sort all the edges in non-decreasing order of their weights.
- Start with an empty MST and consider the smallest edge.
- Add the edge to the MST only if it does not form a cycle.
- Repeat the process until all vertices are connected in the MST.