Hola Andre,
pleas take a look in this. Works more o less.
Atentamente,
--dmitry
André Loose wrote:
Hi,
I use an undirected graph with bundled properties and want to find out,
whether it is connected, or not. Reading the documentation and some
examples using property maps, I did not succeed in getting it to work.
A minimal example that reproduces the compile errors follows. What am I
doing wrong here:
#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[])
{
using namespace boost;
Graph g(5);
// manually intialize the vertex index,
// because we have listS as vertex list type
int n = 0;
BGL_FORALL_VERTICES(vd, g, Graph)
{
put(svertex_index, g, vd, n++);
}
typedef graph_traits<Graph>::vertex_descriptor vertex_t;
std::map comps;
property_map::type i_m(get(svertex_index, g));
int num = connected_components(g, make_assoc_property_map(comps),
boost::vertex_index_map(i_m));
std::cout << "Number of cc: " << num << std::endl;
return 0;
}