In the DOT
language for GraphViz
, I'm trying to represent a dependency diagram. I need to be able to have nodes inside a container and to be able to make nodes and/or containers dependent on other nodes and/or containers.
I'm using subgraph
to represent my containers. Node linking works just fine, but I can't figure out how to connect subgraphs.
Given the program below, I need to be able to connect cluster_1
and cluster_2
with an arrow, but anything I've tried creates new nodes instead of connecting the clusters:
digraph G {
graph [fontsize=10 fontname="Verdana"];
node [shape=record fontsize=10 fontname="Verdana"];
subgraph cluster_0 {
node [style=filled];
"Item 1" "Item 2";
label = "Container A";
color=blue;
}
subgraph cluster_1 {
node [style=filled];
"Item 3" "Item 4";
label = "Container B";
color=blue;
}
subgraph cluster_2 {
node [style=filled];
"Item 5" "Item 6";
label = "Container C";
color=blue;
}
// Renders fine
"Item 1" -> "Item 2";
"Item 2" -> "Item 3";
// Both of these create new nodes
cluster_1 -> cluster_2;
"Container A" -> "Container C";
}
fdp
. The linked example, and the one above both work (the last line in the example here needs to use the subgraph names not the label and it might be nice to include line lengths for the graph); it's a little tight as is). – Monroyfdp
v2.28.0 and copy/pasting the source from the example the lines connect to the center of the subgraph, not to the edges. If you open the .dot in OmniGraffle they are properly connected, whileneato
anddot
both create superfluous nodes for the cluster. – Darlinedarling