How do I use special characters in a dot file node_id?

自作多情 提交于 2019-12-07 10:31:33

问题


I am looking forward to write a script that will automatically take input from a file and declare the nodes and edges, and produce a graph that can be visualized in any visualization software.

I tried dot language and graphViz. This language uses grammar which clearly declare the nodes of the graph like this: node1;, node2; and does not allow any special character except _.

It works well in all the cases but when I want to declare a node named java.lang.object it shows grammatical error because of presence of . and I can't change its grammar.

Can anyone help me by suggestion some other language which can take input from text file and can draw a graph on any visualization software.


回答1:


That's actually quite easy to do in graphviz, simply put some quotes around the node names. Or you may define first your node using a simple identifier and a label attribute.

Both techniques demonstrated here:

digraph g {
  "java.lang.object" -> "my.class";
  "my.class" -> "special < chars >";
  n1 [label="more.strange<node>names"];
  "special < chars >" -> n1;
}


来源:https://stackoverflow.com/questions/18444406/how-do-i-use-special-characters-in-a-dot-file-node-id

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