I have a GEDCOM file exported from Ancestral Quest with my family tree, it is quite extense, and I would like to do some analysis on it. I want to construct a tree structure, and explore it recursively.
Is there any library that could read the GEDCOM file and create the tree structure, or some type of directed graph?
You can use python-gendom to parse the file and transform it to a LightGraphs' graph. Subsequently GraphPlot can be used to actually make a plot.
Here is a working code skeleton to start with:
using PyCall
using Conda
using LightGraphs
run(`$(PyCall.python) -m pip install python-gedcom`)
gedcom = pyimport("gedcom")
gparser = pyimport("gedcom.parser")
gedcom_parser = gparser.Parser()
# download from "https://www.gedcom.org/samples/555SAMPLE.GED"
gedcom_parser.parse_file("c:/temp/555SAMPLE.GED")
g = SimpleDiGraph()
for el in gedcom_parser.get_root_child_elements()
display(el)
# todo populate graph g
# recursively iterate over tree
# see https://pypi.org/project/python-gedcom/ for more details how to read the data
end
# todo use GraphPlot to plot the graph