如何只写一次长标签,并在图中使用对它们的引用?
How to write long labels just once, and use references to them in the graph?
我在节点上有一些长标签。由于节点是相互连接的(当然),因此在多个地方出现完全相同的标签,每次我需要编辑其中一个时,我必须手动多次更改它们,这既费时又容易出错(或者复制一次,然后查找+替换;这只是稍微不那么烦人)。
所以,不是这样的:
digraph {
"Some very long label" -> "Another label with elaborate text"
"Some very long label" -> "Red blue green yellow"
"Another label with elaborate text" -> "Blah bleh bleh blah"
"Blah bleh bleh blah" -> "Sooo annoying! Really!"
}
我想做这样的事情(编造的语法):
digraph {
// Structure:
#A -> #B
#A -> #C
#B -> #C
#B -> #D
#D -> #E
// Label definitions:
#A: "Some very long label"
#B: "Another label with elaborate text"
#C: "Red blue green yellow"
#D: "Blah bleh bleh blah"
#E: "Sooo annoying! Really!"
}
这可能吗?
我认为你走的很好,只是语法错误。如何为节点使用 id 并设置适当的标签,如:
digraph G{
N1 [label="Some very long label"]
N2 [label="Another label with elaborate text"]
N3 [label="Red blue green yellow"]
N4 [label="Blah bleh bleh blah"]
N5 [label="Sooo annoying! Really!"]
N1 -> N3
N2 -> N4
N1 -> N2
N4 -> N5
}
我在节点上有一些长标签。由于节点是相互连接的(当然),因此在多个地方出现完全相同的标签,每次我需要编辑其中一个时,我必须手动多次更改它们,这既费时又容易出错(或者复制一次,然后查找+替换;这只是稍微不那么烦人)。
所以,不是这样的:
digraph {
"Some very long label" -> "Another label with elaborate text"
"Some very long label" -> "Red blue green yellow"
"Another label with elaborate text" -> "Blah bleh bleh blah"
"Blah bleh bleh blah" -> "Sooo annoying! Really!"
}
我想做这样的事情(编造的语法):
digraph {
// Structure:
#A -> #B
#A -> #C
#B -> #C
#B -> #D
#D -> #E
// Label definitions:
#A: "Some very long label"
#B: "Another label with elaborate text"
#C: "Red blue green yellow"
#D: "Blah bleh bleh blah"
#E: "Sooo annoying! Really!"
}
这可能吗?
我认为你走的很好,只是语法错误。如何为节点使用 id 并设置适当的标签,如:
digraph G{
N1 [label="Some very long label"]
N2 [label="Another label with elaborate text"]
N3 [label="Red blue green yellow"]
N4 [label="Blah bleh bleh blah"]
N5 [label="Sooo annoying! Really!"]
N1 -> N3
N2 -> N4
N1 -> N2
N4 -> N5
}