Java implementation (and test) of Kruskal's MST algorithm