[graph] remove_if algorithm
Hello,
I'm new to the graph library, but I'm missing some algorithms that I
believe are quite low level, and that I expected to find.
For instance, I'd like to be able to remove nodes from a graph that meet
some criterion. The closest I could find to remove_if was :
- Iterate on each node manually:
for (tie(vi, viend) = boost::vertices(myGraph) ;
vi != viend;
++vi)
{
if (criterion(vi)
{
clear_vertex(*vi, myGraph);
remove_vertex(*vi, myGraph);
}
}
But I'm afraid of iterator invalidity
- Filter, copy, swap:
Graph tempGraph;
{
filtered_graph
participants (1)
-
Loïc Joly