我想生成这样的东西 - 节点的对齐是重要的事情,而不是边缘的角度:
+--------------+
| |
+--------------+
| |
V V
+-----+ +-----+ <--- alignment at top
| | | |
| |->| |
| | | |
+-----+ | |
| | |
V | |
+-----+ | |
| | | |
| |->| |
| | | |
+-----+ +-----+ <--- alignment at bottom
| |
V V
+--------------+
| |
+--------------+
我能想到的最好办法是将两个左节点粘贴到一个带有白色(=>不可见)边框的簇子图中,并将其中一条边的权重设置为0。但它仍然不太正确:
digraph G {
// scale things down for example
size="5,5"
rankdir=TD
ranksep=1
nodesep=1
node [shape=box]
node [width=5 height=2]
top
subgraph cluster_left
{
color=white
node [width=2 height=2]
left1
left2
}
node [width=2 height=5]
right
node [width=5 height=2]
bottom
top->left1
top->right
left1->left2
left1->right
left2->right [weight=0]
left2->bottom
right->bottom
}
结果是这样的 - 对齐不良:
关于如何获得我想要的东西有什么想法吗?
我用 neato 和这个脚本做到了:
digraph G {
layout="neato"
// scale things down for example
size="5,5"
rankdir=TD
ranksep=1
nodesep=1
node [shape=box]
top[pos="5,10!", width=5, height=2]
left1[pos="3.5,7!", width=2, height=2]
left2[pos="3.5,4!", width=2, height=2]
right[pos="6.5,5.5!", width=2, height=5]
bottom[pos="5,1!", width=5, height=2]
top->left1
top->right
left1->left2
left1->right
left2->right
left2->bottom
right->bottom
}
结果如下:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)