Hi, I have a question about the BGL. I'm trying to get remove_edge_if
to work with a multigraph. The documentation doesn't seem to prohibit
this:
http://www.boost.org/libs/graph/doc/MutableGraph.html
http://www.boost.org/libs/graph/doc/adjacency_list.html
However, the following sample code crashes. It is intended to add two
vertices v0 and v1, and to add two edges from v0 to v1, and then to
remove all of the edges by passing an always-true predicate to
remove_edge_if.
-------------------
#include
#include <iostream> // for std::cout
#include <utility> // for std::pair
#include // for boost::tie
#include // for boost::graph_traits
#include
#include
using namespace std;
using namespace boost;
typedef adjacency_list UnderlyingGraphType;
typedef boost::graph_traits<UnderlyingGraphType>::vertex_descriptor
vertexType;
typedef boost::graph_traits<UnderlyingGraphType>::edge_descriptor
edgeType;
class truePredicate {
public:
truePredicate() {}
bool operator()(edgeType e){
cout << "edgePred got " << e <1 ;
0->1 ;
}
edgePred got (0,1)
about to return true!!!
edgePred got (0,1)
about to return true!!!
edgePred got (0,1)
about to return true!!!
edgePred got (4294967295,1919379812)
about to return true!!!
Segmentation fault
-------------------
thanks for your help,
bayle
p.s. btw, i'm in the process of wrapping BGL for Python using
Boost::Python, in case anyone is interested.