I’m using networkx to manage large network graph which consists of 50k nodes.
I want to calculate the shortest path length between a specific set of nodes, say N.
For that i’m using the nx.shortest_path_length function.
In some of the nodes from N there might not be a path so networkx is raising and stopping my program.
Is there any way to run this program without any error?
And to tell to shortest_path_length to return some maximum value?
Code simply uses nx.shortest_path_length(G,i,j)in loop.
and error is as follows
raise nx.NetworkXNoPath("No path between %s and %s." % (source, target))
networkx.exception.NetworkXNoPath: No path between V and J
1 Answer