-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ValueError crash in "nx.degree_pearson_correlation_coefficient" when input graph with no edges #6913
Comments
After the investigation, I also found a similar issue in Step to Reproduceimport networkx as nx
G = nx.Graph()
G.add_node(0)
G.add_node(1)
print(nx.k_components(G)) Result:
Best regards, |
No need to apologize @joyemang33 , we very much appreciate the work you're doing by finding & reporting these cases! Out of curiosity - are you using some sort of "fuzzing" tool or otherwise procedural workflow to find corner-cases? |
Hi @rossbar! Thanks for your response. We are trying to develop a fully automated tool for graph libraries, including a fuzzing component to detect such corner cases, as well as a method based on metamorphic testing to detect potential logic issues (i.e., strange results). Best regards, |
This one occurs because there are no edges in the graph... It shouldn't matter how many nodes. So adding a check with |
Hi @dschult @rossbar @MridulS ! Thanks a lot for your kind review of these corner cases #6913 #6914 #6915 #6916. I will create PRs to fix them one by one in the future, as well as report the remaining cases in one new report. For #6912, I have no idea about the root cause of the crash. It would be appreciated if you could help me take a look at that :). Best regards, |
Hello! I am so sorry to bother you to investigate again, but I have no idea about this probable issue.
When testing NetworkX with a graph without edges, I found a strange crash in
nx.degree_pearson_correlation_coefficient
, with the following message:The statement that triggers the crash is here.
Since I am not sure whether
degree_pearson_correlation_coefficient
has a good definition in such graphs, it would be highly appreciated if you could help me further confirm and investigate this issue.If there is no good definition, maybe we could throw a NetworkX Exception for users instead of the system exception.
Best regard,
Joye
Step to Reproduce
Running the following Python code:
Result:
Environment
NetworkX 3.1
Python 3.10
The text was updated successfully, but these errors were encountered: