Boost logo

Boost :

From: Janusz Piwowarski (jpiw_at_[hidden])
Date: 2003-08-19 15:44:52


Hi all

I found remove_vertex member for vector_as_graph isn't implemented.
It's my proposal:

  template<class EdgeList, class Allocator>
  void
  remove_vertex(typename EdgeList::value_type u,
                std::vector<EdgeList, Allocator>& g)
  {
    typedef typename EdgeList::iterator iterator;
    clear_vertex(u, g);
    g.erase(g.begin() + u);
    for (std::size_t i = 0; i < g.size(); ++i)
      for ( iterator it = g[i].begin(); it != g[i].end(); ++it )
        // after clear_vertex none *it is equal to u
        if ( *it > u )
          --*it;
  }

Regards,
Janusz


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk