Assistance Needed with Common Ancestor Algorithm in WikiTree Data

+3 votes
374 views

Hello WikiTree Community,

I hope this message finds you all well. I've been working on a project involving the construction and analysis of family trees using data from WikiTree. Specifically, I'm trying to find common ancestors between different individuals.

I've converted the data into a directed graph structure, where nodes represent individuals and directed edges represent parent-child relationships. However, when testing my common ancestor finding algorithm on sibling pairs (e.g., Adams-2241 and Adams-2240), the algorithm isn't returning any common ancestors, which isn't logically possible for siblings.

I've checked my raw data, node consistency, edge consistency, direction of edges, graph connectivity, and my graph representation. I've also reviewed my algorithm to ensure it correctly traverses the graph and considers all possible paths.

Despite these checks, I'm still facing this issue. Here is the link to my code: https://github.com/Raulramf/Genealogy-LCA-Algorithm/blob/f5080bd780d0a991d5d5112eeb922e6f927953fb/main.py

I would greatly appreciate any insights or suggestions you might have. If you see anything in the code that could be causing this issue or if you have any advice on what I should check or try next, I would be very thankful.

Best regards.

WikiTree profile: Bethiah Adams
in WikiTree Tech by Raul Ramirez G2G Crew (410 points)
edited by Raul Ramirez
Hi Raul. Sounds like a good project!

The immediate common ancestors of siblings are their parents. Have you tried reducing the data to a very simple family with two parents and two sibling children, then running your code on that? It should then be easier to see what is going wrong.

The file:// link you give is to your own computer. It is not accessible to us over the Internet.
I updated the link so that everyone could access it through my GitHub repository.

Thanks a lot.
Not to take the wind out of your sails, but … “there’s an app for that.”

On any profile, click on the WikiTree Id for the person in the menu bar at the top of the page, and scroll down to Relationship to Me. Click on that, and it will show you the relationship. It will also tell you if there is more than one relationship between the two people.
Also Find, Apps, Relative Spiderwebs

However, this only works for a single pair, if you could.pull it off for a group of say 5 people (or even members of a category) that would be awesome

"Not to take the wind out of your sails, but … 'there’s an app for that.'"

I am aware of the features mentioned, however, this project is purely educational. In order to create something new, one must fully understand what came before. 

Still, I really appreciate your response:) 

2 Answers

+3 votes
 
Best answer

Hi again Raul.

I think the problem is that in the JSON structure the profile IDs are integers, but argparse is giving the arguments as strings. Try using

individual1 = int(args.individual1)

individual2 = int(args.individual2)

then remove "args." from the rest of the code.

I hope that will solve your current problem. After that you may see an issue with "depth < min_depth".

I like directed graphs too!

by Jim Richardson G2G Astronaut (1.0m points)
selected by Raul Ramirez

Hi, I really appreciate your response!

May I ask: why is "depth < min_depth" going to be an issue?

P.S. Is there any way I could contact you privately?

Try the fix I've suggested for the first issue. Be sure to enter all-numeric IDs on the command line, not ones of the format Surname-1234. I think you'll find that the code progresses further than before, but you will hit an error message because  nx.shortest_path_length returns a dict not a number. That should be easy for you to fix.

See how this goes, Raul. We can go offline if necessary after that if further problems arise.

Thank you for the star, Raul! I hope your code is all working now.
+1 vote
Raul, are you a member of the apps project? There is a google group used for discussions like this, and also Discord
by Jonathan Crawford G2G6 Pilot (285k points)
I'm afraid not, however, that sounds interesting. I would very much like to be part of these groups.

Related questions

+4 votes
1 answer
130 views asked Jun 16, 2018 in The Tree House by Jim Parish G2G6 Pilot (176k points)
+5 votes
1 answer
+7 votes
2 answers
253 views asked Jun 26, 2022 in WikiTree Help by Peter Roberts G2G6 Pilot (717k points)
+176 votes
49 answers
+13 votes
18 answers
+3 votes
2 answers
117 views asked Aug 30, 2023 in WikiTree Tech by Matt McNabb G2G6 Mach 3 (37.5k points)
+9 votes
5 answers
603 views asked Dec 12, 2020 in WikiTree Tech by Robert Judd G2G6 Pilot (136k points)
+11 votes
0 answers

WikiTree  ~  About  ~  Help Help  ~  Search Person Search  ~  Surname:

disclaimer - terms - copyright

...