Boost logo

Boost Users :

From: gast 128 (gast128_at_[hidden])
Date: 2005-02-13 16:03:42


Dear all,

I have a graph, but when I remove the last vertex, the edge isn't removed.
This can even lead to a crash.

typedef boost::adjacency_list<boost::listS,
                              boost::vecS, //or listS, same problem
                              boost::directedS,
                              boost::property<boost::vertex_index_t, int,
                              boost::property<boost::vertex_name_t,
std::string> >
> GraphCrash;

typedef boost::graph_traits<GraphCrash>::vertex_descriptor vertex_t;
typedef boost::graph_traits<GraphCrash>::edge_descriptor edge_t;
typedef boost::graph_traits<GraphCrash>::vertex_iterator vertex_iterator;
typedef boost::graph_traits<GraphCrash>::edge_iterator edge_iterator;

GraphCrash graph;

//vertices
vertex_t v1 = boost::add_vertex(graph);
boost::put(boost::vertex_name, graph, v1, "v1");

vertex_t v2 = boost::add_vertex(graph);
boost::put(boost::vertex_name, graph, v2, "v2");

//edges
boost::add_edge(v1, v2, graph);

//remove last vertex
boost::remove_vertex(v2, graph);

//should not give any edge, however...:

std::pair<edge_iterator, edge_iterator> prEdges;
for (prEdges = boost::edges(graph); prEdges.first != prEdges.second;
++prEdges.first)
{
   const edge_t e = *prEdges.first;
   const vertex_t u = boost::source(e, rGraph);
   const vertex_t v = boost::target(e, rGraph);
}

Do I something wrong? I use vc++ 7.1.

Wkr,
me

(btw entering this message through gmane, it bounces back, with error that
is is a top posting. Strange...)

_________________________________________________________________
Talk with your online friends with MSN Messenger http://messenger.msn.nl/


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net