Discussion:
[graphviz-interest] Family tree layout with Dot/GraphViz
Jeroen Van Goey
2010-02-16 10:29:58 UTC
Permalink
I am trying to draw a family tree with Dot and GraphViz.

This is what I currently have:

# just graph set-up
digraph simpsons {
ratio = "auto"
mincross = 2.0

# draw some nodes
"Abraham" [shape=box, regular=1, color="blue"] ;
"Mona" [shape=box, regular=1, color="pink"] ;
"Clancy" [shape=box, regular=1, color="blue"] ;
"Jackeline" [shape=box, regular=1, color="pink"] ;
"Herb" [shape=box, regular=1, color="blue"] ;
"Homer" [shape=box, regular=1, color="blue"] ;
"Marge" [shape=box, regular=1, color="pink"] ;
"Patty" [shape=box, regular=1, color="pink"] ;
"Selma" [shape=box, regular=1, color="pink"] ;
"Bart" [shape=box, regular=1, color="blue"] ;
"Lisa" [shape=box, regular=1, color="pink"] ;
"Maggie" [shape=box, regular=1, color="pink"] ;
"Ling" [shape=box, regular=1, color="blue"] ;
# creating tiny nodes w/ no label, no color
"ParentsHomer" [shape=diamond,style=filled,label="",height=.1,width=.1]
;
"ParentsMarge" [shape=diamond,style=filled,label="",height=.1,width=.1]
;
"ParentsBart" [shape=diamond,style=filled,label="",height=.1,width=.1]
;

# draw the edges
"Abraham" -> "ParentsHomer" [dir=none, weight=1] ;
"Mona" -> "ParentsHomer" [dir=none, weight=1] ;
"ParentsHomer" -> "Homer" [dir=none, weight=2] ;
"ParentsHomer" -> "Herb" [dir=none, weight=2] ;
"Clancy" -> "ParentsMarge" [dir=none, weight=1] ;
"Jackeline" -> "ParentsMarge" [dir=none, weight=1] ;
"ParentsMarge" -> "Marge" [dir=none, weight=2] ;
"ParentsMarge" -> "Patty" [dir=none, weight=2] ;
"ParentsMarge" -> "Selma" [dir=none, weight=2] ;
"Homer" -> "ParentsBart" [dir=none, weight=1] ;
"Marge" -> "ParentsBart" [dir=none, weight=1] ;
"ParentsBart" -> "Bart" [dir=none, weight=2] ;
"ParentsBart" -> "Lisa" [dir=none, weight=2] ;
"ParentsBart" -> "Maggie" [dir=none, weight=2] ;
"Selma" -> "Ling" [dir=none, weight=2] ;
}

If I run this through dot (`dot simpsons.dot -Tsvg > simpsons.svg`), I get
the following layout: Loading Image...

However, I'd like the edges to be more "family tree"-like: a T-junction
between two married persons with the vertical line of the T again branching
in an upside-down T-junction with small subdivisions for each of the
children, like this mock-up, done in KolourPaint:
Loading Image...

What is the dot syntax that I have to use to achieve this?

PS: If any of you are on Stackoverflow and want to earn some virtual Brownie
points there, you can crosspost your answer at
http://stackoverflow.com/questions/2271704/family-tree-layout-with-dot-graphviz<goog_1266315886590>
Stephen North
2010-02-16 11:39:04 UTC
Permalink
Jeoen,
I think there are dedicated packages for drawing
family trees, that may be easier to use and will
do a better job.
Stephen North

_______________________________________________
graphviz-***@research.att.com
https://mailman.research.att.com/mailman/listinfo/graphviz-interest
Pander
2010-02-16 12:11:50 UTC
Permalink
Post by Stephen North
Jeoen,
I think there are dedicated packages for drawing
family trees, that may be easier to use and will
do a better job.
Stephen North
e.g. http://www.gramps-project.org/wiki/index.php?title=Main_Page
Post by Stephen North
_______________________________________________
https://mailman.research.att.com/mailman/listinfo/graphviz-interest
_______________________________________________
graphviz-***@research.att.com
https://mailman.research.att.com/mailman/listinfo/graphviz-interest
Gregoire LEJEUNE
2010-02-16 15:59:23 UTC
Permalink
Hi,

I'm working on this idea for my Ruby GraphViz Lib
(http://github.com/glejeune/Ruby-Graphviz) and here is :

The generated dot : http://dl.dropbox.com/u/72629/simpsons.dot
And the result PNG : Loading Image...

Maybe you can reuse it.

If you want i can take time to describe the algorithm or you can wait
for me to push it in my repo (and you can read Ruby source)

Greg
Post by Jeroen Van Goey
I am trying to draw a family tree with Dot and GraphViz.
    # just graph set-up
    digraph simpsons {
    ratio = "auto"
    mincross = 2.0
    # draw some nodes
    "Abraham"   [shape=box, regular=1, color="blue"] ;
    "Mona"      [shape=box, regular=1, color="pink"] ;
    "Clancy"    [shape=box, regular=1, color="blue"] ;
    "Jackeline" [shape=box, regular=1, color="pink"] ;
    "Herb"      [shape=box, regular=1, color="blue"] ;
    "Homer"     [shape=box, regular=1, color="blue"] ;
    "Marge"     [shape=box, regular=1, color="pink"] ;
    "Patty"     [shape=box, regular=1, color="pink"] ;
    "Selma"     [shape=box, regular=1, color="pink"] ;
    "Bart"      [shape=box, regular=1, color="blue"] ;
    "Lisa"      [shape=box, regular=1, color="pink"] ;
    "Maggie"    [shape=box, regular=1, color="pink"] ;
    "Ling"      [shape=box, regular=1, color="blue"] ;
    # creating tiny nodes w/ no label, no color
    "ParentsHomer" [shape=diamond,style=filled,label="",height=.1,width=.1]
;
    "ParentsMarge" [shape=diamond,style=filled,label="",height=.1,width=.1]
;
    "ParentsBart"  [shape=diamond,style=filled,label="",height=.1,width=.1]
;
    # draw the edges
    "Abraham"      -> "ParentsHomer" [dir=none, weight=1] ;
    "Mona"         -> "ParentsHomer" [dir=none, weight=1] ;
    "ParentsHomer" -> "Homer"        [dir=none, weight=2] ;
    "ParentsHomer" -> "Herb"         [dir=none, weight=2] ;
    "Clancy"       -> "ParentsMarge" [dir=none, weight=1] ;
    "Jackeline"    -> "ParentsMarge" [dir=none, weight=1] ;
    "ParentsMarge" -> "Marge"        [dir=none, weight=2] ;
    "ParentsMarge" -> "Patty"        [dir=none, weight=2] ;
    "ParentsMarge" -> "Selma"        [dir=none, weight=2] ;
    "Homer"        -> "ParentsBart"  [dir=none, weight=1] ;
    "Marge"        -> "ParentsBart"  [dir=none, weight=1] ;
    "ParentsBart"  -> "Bart"         [dir=none, weight=2] ;
    "ParentsBart"  -> "Lisa"         [dir=none, weight=2] ;
    "ParentsBart"  -> "Maggie"       [dir=none, weight=2] ;
    "Selma"        -> "Ling"         [dir=none, weight=2] ;
    }
If I run this through dot (`dot simpsons.dot -Tsvg > simpsons.svg`), I get
the following layout: http://i.imgur.com/gxSzS.png
However, I'd like the edges to be more "family tree"-like: a T-junction
between two married persons with the vertical line of the T again branching
in an upside-down T-junction with small subdivisions for each of the
children, like this mock-up, done in
KolourPaint: http://i.imgur.com/H7jAX.png
What is the dot syntax that I have to use to achieve this?
PS: If any of you are on Stackoverflow and want to earn some virtual Brownie
points there, you can crosspost your answer
at http://stackoverflow.com/questions/2271704/family-tree-layout-with-dot-graphviz
_______________________________________________
https://mailman.research.att.com/mailman/listinfo/graphviz-interest
_______________________________________________
graphviz-***@research.att.com
https://mailman.research.att.com/mailman/listinfo/graphviz-interest
Loading...