|
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>
Graph;
typedef boost::property_map<Graph, component_t>::type
ComponentPropertyMap;
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: http://www.lsc.nd.edu/~jsiek/
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 acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk