GraphViz中节点ID有什么限制?
What are the restrictions of node ID in GraphViz?
例如,如果我对节点使用 ID 1a
和 2.2.2
,结果如下:
这是如何运作的?节点名称还有哪些其他限制?我看Attributes | Graphviz但没有解释。
我可以做这样的事情吗?
0 -> {1a, 1b, 2, 3}
1b -> 2
1b.1 -> {1b.1.1}
1b.1.1 -> {1b.1.1.1, 1b.1.1.3}
1b.2 -> {1b.2.1, 1b.2.2}
1b.2.2 -> {1b.2.2.1, 1b.2.2.2}
2 -> 2.1
3
根据 DOT language documentation,您应该为节点 ID 使用引号:
An ID is one of the following:
- Any string of alphabetic ([a-zA-Z0-7]) characters, underscores
('_') or digits([0-9]), not beginning with a digit;
- a numeral [-]?(.[0-9]⁺ | [0-9]⁺(.[0-9]*)? );
- any double-quoted string ("...") possibly containing escaped quotes (")¹;
- an HTML string (<...>).
ID只是一个字符串;前两个缺少引号字符
表格只是为了简单起见。之间没有语义差异
abc_2 和“abc_2”,或介于 2.34 和“2.34”之间。
因此,对于您的示例,它将按如下方式工作:
digraph example {
"0" -> {"1a", "1b", "2", "3"}
"1b" -> "2"
"1b.1" -> {"1b.1.1"}
"1b.1.1" -> {"1b.1.1.1", "1b.1.1.3"}
"1b.2" -> {"1b.2.1", "1b.2.2"}
"1b.2.2" -> {"1b.2.2.1", "1b.2.2.2"}
"2" -> "2.1"
"3"
}
例如,如果我对节点使用 ID 1a
和 2.2.2
,结果如下:
这是如何运作的?节点名称还有哪些其他限制?我看Attributes | Graphviz但没有解释。
我可以做这样的事情吗?
0 -> {1a, 1b, 2, 3}
1b -> 2
1b.1 -> {1b.1.1}
1b.1.1 -> {1b.1.1.1, 1b.1.1.3}
1b.2 -> {1b.2.1, 1b.2.2}
1b.2.2 -> {1b.2.2.1, 1b.2.2.2}
2 -> 2.1
3
根据 DOT language documentation,您应该为节点 ID 使用引号:
An ID is one of the following:
- Any string of alphabetic ([a-zA-Z0-7]) characters, underscores ('_') or digits([0-9]), not beginning with a digit;
- a numeral [-]?(.[0-9]⁺ | [0-9]⁺(.[0-9]*)? );
- any double-quoted string ("...") possibly containing escaped quotes (")¹;
- an HTML string (<...>).
ID只是一个字符串;前两个缺少引号字符 表格只是为了简单起见。之间没有语义差异 abc_2 和“abc_2”,或介于 2.34 和“2.34”之间。
因此,对于您的示例,它将按如下方式工作:
digraph example {
"0" -> {"1a", "1b", "2", "3"}
"1b" -> "2"
"1b.1" -> {"1b.1.1"}
"1b.1.1" -> {"1b.1.1.1", "1b.1.1.3"}
"1b.2" -> {"1b.2.1", "1b.2.2"}
"1b.2.2" -> {"1b.2.2.1", "1b.2.2.2"}
"2" -> "2.1"
"3"
}