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
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
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.