Java Program implementing the kruskal and prims algorithm using the sorted edges, union find.