I see. But suppose I have a graph that is attached to some root graph but has no subgraphs of its own, and I want to remove some nodes and edges (without affecting rest of the hierarchy at all), what would be the best way to do that?

Carefully :)

You mean that the subgraphs are disjoint and you want to remove elements form a disjoint subgraph and the root graph? You might need to create a new graph data structure - lets call it disjoint_subgraphs - that's kind of a flattened, inverted version of the subgraph system. Each subgraph is actually an independent, fully mutable adjacency_list (or whatever). The "root" graph could provide a read-only view over the subgraphs. Descriptors for the root graph would have to be redefined to reference descriptors from specific subgraphs (not too hard). Vertex and edge iterators would simply span the iterators of the subgraphs (also pretty easy).

Does that sound like it might do the trick?

Andrew Sutton
andrew.n.sutton@gmail.com