<br clear="all"><br>Hello, I wondered are there way to count connected components in the�minimum spanning tree? <div><br></div><div><div>Currently I just making copy of graph to be able to count and collect connected components are there more efficient way to do that?</div><div>______________________________</div><div>std::vector < Edge > spanning_tree;</div> <div>Graph graphMST;</div></div><div>kruskal_minimum_spanning_tree(graphFOREST, std::back_inserter(spanning_tree));</div><div><div>for (std::vector < Edge >::iterator ei = spanning_tree.begin();</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>ei != spanning_tree.end(); ++ei) {</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>if(get(edge_weight, graphFOREST, *ei)<1.0)//lets cut the MTS by given threshold</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>add_edge(source(*ei, graphFOREST),target(*ei, graphFOREST),get(edge_weight, graphFOREST, *ei),graphMST);</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>}</div><div><br></div><div>num = connected_components(graphMST, &component[0]);</div><div>// Use�components...</div><div>_______________________________</div> <div><br></div><div>Thank you beforehand</div><div>Arman.</div></div>