I am writing a tool for recognizing nodes in a network that are causing delays when given a set of two or more sources and destinations experiencing network problems or delay. I am using networkx python library to build the network graph. Consider this graph -
a -- b -- c -- d
| |
e -- f
Say, these are the sets of source and destination facing network issues. Meaning traffic between a and d is experiencing delay and traffic between e and d is experiencing delay and so on.
| source | destination |
|--------|-------------|
| a | d |
| e | d |
| f | a |
- I find the shortest path for these pairs of source and destination. I take an intersection between those two lists and check for errors on those devices. If I have 100 pairs of (source, dest) sets, then I would be finding the common nodes between 100 lists representing the paths between those two pairs.
Shortest path host a to host d:
['a', 'b', 'c', 'd']
Shortest path host e to host d:
['e', 'b', 'c', 'd']
Shortest path host f to host a:
['f', 'c', 'b', 'a']
^^ common nodes are 'c' and 'b' and hence check these for errors.
- My question is if there is a better way to do this in networkx, where I can take multiple paths between source and dest and find a common set of nodes? I have very limited knowledge of network/graph theory, but this seems like a common problem that's solved using graphs.