Kruskal implementation in a more verbose language