Boost Graph/Subgraph: Making a "layered graph"
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?
Now as for the actual problem with boost subgraphs:
My current code (for one layer only) looks similar to this:
----
struct my_vertex { int x; };
struct my_edge { int y; };
typedef boost::adjacency_list
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 keep. -- Jeremiah Willcock
participants (2)
-
Frank Neuhaus
-
Jeremiah Willcock