Want dot to directly support edges between clusters, and/or FDP to support rankdir=BT or gravity
I am trying to autogenerate a complex dependency diagram, with some nodes being represented as cluster subgraphs (containing sub-dependency diagrams) which are still nodes as well (they are not just containers of nodes, but are actual things that arrows can point to), such that the dependency arrows all point at least somewhat "up" the page, or at least don't point "down". A dependency diagram, at least in my case, should form a directed acyclic graph (DAG) with a single node as the "root" node which is directly or indirectly dependent on all other top-level nodes.
I have spent several days trying to accomplish this, and have achieved only partial success. This is frustrating, since this seems to me like a fairly basic use-case for GraphViz and hence the sort of thing that GraphViz should be able to easily support 'out of the box' without excessive tweaking, yet I have had to resort to strange workarounds:
If I use the 'dot' layout, in order to use subgraphs as nodes, I apparently have to create an invisible dummy node in each subgraph, and have edges that "should" go to any subgraph boundaries instead target the subgraph's dummy node, and use "ltail" and "lhead" attributes on those edges to reference the containing subgraph's name, so the arrows get clipped on the subgraph boundaries instead of extending all the way to the dummy nodes.
(Note: This is per StackOverflow https://stackoverflow.com/questions/2012036/graphviz-how-to-connect-subgraphs).
I've gotten this working, but it has the unfortunate side effect that each invisible dummy node has a definite location within its parent cluster, and therefore the arrows drawn to it are drawn to target that location (before clipping) rather than drawn as if they were going to target the center of the cluster. This looks OK when the invisible dummy node ends up roughly in the center of the subgraph, but not so good when it ends up sitting near one corner.
Nonetheless, for "dot", I can use "rankdir=BT" to get arrows pointing generally up the page rather than down (although for some reason, nodes inside clusters often seem to ignore rankdir and are often right-to-left instead...?)
If I use the 'fdp' layout, clusters seem to be supported as first-class objects, so I don't need all of the "dummy node" and "lhead/ltail" workarounds (I can just create an edge from one cluster's name to another node or cluster name, for instance). Unfortunately, rankdir=BT seems to have no effect in such a case (but I don't see any documentation that says so), so my dependency arrows seem to end up pointing in various random directions, which would be fairly confusing for someone looking at the diagram.
So, in short, if I want to have some nodes be clusters in my diagram, and I want dependency ordering to be generally (exclusively?) bottom-to-top, I don't seem to have any good options.
I would like to have a way to accomplish this. I would also prefer that this way be fairly "clean" and not require nonintuitive workarounds. Some suggestions:
If the 'dot' algorithm is going to continue to require this workaround for drawing edges between clusters, then at least please provide some way to automate it. For instance, if a graph had "compound=true', then inside each cluster subgraph, the tools could automatically create an invisible zero-size dummy node named after the cluster (with possibly some prefix to make it unlikely to overlap user's node names), and then if dot found an edge which was sourced or targeted at a cluster name, it could substitute the dummy node name and automatically add an "lhead" or "ltail" attribute referencing the cluster name. (Right now, the dot algorithm seems to treat cluster names as if they refer to nonexistent nodes).
It would be nice to have a way to force any such dummy nodes to be placed at the exact center of their clusters, rather than being placed wherever the placement algorithm sees fit to put them in the cluster.
It would be even nicer if dot just allowed use of clusters as sources or targets of edges, and drew edges to clusters as if they were to the center of the cluster, but clipped at its boundary as via lhead and ltail, without the need for any dummy nodes.
With regards to the 'fdp' algorithm, it would be nice if there was a way to directly specify rankdir=BT, or to at least achieve a similar effect as rankdir. If rankdir can't be implemented directly due to the nature of the algorithm (which to my limited understanding seems to involve some kind of physics model), then perhaps at least the algorithm could introduce some notion of "gravity" in an arbitrary direction (specified by rankdir or some other attribute) pulling on nodes away from some given node or set of nodes which were designated as "fixed" at the top, bottom, left, or right of the diagram. Thus in my case, a root node could be fixed at the bottom of the page, and the other nodes could "float upwards" as high as they could due to gravity pulling upwards, constrained by spring tension of edges.
In summary: Please provide a way to create a graph such as a "dependency diagram with arrows pointing upwards" which supports some nodes being clusters, and which is expressible directly in GraphViz with a minimum of workarounds required.