我有两个重叠边缘,不知道原因:
digraph G {
graph [rankdir=LR, overlap=false];
subgraph cluster1 {
d1;
n1;
}
subgraph cluster2 {
n2;
d2;
}
n1 -> n2;
n2 -> n1;
d0 -> d1;
d0 -> d2;
}
有没有办法分别显示边n1 -> n2
和n2 -> n1
?删除群集不是一种选择,但会有所帮助......
答案 0 :(得分:4)
使用portPos修饰符的解决方案:
digraph G {
graph [rankdir=LR, overlap=false];
subgraph cluster1 {
d1;
n1;
}
subgraph cluster2 {
n2;
d2;
}
n1:sw -> n2:nw;
n2:ne -> n1:se;
d0 -> d1;
d0 -> d2;
}
另一种解决方案是使用dir和color修饰符:
digraph G {
graph [rankdir=LR, overlap=false];
subgraph cluster1 {
d1;
n1;
}
subgraph cluster2 {
n2;
d2;
}
n2 -> n1[dir=both color="red:blue"];
d0 -> d1;
d0 -> d2;
}
如果您想要保持黑白着色方案,甚至可以使用color="black:black"
。
答案 1 :(得分:3)
试错法解决方案(不要问我为什么这样做......):
digraph G {
graph [rankdir=LR, overlap=false];
subgraph cluster1 {
d1;
n1;
}
subgraph cluster2 {
n2;
d2;
}
n1 -> n2;
n1 -> n2[constraint=false, dir=back];
n2 -> n1[style=invis];
d0 -> d1;
d0 -> d2;
}