transform_to_min_spanning_tree function

Get a minimum spanning tree subgraph