gpt4 book ai didi

graphviz - 在 GraphViz 中弯曲一些边

转载 作者:行者123 更新时间:2023-12-05 08:43:15 31 4
gpt4 key购买 nike

我想在 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/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com