In graphviz: can I have node identifiers that are unique only in clusters?

I understand that node identifiers must be unique in the graphviz file (here: dot).

However, I would like them to be unique only within their cluster, that is, I would like the following file to create 4 nodes:

digraph G { subgraph cluster_clust_one { node [shape=record]; a [label = "A / 1"]; b [label = "B / 1"]; a -> b; } subgraph cluster_clust_two { node [shape=record]; a [label = "A / 2"]; b [label = "B / 2"]; a -> b; } } 

However, this is not so because node identifiers are not unique. Obviously, I can solve this by assigning unique identifiers, for example, changing cluster_clust_two to

  subgraph cluster_clust_two { node [shape=record]; c [label = "A / 2"]; d [label = "B / 2"]; c -> d; } 

Unfortunately, this will entail changing a script that creates point files that I would not want to do if I were not absolutely necessary. Therefore, if there is a flag or something that I could set instead, I would prefer this route.

+4
source share
2 answers

You can add the name node with the name of the cluster, for example cluster_clust_two__a . This would still mean a change in the generation of the script.

+3
source

As far as I know, there is no way to have separate nodes with identical identifiers. A reasonable workaround was suggested by dgw =)

+2
source

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


All Articles