13 Nov
2007
13 Nov
'07
5:14 p.m.
Olivier Tournaire wrote:
Any help would be appreciate.
This is the function that I came up with to erase a graph. /* * Note the use of the reverse_iterator */ template<typename T1> void EraseGraph(T1& g) { typedef typename std::vector<typename boost::graph_traits<T1>::vertex_descriptor> Vertices; Vertices vertices; typename boost::graph_traits<T1>::vertex_iterator vi,vi_end; for (boost::tie(vi,vi_end)=boost::vertices(g);vi!=vi_end;++vi) vertices.push_back(*vi); for (typename Vertices::reverse_iterator iter=vertices.rbegin();iter!=vertices.rend();++iter) { boost::clear_vertex(*iter,g); boost::remove_vertex(*iter,g); } }