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:
    1. Sort all the edges from low weight to high
    2. 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.
    3. Keep adding edges until we reach all vertices.