Prim and Kruskal Algorithm for Clustering