移开Graphviz边缘 [英] Moving Graphviz edge out of the way

查看:87
本文介绍了移开Graphviz边缘的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在此图中:

使用Graphviz/Dot渲染时,红色边缘连接两个节点,而其他边缘连接节点内部的端口.节点具有HTML标签,输入和输出的TD具有PORT属性.

Rendered using Graphviz/Dot, the red edge connects two nodes, whereas the other edges connect ports inside the nodes. The nodes have HTML labels, and the TDs for the inputs and outputs have a PORT attribute.

有没有一种方法可以使点移开"红色节点,即向左或向右移动红色节点(可能是弯曲的),以使其不会越过黑色边缘.

Is there a way to make Dot move the red node "out of the way", that is to the left or to the right, possibly curved, so that it does not go over the black edges.

这是针对自动生成的图,该图可以包含两个以上的节点,不一定全部垂直对齐.

It is for an automatically generated graph that can contain more than two nodes, not necessarily all vertically aligned.

该图的源代码:

digraph G {
rankdir=TB
src [shape=plaintext label=<<TABLE BORDER="0" CELLBORDER="0" CELLSPACING="0" CELLPADDING="0"><TR><TD BORDER="0"><TABLE BORDER="0" CELLBORDER="0" CELLSPACING="0" CELLPADDING="0"><TR><TD WIDTH="20"></TD><TD PORT="in1" BORDER="1" CELLPADDING="1"><FONT POINT-SIZE="10">in1</FONT></TD><TD WIDTH="10"></TD><TD PORT="in2" BORDER="1" CELLPADDING="1"><FONT POINT-SIZE="10">in2</FONT></TD><TD WIDTH="10"></TD><TD PORT="in3" BORDER="1" CELLPADDING="1"><FONT POINT-SIZE="10">in3</FONT></TD><TD WIDTH="20"></TD></TR></TABLE></TD></TR><TR><TD BORDER="1" STYLE="ROUNDED" CELLPADDING="4" COLOR="black">A<BR/><FONT POINT-SIZE="10">node</FONT></TD></TR><TR><TD BORDER="0"><TABLE BORDER="0" CELLBORDER="0" CELLSPACING="0" CELLPADDING="0"><TR><TD WIDTH="20"></TD><TD PORT="out1" BORDER="1" CELLPADDING="1"><FONT POINT-SIZE="10">out1</FONT></TD><TD WIDTH="10"></TD><TD PORT="out2" BORDER="1" CELLPADDING="1"><FONT POINT-SIZE="10">out2</FONT></TD><TD WIDTH="20"></TD></TR></TABLE></TD></TR></TABLE>>];


rankdir=TB
snk [shape=plaintext label=<<TABLE BORDER="0" CELLBORDER="0" CELLSPACING="0" CELLPADDING="0"><TR><TD BORDER="0"><TABLE BORDER="0" CELLBORDER="0" CELLSPACING="0" CELLPADDING="0"><TR><TD WIDTH="20"></TD><TD PORT="in1" BORDER="1" CELLPADDING="1"><FONT POINT-SIZE="10">in1</FONT></TD><TD WIDTH="10"></TD><TD PORT="in2" BORDER="1" CELLPADDING="1"><FONT POINT-SIZE="10">in2</FONT></TD><TD WIDTH="10"></TD><TD PORT="in3" BORDER="1" CELLPADDING="1"><FONT POINT-SIZE="10">in3</FONT></TD><TD WIDTH="20"></TD></TR></TABLE></TD></TR><TR><TD BORDER="1" STYLE="ROUNDED" CELLPADDING="4" COLOR="black">B<BR/><FONT POINT-SIZE="10">node</FONT></TD></TR><TR><TD BORDER="0"><TABLE BORDER="0" CELLBORDER="0" CELLSPACING="0" CELLPADDING="0"><TR><TD WIDTH="20"></TD><TD PORT="out1" BORDER="1" CELLPADDING="1"><FONT POINT-SIZE="10">out1</FONT></TD><TD WIDTH="10"></TD><TD PORT="out2" BORDER="1" CELLPADDING="1"><FONT POINT-SIZE="10">out2</FONT></TD><TD WIDTH="20"></TD></TR></TABLE></TD></TR></TABLE>>];

    snk -> src [style="", arrowhead="vee", color=red, headlabel=<>, fontsize=10, labelangle=45, labeldistance=2.0, labelfontcolor=black];

    src:out1 -> snk:in1 [style="", arrowhead="normal", color=black, headlabel=<>, fontsize=10, labelangle=45, labeldistance=2.0, labelfontcolor=black];
    src:out1 -> snk:in2 [style="", arrowhead="normal", color=black, headlabel=<>, fontsize=10, labelangle=45, labeldistance=2.0, labelfontcolor=black];
    src:out2 -> snk:in3 [style="", arrowhead="normal", color=black, headlabel=<>, fontsize=10, labelangle=45, labeldistance=2.0, labelfontcolor=black];

    {rank=source; src}
    {rank=sink; snk}

}

推荐答案

您可以在边缘定义中添加罗盘点:

You could add compass points to your edge definition:

snk:se -> src:ne

snk:e -> src:e

向右箭头,或

snk:sw -> src:nw

snk:w -> src:w

获取左侧的箭头.

当然,我不确定在有多个未对齐的节点时这是否可行.

Of course, I'm not sure whether this would work when there are several nodes which are not aligned.

这篇关于移开Graphviz边缘的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆