在GraphViz中将多个短节点与单个高节点并行排列 [英] Lining up multiple short nodes in parallel with a single tall node in GraphViz
本文介绍了在GraphViz中将多个短节点与单个高节点并行排列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想生成这样的东西-节点的对齐是重要的,而不是边缘的角度:
I want to generate something like this - the alignment of the nodes is the important thing, not the angle of the edges:
+--------------+
| |
+--------------+
| |
V V
+-----+ +-----+ <--- alignment at top
| | | |
| |->| |
| | | |
+-----+ | |
| | |
V | |
+-----+ | |
| | | |
| |->| |
| | | |
+-----+ +-----+ <--- alignment at bottom
| |
V V
+--------------+
| |
+--------------+
我能想到的最好的办法是将两个左节点粘贴到带有白色(=>不可见)边框的聚类子图中,并将其中一条边的权重设置为0.但是它仍然是不太正确:
The best I've been able to come up with is to stick the two left nodes into a cluster subgraph with a white (=> invisible) border, and set the weight of one of the edges to 0. But it's still not quite right:
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
}
结果是这样-对齐不良:
This comes out like this - poorly aligned:
关于如何获得我想要的东西的任何想法吗?
Any ideas on how to get what I want?
推荐答案
我使用neato和以下脚本完成了此操作:
I did it with neato and this script :
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
}
这是结果:
这篇关于在GraphViz中将多个短节点与单个高节点并行排列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文