Create a family tree with graphviz
• 207 words • 1 min • updated
⚠️ This post is over one year old. It may no longer be up to date or relevant. Opinions may have changed.
is open source graph visualization software. Graph visualization is a way of representing structural information as diagrams of abstract graphs and networks.
We can also use it to craft family trees!
I came up with the following template:
text
digraph G {
{Greatgrandfather Greatgrandmother} -> Grandfather;
{Grandfather Grandmother} -> Father;
{Father Mother} -> Me;
Greatgrandfather [shape = box;label = "Greatgrandfather Lastname";];
Greatgrandmother [shape = box;label = "Greatgrandmother Lastname";];
Grandfather [shape = box;label = "Grandfather Lastname";];
Grandmother [shape = box;label = "Grandmother Lastname";];
Father [shape = box;label = "Father Lastname";];
Mother [shape = box;label = "Mother Lastname";];
Me [shape = box;label = "Me Lastname";];
Greatgrandfather [color = "lightblue";style = filled;];
Greatgrandmother [color = "pink";style = filled;];
Grandfather [color = "lightblue";style = filled;];
Grandmother [color = "pink";style = filled;];
Father [color = "lightblue";style = filled;];
Mother [color = "pink";style = filled;];
Me [style = filled;color = lightblue;];
}…save this to a tree.dot file.
A .png representation of the graph can then be generated with the following
command:
shell
dot -Tpng tree.dot > tree.pngNote that dot is part of the graphviz distribution.
In case it’s not installed on your system, it’s widely available, just do it. For example, on macOS:
shell
brew install graphvizThe final result: