graphviz: subgraph has same node, how to unique

妖精的绣舞 提交于 2019-12-10 12:56:47

问题


I create dot file by my perl script. here is subgraphs which contains same node. eg:

subgraph{aa->bb->cc;}

subgraph{dd->bb->ee;}

I know those subgraph use same namespace, so my result output is a mess.

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

subgraph{aa->bb->cc; bb_1->dd;}

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

please help. if here is some methods to make each subgraph "strict" or use different namespace?


回答1:


The label presented for a node is only related to the name of the node if it is not overridden by an explicit references.

For example, you can use "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 id of each node to identify it so that you can then reuse the same label in many locations.




回答2:


gvpack will automatically rename nodes that are in clusters if you use it to put multiple sub-graphs into one graph. See Graph of Graphs in Graphviz for an example.



来源:https://stackoverflow.com/questions/18329226/graphviz-subgraph-has-same-node-how-to-unique

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!