|
Boost Users : |
From: Alejandro Aragon (aaragon2_at_[hidden])
Date: 2006-08-04 12:11:48
Hello everyone. I'm trying to implement Fleury's algorithm to find an
Eulerian path in a graph. Every time I erase an edge in the graph, I
need to check how many connected components I have (because I can't
erase an edge that is a "bridge"). Also, I was using in the beginning
graphs with VertexList=VecS but it turns out that when you erase an edge
all the vertex descriptors are invalidated. Thus, I had to copy my
graph to another one with VertexList=listS.
I was wondering if the connected components algorithm works with this
type of graph. I'm having an error. It seems that the compiler does
not recognize this function.
/usr/include/boost/graph/connected_components.hpp:46: error: no matching
function for call to put(unsigned int*&, void*&, unsigned int&)
make: *** [graph.o] Error 1
Any ideas? Thank you,
aa
My code is shown below:
typedef adjacency_list<listS, listS, undirectedS,
property<vertex_index_t, std::size_t>,
no_property
> graph_t;
graph_traits<graph_t>::out_edge_iterator out,out_end;
graph_t copy(num_vertices(*gPtr));
// obtain a property map for the vertex_index property
property_map<graph_t, vertex_index_t>::type
index = get(vertex_index, copy);
// initialize the vertex_index property values
graph_traits<graph_t>::vertex_iterator vi, vend;
graph_traits<graph_t>::vertices_size_type cnt = 0;
for(tie(vi,vend) = vertices(copy); vi != vend; ++vi)
put(index, *vi, cnt++);
for (tie(ei, ei_end) = edges(*gPtr); ei != ei_end; ++ei){
add_edge(vertex(source(*ei,*gPtr), copy),
vertex(target(*ei,*gPtr), copy), copy);
}
graph_traits<graph_t>::vertex_descriptor Vertex;
graph_traits<graph_t>::edge_iterator ei,ei_end;
vertex_descriptor u,v;
u = vertex(0,copy);
for (tie(out, out_end) = out_edges(u,copy); out != out_end; ++out){
u = source(*out,copy);
v = target(*out,copy);
remove_edge(u,v,copy);
std::vector<size_t> component(num_vertices(copy));
num = connected_components(copy, &component[0]);
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