Hi Doug, On Mar 31, 2004, at 1:52 PM, Douglas Paul Gregor wrote:
The only thing I've ever found complex in the BGL is actually forming a graph type out of adjacency_list. Every single time I need a graph I have to read through the adjacency_list documentation to figure out what to do, although often I just copy the typedef from somewhere else. Simplified graph adaptors could really help here.
Right. In particular, the way internal properties are dealt with is rather cumbersome.
There's a lot we could do in the way of syntactic sugar. For instance, I'd love to be able to easily loop over the edges in a graph without dealing with iterators directly:
Graph g; for(Graph::vertex_descriptor u, v; (u, v) = G; ) { // do something with edge (u, v) }
The same thing can be applied to, e.g., adjacent vertices:
for(Graph::vertex_descriptor v; v = adj(u, g); ) { // v is adjacent to u }
Since vertex descriptors tend to be iterators or indices, this could be implemented just as efficiently as the corresponding iterator loop, but it's a simpler idiom.
Looks neat. How would that be implemented? I hope it doesn't require
storing something in the graph object itself that keeps track of
the progress of the iteration.
BTW, for those who like macros, there's
boost/graph/iteration_macros.hpp.
Cheers,
Jeremy
_______________________________________________
Jeremy Siek