Boost logo

Boost :

From: Jeremy Siek (jsiek_at_[hidden])
Date: 2001-07-25 09:15:45

Hi Rob,

The problem with this one is that connected_components requires either
a vertex color property map, or a vertex index property map so that
it can create its own vertex color property map. Here's one way to
fix it:

typedef boost::property<boost::vertex_color_t, boost::default_color_type,
VertexComponentProperty> VertexColorProperty;

typedef boost::property<boost::edge_weight_t, int> EdgeWeightProperty;

typedef boost::adjacency_list<boost::listS, boost::setS,
boost::undirectedS, VertexColorProperty ,EdgeWeightProperty>

typedef boost::property_map<Graph, component_t>::type

int main(int argc, char* argv[])
   Graph G;

   ComponentPropertyMap component = boost::get(component_t(), G);

   int num = boost::connected_components
     (G, component, boost::color_map(boost::get(boost::vertex_color, G)));

   return 0;

 Jeremy Siek www:
 Ph.D. Candidate, IU B'ton email: jsiek_at_[hidden]
 Summer Manager, AT&T Research phone: (973) 360-8185

Boost list run by bdawes at, gregod at, cpdaniel at, john at