Description:
- Implements Greedy Algorithm
- We start from the edges with the lowest weight and keep adding edges until we reach our goal. The steps for implementing Kruskal’s algorithm are as follows:
- Sort all the edges from low weight to high
- Take the edge with the lowest weight and add it to the spanning tree. If adding the edge creates a cycle, then reject this edge.
- Keep adding edges until we reach all vertices.