Boost logo

Boost Users :

Subject: Re: [Boost-users] BGL: counting connected components subgraph
From: Arman Khalatyan (arm2arm_at_[hidden])
Date: 2009-11-24 16:34:52


Thanks for explanation,

If you just want to know the number of connected components define
> your own predecessor_map for kruskal_minimum_spanning_tree. Then you
> can count the vertices with themselves as predecessor. These vertices
> are the roots of the spearate trees:

 How to walk over those separate trees?
 Is it should be something like this?
Graph::vertex_iterator vi, vi_end;
for(tie(vi, vi_end) = vertices(graphMST); vi != vi_end; ++vi)
 if(*vi == pred[get(vi_map, *vi)])
   num_components++;
else
{
 WriteOutTree(num_components);??? ///
}



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net