首页 > 解决方案 > 添加边缘中断graphviz点布局

问题描述

我正在尝试在 graphviz dot 中制作一个垂直方向的流程图。我是这种格式的新手,所以请放轻松。我的布局 99% 正确,但是当我添加最后一条边 ( data -> h) 时它会中断。我注意到如果我添加最后的边缘,但删除“是”标签,格式也是正确的。我把它归结为一个简单的例子,它仍然显示出不受欢迎的行为。

我的问题:我怎样才能保持我想要的垂直格式,保持data -> h边缘,并保持“是”标签。

理想,但缺少最终优势:

理想缺失边缘

破碎的,最后的data -> h边缘:

在此处输入图像描述

理想,具有最终data -> h边缘,但删除了“是”标签:

在此处输入图像描述

digraph G {

a [
label = "a";
shape = diamond;
];

b [
label = "b";
shape = rect;
];

makedata [
label = "makedata";
shape = rect;
];

data [
label = "data";
shape = box3d;
]

filldata [
label = "filldata";
shape = rect;
]

num [
label = "num"
shape = box3d;
]

num2 [
label = "num2"
shape = box3d;
]

prepdata [
label="prepdata"
shape=rect;
]

prepdata2 [
label="prepdata2"
shape=rect;
]

lorem [
label="lorem_ipsum_dolor_sit"
shape="rect"
]

lorem2 [
label="lorem_ipsum_dolor_sit"
shape="rect"
]

h [
label="h"
shape="rect"
]

{
rank=same;
filldata;data
}

{
rank=same;
num2;prepdata2
}

// if data -> h is included, and this label is removed, formatting is also correct
a:s -> b [label="Yes"]
b -> makedata
makedata:e -> data:w
makedata -> filldata [weight=99]
filldata:e -> data:w
filldata->prepdata  [weight=99]
data -> prepdata
data -> prepdata2
data -> lorem:ne
prepdata -> lorem:n  [weight=99]
lorem -> prepdata2  [weight=99]
num:e->prepdata:w 
num2:e->prepdata2:w [weight=99]
prepdata2:s -> lorem2:n [weight=99]
data -> lorem2
lorem2 -> h  [weight=99]
// data -> h  # the problem

}

标签: graphvizdot

解决方案


争吵的边缘有时是一个偶然的命题。改变你的边缘以终止于 h:ne(h 的东北角),如下所示:

data -> h:ne

你得到: 在此处输入图像描述


推荐阅读