Implementaion of KruskalB algorithm for MST