Kruskal MST in C++