如何使用graphviz将孙子(Enkel1)实施到家谱中? [英] How to implement Grandchild (Enkel1) into Family-Tree with graphviz?

查看:69
本文介绍了如何使用graphviz将孙子(Enkel1)实施到家谱中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在与祖父母,父母,子女和孙子女一起建一棵家谱(也可以与前合伙人子女在一起).它的工作很完美,但是孙子们有一个问题.当我尝试将v1与Enkel1连接时,出现布局问题.我不理解此问题,因为它与"Ex-Kind"和Point c1完全兼容.你能给我小费吗?

I´m building a Family tree with Grandparents, Parents, Children and Grandchildren (Children with Ex-Partners are possible too). Its working perfect, but there is a Problem with the grandchilds. When i try to connect v1 with Enkel1, i´m getting Problems with the layout. I don`t understand this Problem because its working exactly with "Ex-Kind" and Point c1. Can you please give me a tipp?

非常感谢您,

彼得

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 )行的顺序;我添加了

You need to force the order of the last (Bart) row with invisible edges; I have added

{ rank = same; Schwiegertochter -> Lisa -> Maggie[ style = invis ] }

在底部;我还(出于个人喜好而不是真正的需要)清理了代码,提出了

at the bottom; I also have (more for my own pleasure than for real need) cleaned up the code, coming up with

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;
}

这给你

这篇关于如何使用graphviz将孙子(Enkel1)实施到家谱中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆