What Data Structure to Use for a Family Tree
Building my Family Tree
Designing a Information Structure & the Tools available to create a tree
This could be the outset image that comes to mind when you recall of a family tree. I'm no different, I feel the same way too. A father, a mother and connected to them are their kids.
Backstory
Sometime back when I was home talking to my grandma, she asked thou e to go to a relative'southward matrimony, because "I'thousand growing up to be a human being" and it'south becoming a responsibleness of me. I had no freaking inkling who the person was, who they're marrying or how they're even related to me. So, I asked her. At present what she said went something like this, "Remember my(grandma's) brother's brother-in-law? The one who stays in Chennai. His married woman'southward cousin is the 1 getting married". Okay, if yous're focused, yous could get the link out of that. But it merely raised more questions in me, how many siblings does my grandma have? How many does my peachy-grandfather have? and who are their sons and peachy-grandsons? Would they be around my age? In Bharat, families are very much continued to each other. That'south kinda how the system works, a chain of network. And so to start with, I asked my blood brother's help in trying to draw out a family nautical chart. Just for our personal reference. He took a pencil and paper and started off with my corking-granddaddy and he was progressing. But then it occurred to me that everyone, at least across my generation would demand this, considering when I'm older I'g unlikely to remember all my relatives. So I had to go on runway of these people for future reference considering of the bloodline. And I wanted to create a database of people, just my family, their current contact info, birthdays and such, and get in available to everyone in the huge tree. This would enable anybody to track/contact anybody hands.
The Idea
Earlier jumping into developing something, I thought of what exactly I wanted.
- Basic family structure. Ability to create and modify people & relations
- Admin admission, who can edit or create (invite simply)
- Facebook integration, then it's easier for everyone
- Information privacy — Public / Family's family unit/ Family / Private
- Relationship and Person search (eg., bear witness all cousins)
- Handling a deceased person
- Optional timeline
Data Structure Design
But before diving deep into this extensive list of features, I wanted to design the database of how I was going to shop the family data. People suggested me to employ some graph DB (neo4j) and get it done with. Just I wanted an efficient personal solution. The diagram you saw above was not tangible, because the children are continued to, umm, to a relation. Then I thought of storing all the relations in every single person, this was a foolish thought because y'all tin form derivatives out of relations and thus the number of connections would be redundantly very huge.
Then this occurred to me that, with just 2 connections, child — male parent and husband — wife, I could practice all the traversals I want. For eg., My mom-side cousin would be my → dad's → wife's → dad'south (granddad) → son'southward (uncle)→ son (cousin). Not to be offended I connected children to dad and non mom, I love my mom more than by all means. Look, merely and then what happens if the parents go divorced? It didn't occur to me because I haven't seen it effectually me, well, Ever. Yes, I haven't seen a divorced couple in my life. Dot. Welcome to India.
(update Jul 2019: iii of my close friends are divorced, one remarried)
But If I were to design for divorce, that would intermission. Also for same-sexual activity couple, who'd be the father? Those were all tough questions and I felt that the children didn't belong to the male parent, but to the couple, to the "mating", to exist precise, because tomorrow the "couple" may non exist, but that past effect can't be erased. And that's where the children should be connected to.
Then I created an entity called "Family". This family holds information virtually children. The family unit besides contained the male parent and mother, only they were connected to each other equally "Spouse". This was a expert direction, I felt the family entity would enhance the structure, but still, it was not consummate. A person existence connected to some other person as a spouse, and a family equally a kid didn't fit it. So I took the family out of the parents and put it in the center.
This family would hold information well-nigh the relationship and status of the couple and the connectedness to their biological kids. And so a person is always connected to at least one family as a child, due north-families as a parent. eg., His 1st wife, his 2d wife, his affair and so on (well, hopefully not 🤞🏻). With this, all the traversals were possible and the structure was simplified because every person is only continued to families — as child or parent — and every family simply holds ii parents(of any gender) and a list of children. Divorce situation was handled and LGBT couples are too accommodated.
That was perfect. So I started to think of how I'd store this information. Would I need a database? If then, how would my structure look like? I spend some time talking with a bunch of friends to understand the organisation behind a graph DB. And I realized if I can maintain an adjacency matrix, I can build any graph construction equally I desire. Assuming that I was going with a file system — not fifty-fifty a MySql. I went ahead and started drawing how my data would expect like considering my needs were specific and the adjacency matrix was an unnecessary complexity for me.
My Initials thoughts were to accept a matrix with Persons on one side and Families on the other. The connection would either say "P" for parent, "C" for child or " " for no relation. This was a great get-go, only as I saw the representation, I realised there were a lot of empty infinite. Actually most of the space was empty. And then I redesigned my data to something like this.
Equally you tin see here, there was a list of persons, with two information on them. Their "child of" family and their "parent of" family listing. Of course, at that place would be two other tables holding data most the person Px and the family unit Fx. This was just the relationship. I've highlighted a family unit as dark-green. Information technology occurs in four places, the father, mother, and sister. And this implements the construction we saw to a higher place. Also, if you await at the uncle you lot could meet that he's a role of multiple families.
Epic ending
After spending so much time on this, I took a break to see if there were any other implementation already available for me to use. Though I've already washed this job, I wanted a thorough check again. Sadly, I constitute GENI which does this extensively, and it had 100 Million families already. With a heavy heart, I signed up and I realized information technology had (almost) everything I wanted.
Though the interface was horrible, it had all the needed functionality to build any kind of family tree. I was able to invite my brother and my cousins to help me build this and the collaboration was good too. Then I eventually built a tree here. But information technology didn't experience complete, I don't call back it ever does. Because there are always open up ends that you could dig in and keep adding more. Subsequently a month, I realized we weren't using the tool much. As a one-shot, we collected the data, but we weren't frequent and we stopped at a signal. Then I got that, it's biggest drawback is that they don't have a mobile solution.
So I found another tool, Ancestry which was primarily based on mobile. This was very absurd, piece of cake to use and had all the needed functionality to build a tree. The coolest affair was being able to see it via the mobile. There were some limitations in the app, for instance, y'all tin't create a blood brother or sis without adding a parent and I don't really know my great-grandparents name. The invite functionality wasn't facebook integrated. Also, I didn't desire to invite others and inquire them to do the aforementioned work again, for the platform mistake I made. So I decided to fill in all the available data myself earlier pulling in other people.
Finally, I'1000 glad that I have a place where I can store all my family relations information and access them when required. One less headache, remembering all the relations you've never met. Too bad I didn't get a chance to build the organisation. That would've been epic.
Source: https://bigomega.medium.com/building-my-family-tree-ef0be1fba775
0 Response to "What Data Structure to Use for a Family Tree"
Post a Comment