Subgraphs play three roles in Graphviz. First, a subgraph can be used to represent graph structure, indicating that certain nodes and edges should be grouped together.
But is that used anywhere? Dot doesn’t seem to care about the grouping, unless it is a cluster.
digraph G {
subgraph cluster_test {c1 c2}
a -> b
a ->c1
b->c2
}
While cluster subgraphs physically group/gather their embedded nodes, non-cluster subgraphs (only) logically effect the embedded nodes/edges - by applying common attributes to the set.
I think I’d like to use this subgraph feature to physically group nodes. I’m trying to understand what you are referring to as a cluster? I don’t see anything in the AGraph class documentation about a cluster? I’m taking two nodes that have already been added to the graph and putting them in a python list and doing the G.add_subgraph(list) function call. The result is they do not seem to be grouped together in the resulting graph.
I look at your example and the only difference I see is in the name ‘cluster_test’ vs. ‘cluster’.
OK I found that cluster is an attribute so I specified ‘cluster=True’ on the add_subgraph()… The script seemed to run OK but I didn’t see any difference. I’m using prog=‘neato’. I’m not really sure if it’s valid for neato?
OK now I find a post that neato doesn’t support clusters?
OK well I tried ldp and didn’t get the grouping but the graph looks worse. Mine is a 3 tiered hierarchical graph and I was using the mode=hier in neato. I tried dot and that produced an unreadable graph. So anyone have any suggestions for a 3 tiered graph?
Sorry I just saw this… I’m looking for something like this where it is hierarchical and thing 3a and thing 3b are “joined”. The dotted line would be a nice plus.
Thing A, B an4 could be done w/ simple nodes, but here they are all HTML labels.
Record labels (same page) would also work, except for the dashed-line.
Hi thanks but maybe I’m missing something. I want to do this with pygraphviz. I want the 3 tiered hierarchical format and the grouping of thing 3a/3b. Not there will be multiple other things in the middle level (e,g, thing 4a/4b, thing 5a/5b, etc.). I’m using neato with ‘heir’ and it’s sort of OK but I need the grouping.
Can you show us a larger example of the output you are looking for? Even a hand sketch? It is very difficult to improve a graph without seeing the input and outputs.
If there is an issue with proprietary content, there is an anonymizer you can use.
If you want a 3-level format showing a hierarchical structure, dot is probably the engine needed. I understand that a previous dot attempt was not acceptable, but there many ways to tune a graph with dot.