
Hi Sebastian, On Jul 22, 2005, at 7:57 AM, Sebastian Weber wrote:
I'm trying to initialize my adjacency_list graph via an EdgeIterator. Since I do not want parallel edges to be present in my graph, but still use vecS as EdgeList-storage because of memory considerations, my EdgeIterator needs somehow a reference to the graph under construction. Some code might explain it better:
typedef boost::adjacency_list<boost::vecS, boost::vecS, boost::undirectedS > graph_t; typedef boost::my_edge_iterator<base_rand_gen_t, graph_t> SFGen;
graph_t bg = graph_t(SFGen(bg, base_rand, 100), SFGen(), 100);
This code compiles fine, but seg-faults immediatly since bg does not seem to be defined when my iterator gets constructed.
My gut feeling is that this should work.. you're not trying to make a copy of "bg" when you builf SFGen, right? SFGen needs to store a pointer to a graph_t, not a reference or copy.
A solution would be to provide a add_edge_range-function which gets as input the EdgeIterator and the corresponding empty boost graph.
Good idea.
This function would then build up the graph or is there a better way to do this?
Nothing better than making lots of add_edge calls, which is exactly what the EdgeIterator constructor does. Doug