Boost logo

Boost Users :

From: Chris Russell (cdr_at_[hidden])
Date: 2003-06-03 16:43:05


When in doubt: stare at the code, post a dumb question, take the huskies for
a walk, come back with a theory...

I think this is my own idiocy. Inside the loop I'm making a method call that
removes edges. This invalidates the iterators right?

"Chris Russell" <cdr_at_[hidden]> wrote in message
news:bbj0fu$miu$1_at_main.gmane.org...
> This is weird...
>
> I'm still using BGL from Boost 1_29_0 (which may be an issue?). Anyway,
I've
> got a graph as so:
>
> typedef boost::property<vertex_forest_property_t,
> CProteinCircuitForestVertexProperty,
boost::property<boost::vertex_index_t,
> long, boost::property<boost::vertex_color_t, boost::default_color_type> >
>
> forest_vertex_property_maps_declaration_t;
>
> typedef boost::adjacency_list<boost::listS /*edges*/, boost::listS
> /*vertices*/, boost::bidirectionalS,
> forest_vertex_property_maps_declaration_t> forest_graph_t;
>
> I've done a lot with this class, including all kinds of edge traversal.
Now
> suddenly I have a case where boost::out_edges seems to be returning an
> invalid iterator range. I'm absolutely certain the vertex descriptor is
> correct, boost::out_degree returns the expected number of out edges,
however
> I fault inside my access loop because the iterator has gone out of
range....
>
> typedef boost::graph_traits<forest_graph_t>::vertex_descriptor
> forest_vertex_descriptor_t;
> typedef boost::graph_traits<forest_graph_t>::vertex_descriptor
> forest_vertex_descriptor_t;
> typedef boost::graph_traits<forest_graph_t>::edges_size_type
> forest_edges_size_t;
> typedef boost::graph_traits<forest_graph_t>::out_edge_iterator
> forest_edge_out_iterator_t;
>
> forest_edge_out_iterator_t edgeoutiterBegin, edgeoutiterEnd,
> edgeoutiterCurrent;
> boost::tie(edgeoutiterBegin, edgeoutiterEnd) =
> boost::out_edges(v/*forest_vertex_descriptor_t*/,g/*forest_graph_t);
> for (edgeoutiterCurrent = edgeoutiterBegin;
> edgeoutiterCurrent != edgeoutiterEnd ;
> ++edgeoutiterCurrent)
> {
> // works fine through the expected out edges - faults because the loop
fails
> to terminate
> forest_vertex_descriptor_t vertexTarget =
boost::target(*edgeoutiterCurrent,
> g);
> } // end for
>
> Any suggestions would be greatly appreciated. I'm really scratching my
head
> because I've done this exact operation in several other places in the
> algorithm and it works just fine....
>
> TIA - Chris
>
>
>
>
>
>
>
>
>
>
>
>
> Info: <http://www.boost.org>
> Wiki: <http://www.crystalclearsoftware.com/cgi-bin/boost_wiki/wiki.pl>
> Unsubscribe: <mailto:boost-users-unsubscribe_at_[hidden]>
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>
>


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