16 Feb
2009
16 Feb
'09
5:23 p.m.
On Feb 16, 2009, at 9:14 AM, Gianni Loiacono wrote:
Hi all, I have defined my graph like this: typedef adjacency_list
Graph2; And also: graph_traits < Graph2 >::edge_iterator ei, ei_end; Now, I want to delete all edges where the capacity is less than 10. Than I have write this code: for (tie(ei, ei_end) = edges(g); ei != ei_end; ++ei) { if (capacity2[*ei] < 10) { remove_edge(source(*ei,g),target(*ei,g),g); } } But the program after 2 cicles....it crashs :(...Why? Thanks a lot
remove_edge invalidates the edge iterators. You could use the "remove_edge_if" function, or use listS for edges. -- Michael