Open wenont opened 3 hours ago
When calculating the average shortest path length, I used nx.average_shortest_path_length(G) in the framework networkx.
nx.average_shortest_path_length(G)
networkx
Then I got: networkx.exception.NetworkXError: Graph is not strongly connected. with the dataset AIDS.
networkx.exception.NetworkXError: Graph is not strongly connected.
According to NetworkX API,
Changed in version 3.0: An exception is raised for directed graphs that are not strongly connected.
Any solutions?
>>>G = nx.Graph([(1, 2), (3, 4)]) >>>for C in (G.subgraph(c).copy() for c in nx.connected_components(G)): print(nx.average_shortest_path_length(C)) 1.0 1.0
When calculating the average shortest path length, I used
nx.average_shortest_path_length(G)
in the frameworknetworkx
.Then I got:
networkx.exception.NetworkXError: Graph is not strongly connected.
with the dataset AIDS.According to NetworkX API,
Any solutions?