Graphviz: a subgraph has the same node as unique

I am creating a dot file with my perl script. here are the subgraphs that contain the same node. eg:

subgraph {AA-> BB-> cc;}

subgraph {dd-> BB-> hey;}

I know that these subgraphs use the same namespace, so the output of my result is a mess.

In each subgraph, I can make them unique, for example bb and bb_1 below,

subgraph {AA-> BB-> cc; bb_1-> dd;}

but it's hard to make all node in all subgraphs unique.

please, help. if there are some ways to make each subgraph "strict" or use a different namespace?

+4
source share
2 answers

The label provided for a node is associated only with the name node, unless overridden by explicit references.

For example, you can use "45" [label = "bb"]; "53" [label = "bb"]; "45" [label = "bb"]; "53" [label = "bb"]; to represent two nodes that have the same label.

Then

 subgraph{aa->"45"->cc;} subgraph{dd->"53"->ee;} 

will use the internal identifier of each node to identify it so that you can reuse the same label in many places.

+5
source

gvpack will automatically rename nodes that are in clusters if you use it to place multiple subgraphs in the same graph. See Graph Graphs in Graphviz for an example.

+1
source

Source: https://habr.com/ru/post/1497936/


All Articles