You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello! Sorry for bothering you again.
When testing NetworkX, I found a ZeroDivisonError crash in nx.global_reaching_centrality when the input graph only contains one node, with the following message:
File "/home/qiuyang/.local/lib/python3.10/site-packages/networkx/algorithms/centrality/reaching.py", line 196, in local_reaching_centrality
return (len(paths) - 1) / (len(G) - 1)
I am not sure whether reaching_centrality has a good definition in such cases, but this ZeroDivisonError may not be good to show for users. Could you further help me confirm and investigate it, it would be highly appreciated.
The statement that triggers the exception is here.
After the investigation, I found that there are similar issues in nx.flow_hierarchy, non_randomness, approximate_current_flow_betweenness_centrality, edge_current_flow_betweenness_centrality, and current_flow_betweenness_centrality.
I found that Flow Hierarchy has no definition in such graphs, maybe we should return a NetworkX Exception to warn users in such cases. For flow_betweenness_centrality, I am not sure whether we should return a NetworkX Exception or calculate the centrality for such a graph.
PS: HITS also failed in such a graph with the message:
File "/home/qiuyang/.local/lib/python3.10/site-packages/networkx/algorithms/link_analysis/hits_alg.py", line 82, in hits
_, _, vt = sp.sparse.linalg.svds(A, k=1, maxiter=max_iter, tol=tol)
File "/home/qiuyang/.local/lib/python3.10/site-packages/scipy/sparse/linalg/_eigen/_svds.py", line 443, in svds
args = _iv(A, k, ncv, tol, which, v0, maxiter, return_singular_vectors,
File "/home/qiuyang/.local/lib/python3.10/site-packages/scipy/sparse/linalg/_eigen/_svds.py", line 49, in _iv
raise ValueError(message)
ValueError: `k` must be an integer satisfying `0 < k < min(A.shape)`.
Hello! Sorry for bothering you again.
When testing NetworkX, I found a
ZeroDivisonError
crash innx.global_reaching_centrality
when the input graph only contains one node, with the following message:I am not sure whether
reaching_centrality
has a good definition in such cases, but thisZeroDivisonError
may not be good to show for users. Could you further help me confirm and investigate it, it would be highly appreciated.The statement that triggers the exception is here.
Best regards,
Joye
Step to Reproduce
Result
Environment
NetworkX 3.1
Python 3.10
The text was updated successfully, but these errors were encountered: