Boost logo

Boost :

From: Alex Breuer (abreuer_at_[hidden])
Date: 2006-10-06 14:28:03


It would be useful to know exactly where in copy_graph things are
segfaulting. It is not unlikely that memory management problems
upstream of your call to copy_graph are causing things to go bad
later. Try using valgrind.

On Oct 5, 2006, at 3:58 PM, Mohamed Anouar Rachdi wrote:

>
>
> Alex Breuer wrote:
>
>> 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]);
>>> }
>>>
>>>
>>>
> here i'm just trying to copy the property map from graph to copyGraph
> i think it's the same than doing
> edge_idc[*ed] = edge_id[*ei];
>
> I'm i wrong??
>
> it' doesn't tell me why when i used copy_graph wich is a boost
> function
> it also behave the same way since i got a segfault at the second
> call!!!
>
>>> ####################################################################
>>> ##
>>> ########
>>>
>>>
>>> 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
>>>
>>>
>>
>> _______________________________________________
>> Unsubscribe & other changes: http://lists.boost.org/mailman/
>> listinfo.cgi/boost
>>
>>
> _______________________________________________
> 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