我希望边缘从一个子图指向另一个子图,而不是从一个节点指向子图。
此外,我可以控制边缘的长度吗?
digraph G {
compound=true;
node[shape=box];
subgraph cluster0 {
color=blue;
label="Top";
a;
}
subgraph cluster1 {
color=magenta;
label="Middle";
b;
}
subgraph cluster2 {
color=green;
label="Bottom";
c;
}
a -> b[dir=back,ltail=cluster2,lhead=cluster1]
b -> c[dir=back,ltail=cluster1,lhead=cluster0]
}
答案 0 :(得分:1)
您必须确保ltail
和lhead
的位置正确无误:
digraph G
{
compound=true;
node[ shape=box ];
edge[ minlen = 2 ];
subgraph cluster0
{
color = blue;
label = "Top";
a;
}
subgraph cluster1
{
color = magenta;
label = "Middle";
b;
}
subgraph cluster2
{
color = green;
label = "Bottom";
c;
}
// here:
a -> b[ dir = back, lhead = cluster1, ltail = cluster0 ]
b -> c[ dir = back, lhead = cluster2, ltail = cluster1 ]
}
产量