|
Boost Users : |
Subject: [Boost-users] [BGL] destroying a subgraph
From: fabricio (fabricio.olivetti_at_[hidden])
Date: 2009-06-10 18:21:52
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 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