made changes for getting adjacency graph after MST