Add a function for determining the minimum spanning tree and commenting