I am computing all the possible shortest paths between any two nodes in a regular network. If the network is connected (e.g., largest component = entire network), I have no problems.
The problem arises when I have disconnected components: given that there is no path between node
import networkx as nx
for n in F.nodes(): counts[n]=0
for n in F.nodes():
for j in F.nodes():
for p in gener:
for v in p: counts[v]+=1
nx.bidirectional_dijkstra(F, n, j)
you can use error handling in python for this.
try: nx.bidirectional_dijkstra(F, n, j) except NetworkXNoPath: # do whatever you want
you can use this link for more help