Graphviz 中从左上到右下的树
Top-left to bottom-right tree in Graphviz
假设我从这个开始:
graph {
graph [splines=ortho]
node [fontname="Sans-Serif" shape=record]
rankdir=LR
"Parent" -- "Child 1"
"Parent" -- "Child 2"
"Parent" -- "Child 3"
"Parent" -- "Child 4 and then some"
}
这产生:
我需要更改什么才能得到这个(以及后续级别)?
谢谢!
出乎意料的困难。 Ortho 替换为 DIY 类 ortho-like 边,使用伪不可见节点。
graph {
// note: renaming the nodes was optional
graph [splines=false ] // was ortho
node [fontname="Sans-Serif" shape=rect ] // record features unused
rankdir=LR // ranks are now vertical!
{ // non-visible nodes (i1 i2 i3 i4) used to connect edges
rank=same
node [label="" peripheries=0] // keep same size as other nodes,
// but do not draw (peripheries)
edge [headclip=false tailclip=false] // draw center-to-center
i1:c -- i2:c -- i3:c -- i4:c
}
{node [group=T] P C1} //group used to place "child 1" w/ parent
P [label="Parent"]
{
rank=same
C1 [label="Child 1"]
C2 [label="Child 2"]
C3 [label="Child 3"]
C4 [label="Child 4 and then some"]
}
P -- i1 [headclip=false]
edge [tailclip=false]
i1 -- C1
i2 -- C2
i3 -- C3
i4 -- C4
}
给予:
假设我从这个开始:
graph {
graph [splines=ortho]
node [fontname="Sans-Serif" shape=record]
rankdir=LR
"Parent" -- "Child 1"
"Parent" -- "Child 2"
"Parent" -- "Child 3"
"Parent" -- "Child 4 and then some"
}
这产生:
我需要更改什么才能得到这个(以及后续级别)?
谢谢!
出乎意料的困难。 Ortho 替换为 DIY 类 ortho-like 边,使用伪不可见节点。
graph {
// note: renaming the nodes was optional
graph [splines=false ] // was ortho
node [fontname="Sans-Serif" shape=rect ] // record features unused
rankdir=LR // ranks are now vertical!
{ // non-visible nodes (i1 i2 i3 i4) used to connect edges
rank=same
node [label="" peripheries=0] // keep same size as other nodes,
// but do not draw (peripheries)
edge [headclip=false tailclip=false] // draw center-to-center
i1:c -- i2:c -- i3:c -- i4:c
}
{node [group=T] P C1} //group used to place "child 1" w/ parent
P [label="Parent"]
{
rank=same
C1 [label="Child 1"]
C2 [label="Child 2"]
C3 [label="Child 3"]
C4 [label="Child 4 and then some"]
}
P -- i1 [headclip=false]
edge [tailclip=false]
i1 -- C1
i2 -- C2
i3 -- C3
i4 -- C4
}
给予: