如何只写一次长标签,并在图形中使用对它们的引用?

问题描述

我在节点上有一些标签。由于节点是相互连接的(当然),因此完全相同的标签会出现在多个位置,每次我需要编辑其中一个标签时,都必须多次手动更改它们,这就是耗时且容易出错(或复制一次,然后查找并替换;这只会稍微减少烦人的事情)。

所以,不要像这样:

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并设置适当的标签,如:

@AttributeOverride