Boost logo

Boost Users :

Subject: [Boost-users] [graph] modeling advice
From: Remy Muller (muller.remy_at_[hidden])
Date: 2016-02-19 05:14:59


hello,

I have a modeling question for seasoned boost graph practitioners:

I am modelling a dataflow DAG where nodes have input and output ports
and edges can connect output ports to input ports.

I am already using a temporary boost::graph during the compilation
process to detect feedback loops, compute the topological sort and
parallel ordering...etc For that task it is enough to forget about the
notion of ports and only have one vertex per node and edges between nodes.

However I would like to avoid rebuilding the graph each time a node or
connection is added and use boost::graph as my primary model.

A simple solution I have found is to annotate edges with some edge
properties to keep track of the source and target ports in the
respective nodes. However that solution has some shortcomings: it is not
possible to use out_degree, in_degree, out_edges, in_edges...etc for a
specific port, one has to manually scan all the edges and select the
ones matching the port of interrest.

As an alternative, I have thought about building a bigger graph with one
vertex for each node and each port and subgraphs to group nodes with
their input / output ports. However in this case it is no longer easy to
get all the out_edges for a node, one has to aggregate all the out_edges
of each output port.

I suppose this is a common modeling problem. I would be happy to hear
about other solutions to this problem and their potential advantages and
drawbacks.

best regards.



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net