gpt4 book ai didi

graphviz - 远离 DOT 中的节点路由边缘?

转载 作者:行者123 更新时间:2023-12-01 11:44:10 25 4
gpt4 key购买 nike

我正在使用 DOT 生成如下所示的有向图。我希望所有边都有一个南尾口和一个北头口,这样所有边都从节点的底部开始并进入节点的顶部。

正如您从左侧图像中看到的那样,从节点 2 到节点 4 和节点 6 的边缘沿着节点的侧面笔直向上,看起来不太好,我希望布局会路由边缘远离节点(就像我右边的图像)

如何让边远离节点?

示例图:

enter image description here

我的上图 DOT 文件如下:

digraph g {
graph [
center=true,
nodesep=1.2,
ranksep="1.2 equally",
sep=6.2,
splines=polyline
];
node [label="\N"];
0 [area=2,
fixedsize=true,
height=0.69444,
label=0,
margin=1.2,
shape=box,
width=1.3889];
1 [area=2,
fixedsize=true,
height=1.3889,
label=1,
margin=1.2,
shape=box,
width=1.3889];
0:s -> 1:n;
2 [area=2,
fixedsize=true,
height=1.3889,
label=2,
margin=1.2,
shape=box,
color="blue",
width=1.3889];
0:s -> 2:n;
3 [area=2,
fixedsize=true,
height=0.69444,
label=3,
margin=1.2,
shape=box,
width=1.3889];
0:s -> 3:n;
4 [area=2,
fixedsize=true,
height=0.69444,
label=4,
margin=1.2,
shape=box,
color="red",
width=1.3889];
1:s -> 4:n;
2:s -> 4:n;
6 [area=2,
fixedsize=true,
height=1.3889,
label=6,
margin=1.2,
shape=box,
color="red",
width=1.3889];
2:s -> 6:n;
5 [area=2,
fixedsize=true,
height=0.69444,
label=5,
margin=1.2,
shape=box,
width=1.3889];
4:s -> 5:n;
4:s -> 6:n;
7 [area=2,
fixedsize=true,
height=0.69444,
label=7,
margin=1.2,
shape=box,
width=1.3889];
5:s -> 7:n;
6:s -> 7:n;
6:s -> 2:n;
7:s -> 7:n;
8 [area=2,
fixedsize=true,
height=0.69444,
label=8,
margin=1.2,
shape=box,
width=1.3889];
7:s -> 8:n;
}

最佳答案

我能够使用 spines=spline 在节点和边缘线之间获得您想要的分离,但它使边缘线弯曲而不是直线。

graph [
center=true,
nodesep=1.2,
ranksep="1.2 equally",
sep=6.2,
splines=spline
];

enter image description here

关于graphviz - 远离 DOT 中的节点路由边缘?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16982158/

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