graphviz - 在 GraphViz 中弯曲一些边

标签 graphviz

我想在 GraphViz 中绘制 Chimera 类型的图形: https://www.ibm.com/developerworks/community/blogs/jfp/resource/BLOGS_UPLOADED_IMAGES/chimera.png

因此特定节点之间有一些直边,但也有弯曲边,并且节点是固定的。我已经确定了我想要在其间具有弯曲边缘的所有节点,但我无法使这些边缘正确弯曲。

graph G {
size = 5
0 [shape = circle, pin=true, pos="1,4!"]; 1 [shape = circle, pin=true, pos="2,4!"]; 2 [shape = circle, pin=true, pos="3,4!"]; 3 [shap\
e = circle, pin=true, pos="4,4!"]; 4 [shape = circle, pin=true, pos="1,3!"]; 5 [shape = circle, pin=true, pos="2,3!"]; 6 [shape = cir\
cle, pin=true, pos="3,3!"]; 7 [shape = circle, pin=true, pos="4,3!"]; 8 [shape = circle, pin=true, pos="1,2!"]; 9 [shape = circle, pi\
n=true, pos="2,2!"]; 10 [shape = circle, pin=true, pos="3,2!"]; 11 [shape = circle, pin=true, pos="4,2!"]; 12 [shape = circle, pin=tr\
ue, pos="1,1!"]; 13 [shape = circle, pin=true, pos="2,1!"]; 14 [shape = circle, pin=true, pos="3,1!"]; 15 [shape = circle, pin=true, \
pos="4,1!"];
0--1; 0--5; 0--9; 0--13; 1--3 [splines = "curved"]; 2--3; 2--7; 2--11; 2--15; 4--1; 4--5; 4--9; 4--13; 5--7 [splines = "curved"]; 6--3; 6\
--7; 6--11; 6--15; 8--1; 8--5; 8--9; 8--13; 9--11 [splines = "curved"]; 10--3; 10--7; 10--11; 10--15; 12--1; 12--5; 12--9; 12--13; 13--\
15 [splines = "curved"]; 14--3; 14--7; 14--11; 14--15;
}

上面是我的点文件。 (我使用“neato -Tps graph.dot -o graph.ps”绘制它)。

我认为您可以通过将 splines = "curved"作为图形属性来全局弯曲边缘,但我想单独弯曲某些边缘,或者至少没有我目前拥有的所有疯狂重叠。

最佳答案

我把你的代码改成了

graph G {
  size = 5
  node [shape = circle, pin=true ]

   0 [ pos="1,4!" ]; 
   1 [ pos="2,4!" ]; 
   2 [ pos="3,4!" ]; 
   3 [ pos="4,4!"]; 
   4 [ pos="1,3!"]; 
   5 [ pos="2,3!"]; 
   6 [ pos="3,3!"]; 
   7 [ pos="4,3!"]; 
   8 [ pos="1,2!"]; 
   9 [ pos="2,2!"]; 
  10 [ pos="3,2!"]; 
  11 [ pos="4,2!"]; 
  12 [ pos="1,1!"]; 
  13 [ pos="2,1!"]; 
  14 [ pos="3,1!"]; 
  15 [ pos="4,1!"];

  0 -- { 1, 5, 9, 13 }
  1 -- 3 ; 
  2 -- { 3, 7, 11 15 }
  4 -- {1, 5, 9, 13 } 
  5 -- 7;
  6 -- { 3, 7, 11, 15 }
  8 -- { 1, 5, 9, 13 } 
  9 -- 11; 
  10 -- { 3, 7, 11, 15 } 
  12 -- { 1, 5, 9, 13 }
  13 -- 15; 
  14 -- { 3, 7, 11, 15 }
}

并用

编译
neato -Tpng -Gsplines=true so.gv -o so.png

得到了

enter image description here

这更接近您想要的吗?

关于graphviz - 在 GraphViz 中弯曲一些边,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32432818/

相关文章:

python - 删除/修改 graphviz 中的边

rotation - Graphviz:如何旋转节点(或子图)?

graphviz - 如何在 GraphViz 中为基于记录的节点的端口设置样式?

python - 从 C 生成 Python 脚本时的 graphviz 问题

python-3.x - 如何使用 graphviz 通过 networkx 获取图形坐标(布局)?

点 (graphviz) 语言中节点标签中的换行符

graphviz - 具有多个边(从不同节点)到具有相同标签的一个节点的简写

layout - 如何使表示二叉树的点图更对称?

graphviz - 一个点文件中的多个图形和方向(rankdir)(gvpack 没有做我想要的事情)

Graphviz:如何减少节点的顶部和底部边距?