在GraphViz中弯曲一些边
我想在GraphViz中绘制一个嵌合体类型的图形: 所以在特定的节点之间有一些直边,但也有曲线边,并且节点是固定的。我已经确定了所有的节点,我想在它们之间有弯曲的边,但是我不能让这些边正确地弯曲在GraphViz中弯曲一些边,graphviz,Graphviz,我想在GraphViz中绘制一个嵌合体类型的图形: 所以在特定的节点之间有一些直边,但也有曲线边,并且节点是固定的。我已经确定了所有的节点,我想在它们之间有弯曲的边,但是我不能让这些边正确地弯曲 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 [sha
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”绘制它)
我认为您可以通过将spline=“curve”作为图形属性来全局曲线化边,但我想单独曲线化某些边,或者至少不需要像我现在这样疯狂地重叠。我将您的代码更改为
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
得到
这更接近你想要的吗?我将你的代码改为
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
得到
这与您想要的更接近吗?刚刚尝试了Spline=“Curve”,它在全球范围内有效,但我认为部分幸运的是,并不是每条边都变成了曲线(嵌合体图中的直边很短,可能如果它们更长,它们就不会保持直边)。我的问题是,在一般情况下,如何保持某些边笔直,而其他边弯曲仍然有效。只是在全局范围内尝试了Spline=“Curve”,它起了作用,但我认为部分幸运的是,并不是每条边都弯曲了(嵌合体图中的直边很短,可能如果它们更长,它们就不会保持笔直)。我的问题是,在一般情况下,如何使某些边保持笔直,而其他边保持弯曲。