我试图建立一个可靠的方案,一个程序,作为有向图的点。因此,我使用了以下代码:
digraph LINK {
rankdir=LR;
ranksep=0.65;
nodesep=0.40;
splines=false;
overlap=false;
concentrate=false;
node[shape=box];
subgraph clusterAPP {
label="Application";
style=dashed;
nodeA[label="d = func(...);"];
};
subgraph clusterFB{
color=red;
label="Wrapper";
style=dashed;
rank=same;
wrapper[label="wrapper"];
real[label="pointer to\nreal func"];
wrapper -> real [constraint=false,label="dlopen\ndlsym"];
}
subgraph clusterBACKEND {
label="Backend"
style=dashed;
func[label="float func(...)"];
};
nodeA -> wrapper;
real -> func[weight=10];
func->real[color=blue];
}这会导致

现在的问题是:
real和func之间的egdes重叠。我怎样才能把它们区分开来,使它们易于辨认。wrapper到real的边缘方向是错误的?发布于 2013-10-25 14:34:30
您的第一个问题的答案已经在其他地方给出了,这里是Stackoverflow,归根结底是您可以使用端口位置或者使用臭名昭著的沼泽地所提到的技巧,在相同的方向上添加一个额外的边缘,消除它的约束,反转边缘的方向,隐藏指向后面的边缘。
或者把它写在代码中:
real -> func [weight=10] // Remains unaltered
real -> func [constraint=false, dir=back] // Remove the constraint and reverse the edge
func -> real [style=invis] // Hide the edge pointing pack至于为什么另一个边缘指向错误的方向,这与constraint有关,应该在2.27版本中修复。您可能正在使用旧版本。(我知道我是的,因为很多*NIX包管理器在默认情况下仍然有2.26.X )。
要解决这个问题,您需要手动将Graphviz更新到较新的版本,或者(如果您已经有了更新的版本或不能/不想更新)将dir=back添加到该节点属性中。
把所有的东西组合在一起,结果是:

使用以下DOT代码:
digraph LINK {
rankdir=LR;
ranksep=0.65;
nodesep=0.40;
splines=false;
overlap=false;
concentrate=false;
node[shape=box];
subgraph clusterAPP {
label="Application";
style=dashed;
nodeA[label="d = func(...);"];
};
subgraph clusterFB{
color=red;
label="Wrapper";
style=dashed;
rank=same;
wrapper[label="wrapper"];
real[label="pointer to\nreal func"];
}
subgraph clusterBACKEND {
label="Backend"
style=dashed;
func[label="float func(...)"];
};
nodeA -> wrapper;
wrapper -> real [constraint=false, dir=back, label="dlopen\ndlsym"]; // Added reverse direction
real -> func [weight=10] // Remains unaltered
real -> func [constraint=false, dir=back] // Remove the constraint and reverse the edge
func -> real [style=invis] // Hide the edge pointing pack
}https://stackoverflow.com/questions/19492136
复制相似问题