|
Boost : |
From: Vladimir Prus (ghost_at_[hidden])
Date: 2003-08-27 01:21:59
Hi Janusz,
Janusz Piwowarski wrote:
> I found remove_vertex member for vector_as_graph isn't implemented.
> It's my proposal:
Thanks!
> 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;
> }
The implementation is fine, AFAICT. The only problem with me is the comment:
I couldn't understand it for the first time because "none *it" sounded
confusing. Maybe "*it is never equal to u" is better?
BTW, if you could sumbit unified diff instead of new implementation, that
would be nice. If that's not convenient for you, no problem. I can apply
the thange anyway.
Thanks,
Volodya
>
> Regards,
> Janusz
>
> _______________________________________________
> Unsubscribe & other changes:
> http://lists.boost.org/mailman/listinfo.cgi/boost
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk