graphviz - 让 GraphViz 消除相同的重复边

标签 graphviz

我有以下 GraphViz .dot 语言文件:

digraph {
    graph [ dpi = 300 ];
    Hello -> World
    Hello -> World
    Hello -> World
}

呈现为:

enter image description here

代码是以编程方式生成的,因此存在重复。

但我不想要重复的链接,即我希望它呈现为:

enter image description here

是的,我可以向生成点文件的程序添加逻辑,但如果有 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/

相关文章:

c - 如何在linux中添加graphviz库?

python - Graphviz 与 PyGraphViz

python - 如何绘制双色边缘?

graphviz - 如何让graphviz记录具有排列的单元格

graphviz - 使用 x->y->z 表示法指定关系时如何添加标签?

java - 图形可视化与 Java

keras - 导入错误:导入 pydot 失败。您必须安装 pydot 和 graphviz 才能使 `pydotprint` 正常工作

graphviz - 如何在Graphviz点文件中插入希腊字符等数学符号?

emacs - Org Babel 不会为点源加载 Graphviz 编辑模式

graphviz - 如何使用neato处理密集连接图