[BGL] destroying a subgraph

Hi all, I have a vector of subgraphs and at certain situations I have to remove some vertex from one of them. As this is not possible for now, I simply create a temporary subgraph with the vertices I want and replace the old one. The problem is that the memory allocated from the old one is not freed correctly. What should be the correct procedure to do so?? a code snippet: void modgraph::remove_a_vertex(unsigned idx, Vertex vt) { Graph* temp_subg = &g.create_subgraph(); graph_traits < Graph >::vertex_iterator itg, end; for (tie(itg,end) = vertices(*subg(idx)); itg != end; ++itg) { if( (*subg(idx)).local_to_global(*itg) != vt ) { add_vertex(*itg, *temp_subg); } } *subg(idx) = *temp_subg; } where subg is a vector of subgraphs.

well I ended up creating my own implementation of remove_node() for a
subgraph, of course it just removes the edge from the given subgraph
not from the parent graphs (and neither from the children) but it will
work for now!
thank you all
On 10 jun, 19:21, fabricio
Hi all,
I have a vector of subgraphs and at certain situations I have to remove some vertex from one of them. As this is not possible for now, I simply create a temporary subgraph with the vertices I want and replace the old one. The problem is that the memory allocated from the old one is not freed correctly. What should be the correct procedure to do so??
a code snippet:
void modgraph::remove_a_vertex(unsigned idx, Vertex vt) { Graph* temp_subg = &g.create_subgraph(); graph_traits < Graph >::vertex_iterator itg, end; for (tie(itg,end) = vertices(*subg(idx)); itg != end; ++itg) { if( (*subg(idx)).local_to_global(*itg) != vt ) { add_vertex(*itg, *temp_subg); } } *subg(idx) = *temp_subg;
}
where subg is a vector of subgraphs. _______________________________________________ Boost-users mailing list Boost-us...@lists.boost.orghttp://lists.boost.org/mailman/listinfo.cgi/boost-users
participants (1)
-
fabricio