Kruskal's algorithm

Kruskal's algorithm step-by-step

  • Start with the edge that has the lowest weight.
  • Select the edge with the lowest weight that's still left and add it to the tree. Note: if the addition of the edge with the lowest weight creates a cycle, drop it and take the next lowest edge.
  • Continue this way until all nodes are connected.
  • The subgraph you arrived at is called the minimal spanning tree.