Prim’s and Kruskal’s algorithms