[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Lua tables for genealogy
- From: Dirk Laurie <dirk.laurie@...>
- Date: Sun, 26 Jun 2016 09:32:01 +0200
A genealogical graph has two kinds of node: 'person' and 'family'.
In graph theoretical lingo, it is a simple directed two-coloured graph.
That is to say, persons connect only to families, families only to
persons, in both cases there is only one connection if any, and that
connection is one-way.
Inspired by the format that LHF's 'lxml' returns, I plan to represent
them as Lua arrays as follows:
Persons: negative numbers key families in which the person is
a child, positive numbers key families in which the person is
a parent.
Families: negative numbers key parents in the family, positive
numbers key children.
In both cases, [0] keys a unique identification string, and
table-valued keys are used to invert the mapping given by
the numerical keys.
An index table with pairs '[node[0]]=node' can be constructed.
Up to this point, 'child' and 'parent' are abstract terms.
String-valued keys and zero remain available to be used as
needed in the application. For example, node[node[0]] might
be a table containing extra information not important enough
to justify reserving keys for it.
I have not been able to find any useful reference on the Internet
to the use of Lua in Genealogy (the 'real' genealogy).