This project allows for the creation of fictional family trees. Given a list of names to choose from, it will create a plausible family tree.
Family trees have always seemed like a fun data structure, so I wanted to play around with them. They can take a while to build from scratch though. This allows for easy family tree generation and viewing.
You'll need graphviz
for this. If you are on mac you can just do brew install graphviz
.
- Download the latest release from here: https://github.com/patbeagan1/FamilyTreeGenerator/releases
- Ensure that the following files are present in the directory that you are running the application from:
./namesFemale.txt
./namesMale.txt
./namesLast.txt
- Populate each
name<>.txt
file with a single name per line. You can see an example in the top level of this repo, here. Lines can be commented out by starting the line with a "#". - Run the application with
java -jar <filename>.jar
. This will do the following:- You'll get a
family.dot
file generated in the top level of the repo. - As long as
graphviz
is installed, it will convert the dot file into a JPG calledout.jpg
in the top level of the repo - As long as your OS knows the
open
command, theout.jpg
file will be opened.
- You'll get a
The generated image should look something like this:
If you'd like to run it with different names, change the names that appear in the name<>.txt
files in the directory from which you are running the program.
The person ids ensure that they are unique within the graph. Otherwise, there is a small chance that two people will have the same name and create a cycle - not valid for a family tree!
Right now I have it set up to generate a couple of ancestors for people that marry into the family later on, and generate some descendants for generated ancestors. This helps make it seem less like they are popping up out of nowhere. You can disable this by changing the values that are injected into Runtime
.
These demos show the difference:
Without Inlaws | With Inlaws | |
---|---|---|
Without Cousins | ||
With Cousins |
Right now they are fixed patrilinearly - children keep the father's last name. There are other ways that this could be done, and maybe they will be added in the future.
It seems like there is a practical limit for graphviz around 20 generations. Let me know if you find a way to go higher!
I put this together for fun, and don't plan on maintaining it regularly. If you see something that you would like me to change, or a feature that you would like me to add, feel free to file an issue and I will try to follow up.
Check the contribution guidelines