Boost logo

Boost :

From: jeremy siek (jsiek_at_[hidden])
Date: 2000-09-27 16:14:48


Hi Asger,

I've looked into this problem some more. The problem appears with
directed graphs (but not undirected or bidirectional) because the
edge_iterator for a directed adjacency_list is really built on top of
the out_edge_iterator, which is invalidated by the call to
remove_edge().

The best solution I see at present is to add the following function:

remove_edge_if(predicate, graph);

Cheers,

Jeremy

jsiek_at_[hidden] writes:
>
> Forwarded bug report/feature request for the graph library.
>
> Asger Alstrup Nielsen writes:
> > Dear Jeremy,
> >
> > I'm a fond user of the GGCL, and I follow your integration of the code
> > into Boost with great interest. However, I've ran into a problem: How
> > can I efficiently remove many edges from a graph?
> >
> > It seems that code like this won't work:
> >
> > Graph::edge_iterator e1, e2;
> > for (boost::tie(e1, e2) = edges(g); e1 != e2; ++e1) {
> > if ([criteria]) {
> > // Remove this edge!
> > remove_edge(g, *e1);
> > }
> > }
> >


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