GraphViz:如何将节点连接到包含的子图
我刚从Stackoverflow中学到的。但是,我想将节点连接到包含的子图:GraphViz:如何将节点连接到包含的子图,graphviz,dot,subgraph,Graphviz,Dot,Subgraph,我刚从Stackoverflow中学到的。但是,我想将节点连接到包含的子图: digraph G { compound=true; subgraph cluster0 { a -> b; a -> c; c -> {a b c} [lhead=cluster0]; } c -> d; d -> {a b c} [lhead=cluster0]; } 快速概述我的意思: 我想连
digraph G {
compound=true;
subgraph cluster0 {
a -> b;
a -> c;
c -> {a b c} [lhead=cluster0];
}
c -> d;
d -> {a b c} [lhead=cluster0];
}
快速概述我的意思:
我想连接d->{abc}
,但为了清楚起见,我不想画三个不同的箭头,只想画一个指向节点分组的箭头。一种方法是只列出一个箭头,如d->a
。这是可行的,但是当头部指向一个簇时,有没有办法将三个箭头“折叠”为一个
但是,
c->{abc}
不可能指向集群,因为c
是该集群的一部分。有办法解决这个问题吗?您需要一些脚手架,即不可见节点(可能还有边缘),例如:
在viz-js.com上呈现:
digraph top {
compound=true
node[shape=rectangle]
subgraph cluster1 {
a->{b c}
}
c->d
d->b[lhead=cluster1]
ca[shape=point height=0] // make ca invisible
a->ca:n[dir=back ltail=cluster1] // by drawing the arrow backward we get more control of the layout, n and s compass make the edge go smooth when enter and exiting ca
ca:s->c[dir=none] // no arrow on the tail part
}