kruskal MST algorithm based on weighted quick union works now