How can I create subgraphs/clusters in Graphviz, with nodes at specific positions, and then have Graphviz rotate and arrange these subgraphs according to a set of interconnecting edges (i.e. edges not within the subgraphs)?
Here's my current attempt. Problem is that I want to be able to define the internal ordering of the nodes, such that, as an example, the nodes in subgraph "3" are aligned in a row (and always ordered A-B-C):
graph {
forcelabels=true
color=lightgrey
subgraph cluster_1 {
node[shape=point]
{rank=same r1A r1B}
label="1"
r1A [xlabel="A", fontsize=7]
r1B [xlabel="B", fontsize=7]
}
subgraph cluster_2 {
node[shape=point]
{rank=same r2A r2B}
label="2"
r2A [xlabel="A", fontsize=7]
r2B [xlabel="B", fontsize=7]
}
subgraph cluster_3 {
node[shape=point]
{rank=same volA volB volC}
label="3"
volA [xlabel="A", fontsize=7]
volB [xlabel="B", fontsize=7]
volC [xlabel="C", fontsize=7]
}
}
If I add edges, I want Graphviz to be able to rotate the subgraphs, but while preserving that internal layout and ordering. Here, using engine fdp
, subgraph "3" gets all rearranged (for obvious reasons, since I haven't got any way of fixing the layout):
And what about more advanced "layouts"? Is it possible/feasible to make a subgraph resembling a microcontroller, something like this: