Ups, I think this is better.
References:
http://boost.org/libs/graph/doc/connected_components.html
--dima
#include
#include // for boost::graph_traits
#include
#include
#include
/**/
struct Node
{
typedef int vertex_index_t;
vertex_index_t m_vertex_index;
static vertex_index_t Node::* svertex_index;
};
Node::vertex_index_t Node::* svertex_index = &Node::m_vertex_index;
struct Boundary
{
double something;
};
typedef boost::adjacency_list<
boost::setS, boost::listS, boost::undirectedS,
Node, Boundary, boost::no_property, boost::setS> Graph;
int main(int argc, char*argv[])
{
Graph g(5);
typedef boost::graph_traits<Graph>::vertex_descriptor vertex_t;
std::map comps;
std::map c_m;
int num = boost::connected_components(g, boost::make_assoc_property_map(comps),
boost::color_map(boost::make_assoc_property_map(c_m)));
std::cout << "Number of cc: " << num << std::endl;
return 0;
}