On Wed, 31 Mar 2004, Jeremy Siek wrote:
#include
... digraph g; g << "vertex" << make_pair("vertex", "implicit_vertex"); g.add_edge("brother", "sister", "sibling"); if(g.find(make_pair("brother", "sister"))) related = true; Perhaps this is a good place to start. Could you explain each of the above lines of code. Then we can compare to an implementation in the current BGL and pinpoint problem areas.
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. 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. Doug