Added code for Kruskal B algorithm implementation