Boost logo

Boost :

From: Alex Breuer (abreuer_at_[hidden])
Date: 2006-10-05 15:15:08


On Oct 5, 2006, at 2:33 PM, Mohamed Anouar Rachdi wrote:

>
> ######################################################################
> ###
> typename graph_traits<Graph>::edge_descriptor ed;
> bool exist;
>
> typename graph_traits<Graph>::edge_iterator ei, ei_end;
>
> Graph copyGraph;
>
>
> typename boost::property_map<Graph, edge_weight_t>::type weight =
> get(edge_weight, graph);
> typename boost::property_map<Graph, edge_index_t>::type edge_id =
> get(edge_index, graph);
>
>
> typename boost::property_map<Graph, edge_weight_t>::type weightc =
> get(edge_weight, copyGraph);
> typename boost::property_map<Graph, edge_index_t>::type edge_idc =
> get(edge_index, copyGraph);
>
>
> for ( tie(ei, ei_end)=edges(graph); ei != ei_end; ei++ )
> {
> tie(ed, exist)= add_edge( source(*ei,graph), target(*ei,graph),
> copyGraph);

At this point, you've got a new edge, ed, in your copyGraph, but
you're trying to use the edge descriptor from your old graph, ei, to
access copyGraph's property maps, which may cause bad things to happen.

> put(edge_idc, ed, edge_id[*ei]);
> put(weightc, ed, weight[*ei]);
> }
>
>
> ######################################################################
> ########
>
>
> hello everyone,
>
> i have a problem with this code that is used inside a fonction wich a
> call in a loop
>
> after 2 or 3 calls i have a segfault at the line with add_edge
>
> i'm using multigraphs
>
> Ps : i got the same probleme whiel using copy_graph(graph,copyGraph)
>
>
> is there any suggestions.....
>
> thanx
>
>
>
>
> _______________________________________________
> Unsubscribe & other changes: http://lists.boost.org/mailman/
> listinfo.cgi/boost


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk