2016-05-23 59 views
0

的因为正在生成的信息,我结果的方式是这样的:如何限制连接的顶点共享单个边?

digraph "A" { 
    "a1" -> "a2"; 
    "a2" -> "a1"; 
    "a1" -> "a2"; 
    "a2" -> "a1"; 
} 

enter image description here

我宁愿看到是:

digraph "A" { 
    "a1" -> "a2"[dir=both]; 
} 

enter image description here

有没有办法告诉整个有向图合并边,
并尽可能创建双向边缘?

我想保留生成的数据,但添加几行来创建第二个图像。

回答

1

这基本上就是concentrate的用途。

只需将下面的行添加到您的图表,开头或结尾:

concentrate=true 
1

正如已经marapet answerd的答案,你的情况是concentrate。然而,我想在此完整地添加一个稍微不同的问题,这是完全不同的答案。如果只想合并有向边,则可以使用关键字strict

strict digraph "A" { 
    "a1" -> "a2"; 
    "a2" -> "a1"; 
    "a1" -> "a2"; 
    "a2" -> "a1"; 
} 

enter image description here