
11 May
2012
11 May
'12
3:12 p.m.
On 11/05/2012 15:36, NsPx wrote:
I would like to delete a vertex and all its children vertices in a directed graph. For example,
<>
typedef adjacency_list<boost::vecS, boost::vecS, boost::bidirectionalS, vertex_info> Graph; <> // remove all children and the given vertex : doesn't work for( it=allChildren.begin(), ite=allChildren.end(); it!=ite; ++it) { remove_vertex(*it, *myGraph); }
It doesn't work because removing a vertex invalidates existing vertex descriptors when vertices are stored in a vector. See also the second table in: http://www.boost.org/doc/libs/1_49_0/libs/graph/doc/adjacency_list.html. You could use the following instead: typedef adjacency_list<boost::vecS, boost::listS, boost::bidirectionalS, vertex_info> Graph;