如何使用 graphviz 将 Grandchild (Enkel1) 实现为 Family-Tree?
How to implement Grandchild (Enkel1) into Family-Tree with graphviz?
我正在与祖父母、Parents、Children 和孙辈(Children 和 Ex-Partners 建立家谱。它工作完美,但孙子有问题。当我尝试将 v1 与 Enkel1 连接时,我遇到了布局问题。我不明白这个问题,因为它与 "Ex-Kind" 和点 c1 完全一致。你能给我小费吗?
非常感谢,
彼得
digraph G {
edge [dir=none];
node [shape=box];
graph [splines=ortho compound=true, pad="0.4", nodesep="0.2", ranksep="0.2"];
mindist=1
"Max\nMustermann" [shape=box, regular=0,color="black", style="filled" fillcolor="grey", width=1.5, height = 0.5, fontsize=10] ;
"Maxi\nTestermann" [shape=box, regular=0,color="black", style="filled" fillcolor="grey", width=1.5, height = 0.5, fontsize=10] ;
"Moritz\nMustermann" [shape=box, regular=0,color="black", style="filled" fillcolor="grey", width=1.5, height = 0.5, fontsize=10] ;
"Nina\nMustermann" [shape=box, regular=0,color="black", style="filled" fillcolor="grey", width=1.5, height = 0.5, fontsize=10] ;
"Volker\nVersuch" [shape=box, regular=0,color="black", style="filled" fillcolor="grey", width=1.5, height = 0.5, fontsize=10] ;
"Veronika\nVersuch" [shape=box, regular=0,color="black", style="filled" fillcolor="grey", width=1.5, height = 0.5, fontsize=10] ;
"Maximilian\nMustermann"[shape=box, regular=0,color="black", style="filled" fillcolor="grey", width=1.5, height = 0.5, fontsize=10] ;
"Maxima\nMustermann" [shape=box, regular=0,color="black", style="filled" fillcolor="grey", width=1.5, height = 0.5, fontsize=10] ;
"Bart" [shape=box, regular=0,color="black", style="filled" fillcolor="grey", width=1.5, height = 0.5, fontsize=10] ;
"Lisa" [shape=box, regular=0,color="black", style="filled" fillcolor="grey", width=1.5, height = 0.5, fontsize=10] ;
"Maggie" [shape=box, regular=0,color="black", style="filled" fillcolor="grey", width=1.5, height = 0.5, fontsize=10] ;
"Ex\nPartner" [shape=box, regular=0,color="black", style="filled" fillcolor="grey", width=1.5, height = 0.5, fontsize=10] ;
"Schwiegertochter" [shape=box, regular=0,color="black", style="filled" fillcolor="grey", width=1.5, height = 0.5, fontsize=10] ;
"Enkel1" [shape=box, regular=0,color="black", style="filled" fillcolor="grey", width=1.5, height = 0.5, fontsize=10] ;
"Ex-Kind" [shape=box, regular=0,color="black", style="filled" fillcolor="grey", width=1.5, height = 0.5, fontsize=10] ;
a1 [shape=circle,label="",height=0.01,width=0.01];
b1 [shape=circle,label="",height=0.01,width=0.01];
b2 [shape=circle,label="",height=0.01,width=0.01];
b3 [shape=circle,label="",height=0.01,width=0.01];
{rank=same; "Maximilian\nMustermann" -> a1 -> "Maxima\nMustermann"};
{rank=same; b1 -> b2 -> b3};
a1 -> b2;
b1 -> "Max\nMustermann";
b2 -> "Maxi\nTestermann";
b3 -> "Moritz\nMustermann";
c1 [shape=circle,label="",height=0.01,width=0.01];
{rank=same; "Ex\nPartner" -> c1 -> "Moritz\nMustermann"};
c1->"Ex-Kind";
x1 [shape=circle,label="",height=0.01,width=0.01];
{rank=same; "Volker\nVersuch" -> x1 -> "Veronika\nVersuch"};
{rank=same"Maxima\nMustermann"; "Volker\nVersuch" }
x1 -> "Nina\nMustermann";
p1 [shape=circle,label="",height=0.01,width=0.01];
p2 [shape=circle,label="",height=0.01,width=0.01];
p3 [shape=circle,label="",height=0.01,width=0.01];
q1 [shape=circle,label="",height=0.01,width=0.01];
q2 [shape=circle,label="",height=0.01,width=0.01];
q3 [shape=circle,label="",height=0.01,width=0.01];
{rank=same; "Moritz\nMustermann" -> p1 -> "Nina\nMustermann"};
{rank=same;q1 -> q2 -> q3};
{rank=same;"Bart";"Lisa";"Maggie"};
p1 -> p2 -> p3 ->q2;
q1 -> Bart;
q2 -> Lisa;
q3 -> Maggie;
v1 [shape=circle,label="",height=0.01,width=0.01];
{rank=same; "Bart" -> v1 -> "Schwiegertochter"};
}
您需要对最后 (Bart
) 行的不可见边强制排序;我已添加
{ rank = same; Schwiegertochter -> Lisa -> Maggie[ style = invis ] }
在底部;我也有(更多是为了我自己的乐趣而不是真正的需要)清理代码,提出
digraph G
{
graph[ splines=ortho, pad="0.4", nodesep="0.2", ranksep="0.2" ];
mindist=1
node[ shape=box, regular=0,color="black", style="filled" fillcolor="grey", width=1.5, height = 0.5, fontsize=10 ];
"Max\nMustermann", "Maxi\nTestermann", "Moritz\nMustermann", "Nina\nMustermann";
"Volker\nVersuch", "Veronika\nVersuch", "Maximilian\nMustermann", "Maxima\nMustermann";
"Bart", "Lisa", "Maggie", "Ex\nPartner", "Schwiegertochter", "Enkel1", "Ex-Kind";
node[ shape=circle,label="",height=0.01,width=0.01 ];
a1, b1, b2, b3, c1, x1, p1, p2, p3, q1, q2, q3, v1;
edge[ dir=none ];
{ rank=same; "Maximilian\nMustermann" -> a1 -> "Maxima\nMustermann" }
{ rank=same; b1 -> b2 -> b3 }
a1 -> b2;
b1 -> "Max\nMustermann";
b2 -> "Maxi\nTestermann";
b3 -> "Moritz\nMustermann";
{ rank=same; "Ex\nPartner" -> c1 -> "Moritz\nMustermann" }
c1->"Ex-Kind";
{ rank=same; "Volker\nVersuch" -> x1 -> "Veronika\nVersuch" }
{ rank=same"Maxima\nMustermann"; "Volker\nVersuch" }
x1 -> "Nina\nMustermann";
{ rank=same; "Moritz\nMustermann" -> p1 -> "Nina\nMustermann"}
{ rank=same;q1 -> q2 -> q3}
{ rank=same;"Bart";"Lisa";"Maggie" }
p1 -> p2 -> p3 ->q2;
q1 -> Bart;
q2 -> Lisa;
q3 -> Maggie;
{ rank=same; "Bart" -> v1 -> "Schwiegertochter" }
{ rank = same; Schwiegertochter -> Lisa -> Maggie[ style = invis ] }
v1 -> Enkel1;
}
这给了你
我正在与祖父母、Parents、Children 和孙辈(Children 和 Ex-Partners 建立家谱。它工作完美,但孙子有问题。当我尝试将 v1 与 Enkel1 连接时,我遇到了布局问题。我不明白这个问题,因为它与 "Ex-Kind" 和点 c1 完全一致。你能给我小费吗?
非常感谢,
彼得
digraph G {
edge [dir=none];
node [shape=box];
graph [splines=ortho compound=true, pad="0.4", nodesep="0.2", ranksep="0.2"];
mindist=1
"Max\nMustermann" [shape=box, regular=0,color="black", style="filled" fillcolor="grey", width=1.5, height = 0.5, fontsize=10] ;
"Maxi\nTestermann" [shape=box, regular=0,color="black", style="filled" fillcolor="grey", width=1.5, height = 0.5, fontsize=10] ;
"Moritz\nMustermann" [shape=box, regular=0,color="black", style="filled" fillcolor="grey", width=1.5, height = 0.5, fontsize=10] ;
"Nina\nMustermann" [shape=box, regular=0,color="black", style="filled" fillcolor="grey", width=1.5, height = 0.5, fontsize=10] ;
"Volker\nVersuch" [shape=box, regular=0,color="black", style="filled" fillcolor="grey", width=1.5, height = 0.5, fontsize=10] ;
"Veronika\nVersuch" [shape=box, regular=0,color="black", style="filled" fillcolor="grey", width=1.5, height = 0.5, fontsize=10] ;
"Maximilian\nMustermann"[shape=box, regular=0,color="black", style="filled" fillcolor="grey", width=1.5, height = 0.5, fontsize=10] ;
"Maxima\nMustermann" [shape=box, regular=0,color="black", style="filled" fillcolor="grey", width=1.5, height = 0.5, fontsize=10] ;
"Bart" [shape=box, regular=0,color="black", style="filled" fillcolor="grey", width=1.5, height = 0.5, fontsize=10] ;
"Lisa" [shape=box, regular=0,color="black", style="filled" fillcolor="grey", width=1.5, height = 0.5, fontsize=10] ;
"Maggie" [shape=box, regular=0,color="black", style="filled" fillcolor="grey", width=1.5, height = 0.5, fontsize=10] ;
"Ex\nPartner" [shape=box, regular=0,color="black", style="filled" fillcolor="grey", width=1.5, height = 0.5, fontsize=10] ;
"Schwiegertochter" [shape=box, regular=0,color="black", style="filled" fillcolor="grey", width=1.5, height = 0.5, fontsize=10] ;
"Enkel1" [shape=box, regular=0,color="black", style="filled" fillcolor="grey", width=1.5, height = 0.5, fontsize=10] ;
"Ex-Kind" [shape=box, regular=0,color="black", style="filled" fillcolor="grey", width=1.5, height = 0.5, fontsize=10] ;
a1 [shape=circle,label="",height=0.01,width=0.01];
b1 [shape=circle,label="",height=0.01,width=0.01];
b2 [shape=circle,label="",height=0.01,width=0.01];
b3 [shape=circle,label="",height=0.01,width=0.01];
{rank=same; "Maximilian\nMustermann" -> a1 -> "Maxima\nMustermann"};
{rank=same; b1 -> b2 -> b3};
a1 -> b2;
b1 -> "Max\nMustermann";
b2 -> "Maxi\nTestermann";
b3 -> "Moritz\nMustermann";
c1 [shape=circle,label="",height=0.01,width=0.01];
{rank=same; "Ex\nPartner" -> c1 -> "Moritz\nMustermann"};
c1->"Ex-Kind";
x1 [shape=circle,label="",height=0.01,width=0.01];
{rank=same; "Volker\nVersuch" -> x1 -> "Veronika\nVersuch"};
{rank=same"Maxima\nMustermann"; "Volker\nVersuch" }
x1 -> "Nina\nMustermann";
p1 [shape=circle,label="",height=0.01,width=0.01];
p2 [shape=circle,label="",height=0.01,width=0.01];
p3 [shape=circle,label="",height=0.01,width=0.01];
q1 [shape=circle,label="",height=0.01,width=0.01];
q2 [shape=circle,label="",height=0.01,width=0.01];
q3 [shape=circle,label="",height=0.01,width=0.01];
{rank=same; "Moritz\nMustermann" -> p1 -> "Nina\nMustermann"};
{rank=same;q1 -> q2 -> q3};
{rank=same;"Bart";"Lisa";"Maggie"};
p1 -> p2 -> p3 ->q2;
q1 -> Bart;
q2 -> Lisa;
q3 -> Maggie;
v1 [shape=circle,label="",height=0.01,width=0.01];
{rank=same; "Bart" -> v1 -> "Schwiegertochter"};
}
您需要对最后 (Bart
) 行的不可见边强制排序;我已添加
{ rank = same; Schwiegertochter -> Lisa -> Maggie[ style = invis ] }
在底部;我也有(更多是为了我自己的乐趣而不是真正的需要)清理代码,提出
digraph G
{
graph[ splines=ortho, pad="0.4", nodesep="0.2", ranksep="0.2" ];
mindist=1
node[ shape=box, regular=0,color="black", style="filled" fillcolor="grey", width=1.5, height = 0.5, fontsize=10 ];
"Max\nMustermann", "Maxi\nTestermann", "Moritz\nMustermann", "Nina\nMustermann";
"Volker\nVersuch", "Veronika\nVersuch", "Maximilian\nMustermann", "Maxima\nMustermann";
"Bart", "Lisa", "Maggie", "Ex\nPartner", "Schwiegertochter", "Enkel1", "Ex-Kind";
node[ shape=circle,label="",height=0.01,width=0.01 ];
a1, b1, b2, b3, c1, x1, p1, p2, p3, q1, q2, q3, v1;
edge[ dir=none ];
{ rank=same; "Maximilian\nMustermann" -> a1 -> "Maxima\nMustermann" }
{ rank=same; b1 -> b2 -> b3 }
a1 -> b2;
b1 -> "Max\nMustermann";
b2 -> "Maxi\nTestermann";
b3 -> "Moritz\nMustermann";
{ rank=same; "Ex\nPartner" -> c1 -> "Moritz\nMustermann" }
c1->"Ex-Kind";
{ rank=same; "Volker\nVersuch" -> x1 -> "Veronika\nVersuch" }
{ rank=same"Maxima\nMustermann"; "Volker\nVersuch" }
x1 -> "Nina\nMustermann";
{ rank=same; "Moritz\nMustermann" -> p1 -> "Nina\nMustermann"}
{ rank=same;q1 -> q2 -> q3}
{ rank=same;"Bart";"Lisa";"Maggie" }
p1 -> p2 -> p3 ->q2;
q1 -> Bart;
q2 -> Lisa;
q3 -> Maggie;
{ rank=same; "Bart" -> v1 -> "Schwiegertochter" }
{ rank = same; Schwiegertochter -> Lisa -> Maggie[ style = invis ] }
v1 -> Enkel1;
}
这给了你