I hope some kind soul can help me out. I am getting myself confused. I am trying to write a python3 function that takes in a list of network pairs eg [[‘A’,’B’],[3,2]] with the step/vertex distance to a common hub vertex, eg [‘A’,’B’] , either A is 2 or 3 steps, to the common hub/vertex with B being 3 steps if A is 2 or B being 2 steps if A is 3.
I have a list of overlapping pairs and the possible dual distances.
```input=[[['A','B'],[2,3]],
[['A','C'],[2,2]],
[['A','E'],[2,1]],
[['B','C'],[0,1]],
[['B','D'],[0,2]],
[['B','E'],[2,1]],
[['C','D'],[0,1]],
[['C','E'],[2,1]],
[['D','E'],[1,1]],
[['B','C'],[0,1]]] ```
Note
[[‘B’,’C’],[0,1]]] 0 means it is its own relative localised hub/vertex, see below
[['B','D'],[0,2]] B and D will have an intervening vertex (it will be C in the final result)
Note that vertex B connects directly to C and C connects directly to D and D connects to the overall common hub/vertex with the same distance as E.
I am trying to find if there is a logical network graph solution and if there is a solution what are the number of steps to that common hub/ancestor for each of A,B,C,D,E
How would other people approach a solution please?
The final result should look something like this…
Common Hub ( Common Hub with 3 family tree branches 1,2,3)
- Ax, A
- D,C,B
- E
Cheers
You need to sign in to view this answers
Leave feedback about this