Representation of family ties (family tree) in the form of a graph

I read the article Bonsai Family Wiki Engine: 6 Years Later and remembered that at one time there were plans to do something similar. After I tried to use some existing solutions (especially one which suggested that when adding a person, indicate who he is in relation to others and a list of 100,500 positions like son, daughter, mother, father, grandfather, etc., etc. .) we developed our own scheme for storing family relationships in the form of a graph. The vertices of the graph are people, and the edges are relationships between people. There are only two types of relationships:

  1. Parent->Child (the connection is directed from parent to child)
  2. Marriage (the connection is equal and has no direction)
    Using relationships of these two types, it is possible to define a relationship of any complexity.

Relations (connections) – graph edges

Each connection (relationship) has a start and end date and time. Marriages are made and dissolved, and parents abandon their children. Therefore, each connection can have two states: active (continuous line in the diagram) and inactive (dashed line in the diagram). If the current date falls within the interval of the beginning and end of the relationship (or the end of the action is not specified), then the relationship is active.

Relationship type Parent->Child is divided into three types:

  1. Кровное родство those. These people are the biological parents. Moreover, even if it is just a sperm donor in a sperm bank, then this person will be the biological father. Although in this case his “paternity” will actually begin and end even before the birth of the child.
  2. Усыновление/удочерение those. Institute of Adoptive Parents. For example, in the diagram, Vasya adopted the daughter Katya of his wife Masha, whom she gave birth to from Petya in her first marriage. Vasya is Katya’s stepfather, and Masha is her natural mother.
  3. Резервные родители those. godparents. To be honest, it’s not particularly clear how relevant this is in the current conditions because these are not the same times. But this term seems to be in use, so I included it in the diagram. Due to the fact that I don’t have a godfather, I know little about this. Those. whether the godfather can refuse or not. But if this option is not available, then it is enough not to fill in the end date.

There can be several connections between two vertices (people). For example, they got married, separated, then thought about it and got married again.

The diagram does not explicitly indicate that someone is someone’s grandmother/grandson/uncle, etc. and so on. This follows from the diagram itself. For example, Valera is Vasya’s grandson, and Vasya is Valera’s grandfather. Masha is Diana’s mother-in-law, and Diana is Masha’s daughter-in-law. For Ivan, Masha is his mother-in-law, and Vasya is his father-in-law.

People are the tops of the graph

All information about a person is stored at the top of the graph. Almost all characteristics (attributes) of a person depend on the date (even his gender, the time is :)). Those. a person is specified by a list of attributes and each attribute has a start time for the action. For example, a surname that a woman can change after marriage. Where you live also depends on the time. There are only two attributes that do not depend on time, because they themselves are time – the date of birth and the date of death. A vertex can also be in two states: alive and dead.

Human attributes

Example

And now, based on everything written above, let’s decipher the scheme:
Masha and Petya got married. Katya was born to them. Then they divorced. Masha married Vasya. They gave birth to Igor, to whom they took Oleg and Ira as godparents. Then Katya married Ivan, and Igor married Diana and they had a son, Valera.
Unfortunately, Igor’s godfather Oleg died.

Conclusion

The scheme allows you to store any family ties, even immoral and illegal ones + has an expandable set of attributes. If anyone has an example that cannot be described by this diagram, write, we’ll think about how to fix it.

Maybe someday, like the author Bonsaiand I’ll get around to doing something similar, but with my own blackjack and scheme.

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *