如何在点文件node_id中使用特殊字符? [英] How do I use special characters in a dot file node_id?
问题描述
我期待编写一个脚本,该脚本将自动从文件中获取输入并声明节点和边,并生成可在任何可视化软件中可视化的图形.
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.
我尝试了点语言和graphViz.
这种语言使用的语法清楚地声明了图的节点,如下所示:node1;
,node2;
,并且除了_
之外,不允许任何特殊字符.
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 _
.
在所有情况下它都能很好地工作,但是当我要声明一个名为java.lang.object
的节点时,由于.
的存在,它显示出语法错误,并且我无法更改其语法.
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.
推荐答案
在graphviz中,这实际上很容易做到,只需在节点名称周围加上一些引号即可.或者,您可以首先使用简单的标识符和label
属性来定义您的节点.
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;
}
这篇关于如何在点文件node_id中使用特殊字符?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!