Java implementation of Prim's and Kruskal's algorithms to find the minimum spanning tree of a graph