Boost logo

Boost Users :

Subject: Re: [Boost-users] Boost Graph/Subgraph: Making a "layered graph"
From: Jeremiah Willcock (jewillco_at_[hidden])
Date: 2011-04-02 15:29:34

On Sat, 2 Apr 2011, Frank Neuhaus wrote:

> Hi,
> I want to represent a graph that consists of several layers. I have an
> algorithm that is supposed to be run on each layer seperately. I thought
> about having all layers in one graph, but each layer in a subgraph of this
> graph. That way - I thought - I could leave the algorithm that works on one
> layer unchanged.
> First off: Is that a reasonable design? Is there a different way to achieve
> what I want? Maybe there is another way to pass a subset of the graph to my
> algorithm?

The subgraph class is supposed to do what you want, as you suggest. I
don't understand it well, though. If you just need filtering (either
induced or non-induced subgraphs), you can use filtered_graph instead; it
is much simpler and I believe all of its property-related bugs have been
fixed. For that, you just give predicates for the vertices and edges to

-- Jeremiah Willcock

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at