I have 2 ways of doing that.
1. Make a global tree in 2d world with all relations as lines connecting each node. That was my goal from beginning, but it is too much data for human to look at it and make sense. Then I could use our internal routing algorithm to find shortest path between any two persons. It was never tested on so much data, so I don't know if it will work.
2. On the fly calculation. I would iterate from both persons generations until I find common person. That would work for maximum of 30-40 generations in a few seconds. Then number of connected profiles would go into millions of profiles and it would no longer be fast enough to verify if connection exits, And even then I wouldn't know the path. This must be precalculated to one person, like Wikitree does it, Then it can be done quickly.
I will try to make one of this possibilities work in the future. Also you should know, that my global tree has 6M profiles. That is 2M less than Wikitree, since they use also private connections, that I don't see and cannot use.