Boost logo

Boost Users :

From: Jeffrey Holle (jeffreyholle_at_[hidden])
Date: 2007-11-13 12:14:47


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);
   }
}


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