我有以下 GraphViz .dot 语言文件:
digraph {
graph [ dpi = 300 ];
Hello -> World
Hello -> World
Hello -> World
}
呈现为:
代码是以编程方式生成的,因此存在重复。
但我不想要重复的链接,即我希望它呈现为:
是的,我可以向生成点文件的程序添加逻辑,但如果有 GraphViz 参数来执行此操作,那就非常有用。
谢谢。
编辑:在这里复活死者,但是将其标记为重复的问题在两个节点之间有多个连接,但每个连接都有不同的标签,因此不完全相同,尽管建议使用“strict”关键字工作。
编辑:再次投票重新开放,因为有人认为这是重复的问题实际上是一个不同的问题。这是关于重复边缘的问题,而其他问题则不是。事实上,相同的答案是否有效是无关紧要的,就像“什么是 2+2?”一样。以及“3+1是什么?”尽管答案相同,但问题不同。
最佳答案
答案是“严格”:
strict digraph {
graph [ dpi = 300 ];
Hello -> World
Hello -> World
Hello -> World
}
编辑:
来自https://graphviz.org/doc/info/lang.html :
A graph may also be described as strict. This forbids the creation of multi-edges, i.e., there can be at most one edge with a given tail node and head node in the directed case. For undirected graphs, there can be at most one edge connected to the same two nodes. Subsequent edge statements using the same two nodes will identify the edge with the previously defined one and apply any attributes given in the edge statement.
关于graphviz - 让 GraphViz 消除相同的重复边,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48266439/