Re: [Boost-users] FW: adjacency_list remove_edge

Hi Doug, here is the example code that works - XFlatGraph is a listS, listS adjacency_list. Note if I replace the remove edge expression with remove_edge(*iter, _graph) the edge is intermittently not removed thanks Sean XFlatGraph& graph = _flat_view->get_graph(); XFlatEdgePMap& edge_pmap = get(kFlatGraphEdgeProperty, graph); std::list<XFlatView::edge_descriptor> scheduled_for_removal; XFlatView::edge_iterator current, end; tie(current, end) = edges(graph); for(;current!=end;++current) { if(edge_pmap[*current]->get_impl()->isSimulationOnly()) { scheduled_for_removal.push_back(*current); } } // Remove edges marked as simualtion only scheduled_for_removal.unique(); for(std::list<XFlatView::edge_descriptor>::iterator iter = scheduled_for_removal.begin(); iter != scheduled_for_removal.end(); ++iter) { remove_edge(source(*iter, graph), target(*iter,graph), graph); } System Information: compiler info: Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 13.10.3077 for 80x86 Copyright (C) Microsoft Corporation 1984-2002. All rights reserved. Boost version 1-32 -----Original Message----- From: boost-users-bounces@lists.boost.org [ mailto:boost-users-bounces@lists.boost.org] On Behalf Of Doug Gregor Sent: Thursday, March 02, 2006 12:42 PM To: boost-users@lists.boost.org Subject: Re: [Boost-users] FW: adjacency_list remove_edge On Mar 1, 2006, at 6:33 PM, Sean Kelly wrote:
It sounds like either the edge_descriptor is getting invalidated or there is a bug somewhere in remove_edge.
Are you sure that there are no duplicate edge descriptors?
I can provide more detailed info upon request.
We won't be able to help without more detailed information. Doug _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users

On Mar 17, 2006, at 1:08 PM, Sean Kelly wrote:
Hmmm, this is dangerous. The problem is that once you delete the thing that "iter" points to, "iter" is invalidated and can no longer be used for traversal. To work around this, you should instead use remove_edge_if. Doug
participants (2)
-
Doug Gregor
-
Sean Kelly