As for drawing the structure, it is difficult to avoid collisions (intersection of lines) if more than two generations are displayed. Therefore, if your application allows you to save it up to two, that's great. I wrote several programs that use this kind of presentation, either vertically:

or horizontally:

If you need more generations displayed immediately, you will need to come up with other ideas, and they can become quite sparse so that you can show everyone in the same generation at the same level.
As for representing relationships as a data structure - well, that's messy. The simplest, purest thing is that any two people who are respectively the mother and father of the same person are βmarriedβ. But how do you want to represent several partners, step-by-step children and the like? It's hard to answer without knowing more about what your program should do. Your dataset may not have these complications. However, if this is the case, it is better to think over complex cases first - simple ideas cannot be easily expanded to cover difficult cases.
Draw (manually) some of the most difficult cases that you expect; which will suggest what data you need to record and how to organize it. The choices you make when you draw (who comes first, which characters and text to use for each node, etc.) will inform your decisions about the data structure.
Setting up both motherhood B and child A seems redundant - and redundancy leads to errors - choose one. Which one of? Well, thereβs more information when you establish the mother mother B (A gender), and we know that any person will need exactly two parents against 0 or more children. So I'm usually going to just install mother B; you can always recognize the children of any person, iterating over everyone to choose a set whose parent is equal to the individual in question. And in fact, maintaining the relationship between mother and father (compared to simple parental relationships) can reduce duplication (provided that you keep the gender with individuals).
Carl Manaster
source share