I have builded below genogram using go js library & my goal is to find distance of levels between any 2 nodes

Below links is what i have tried & but one of hurdle is my graph is genogram & the examples link below are linear nodes graphs hence distance is more easy to calculate.

From above graph one of note point is you can see 2 nodes with 0 & 1 ideally the node below it distance should be 1 & above distance should be 1 but its infinity since in genogram the any one spouse can have children hence other spouse distance to that child will be infinity.

Distance & path examples in genogram :

```
https://github.com/NorthwoodsSoftware/GoJS/blob/master/samples/distances.html
https://gojs.net/latest/intro/links.html
https://gojs.net/latest/samples/distances.html
```

Anyways my goal is how to achieve distance between two nodes in genogram type of graph in go js & any clue or alternative path is appreciated.