Add routine for checking correctness of obtained mst