Boost logo

Boost Users :

From: Krishna Roskin (krish_at_[hidden])
Date: 2007-09-10 14:25:10


Hello everyone,

I hope this question isn't to vague. I just looking for some general advice.

I'm working on a project where I'm dynamically building a graph on the
fly as the graph is traversed. For out_edges(...) (and other
functions), I've been using something similar to
shared_container_iterator to dynamically build the list of out edges.
My target and source functions return-by-value objects that represent
the vertices. I've also overloaded the operator[] on the graph to
return-by-value objects with the edge and vertex properties. I use
by-value semantics because the entire graph is never created in
memory.

But my iterators and graph object don't quite fit into the rest of the
boost graph library. For instance, filtered_graphs of my graph don't
like that my iterators don't return references to edge_descriptors.
I've fixed that problem by defining

typedef typename Graph::edge_descriptor reference;

in the iterator, i.e. reference aren't really references but
returned-by-value objects. But this seem like treating the symptoms
and not the cause. And the operator[] of the filtered_graph wants to
return references as well and so I get "returning reference to
temporary" errors. I've gotten around this by just getting the
vertex/edge properties from the original graph.

Has anyone else had these problems? Or know of a better way to build
graphs dynamically? Any advice or strategies would be appreciated.

Thanks,
-krish


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