
25 Nov
2009
25 Nov
'09
1:07 p.m.
On second thought Prim's algorithm computes only the spanning tree of the component the starting vertex belongs to. So instead you can use the edge list returned by Kruskal's algorithm to mark tree edges and then use filtered_graph to hide non-marked edges and transform the original graph into a forest without creating a new graph. The predecessor map can be used to identify the root node of trees. Gabe