Kruskal's algorithm for clustering A simple application of Kruskal's algorithm to find clusters in a 2D data set. The script applies the basic idea of Kruskal's algorithm by computing the MST until there remains only n MST's, producing n clusters.