-
-
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
Crashes and strange results in random_spanning_tree
, information_centrality
, intersection_array
, and rich_club_coefficient
#6920
Comments
random_spanning_tree
, current_flow_betweenness_centrality
, information_centrality
, intersection_array
, and rich_club_coefficient
random_spanning_tree
, information_centrality
, intersection_array
, and rich_club_coefficient
Hey, I just encountered a very similar problem on AWS SageMaker. Even the given example for >>> G = nx.Graph([(1, 2), (1, 3), (1, 4), (3, 4), (3, 5), (4, 5)])
>>> nx.resistance_distance(G, 1, 3)
TypeError: rowind and colptr must be of type cint The current environment AWS is supplying by default uses |
Thanks for your mentioning the solution to the exception Best regards, |
@joyemang33 can you share info about the environment where you encountered these errors (e.g. the output of |
Hi, I was trying to fix this issue. The reference paper for information_centrality() considers only undirected connected graphs of 3 vertices or more. What is the expected result for a single node (or 2 node) graph? Should the user check for these preconditions before passing into information_centrality()? intersection_array() is currently defined only for undirected graphs, but the definition of distance regular may hold for directed graphs as well, would this function need to handle the directed case? |
For rich_club_coefficient() For the empty graph, it errors out in degree_histogram(), where max() is called on an empty collections.Counter For the single node graph, the function errors out in _compute_rc(), where edge_degrees is popped outside the for loop. This assumes that there is at least 1 edge in the graph. For edgeless graphs, rich club coefficient dictionary should probably be empty since it is defined only for non-negative degree values d where there exist at least 2 nodes of degree > d. In an edgeless graph, there are no such nodes for any non-negative d. |
When the paper doesn't handle the case (number of nodes less than 3 ) then raise an exception saying that. The OP intent is to make those exceptions more user friendly. |
Understood, I'll add the exception and try to open a PR for it |
Hello~ Here are seven new crash reports, and I merged them here since they are triggered by some similar graph structures.
1.
nx.random_spanning_tree
for a graph with a single node2.
nx.information_centrality
for a graph with a single node, and a graph with a single node and self-loop3.
nx.intersection_array
for an empty graph, and a graph with a single edge4.
nx.rich_club_coefficien
for an empty graph, and a graph with a single nodeThanks a lot for your further confirmation and investigation!
Best regards,
Joye
The text was updated successfully, but these errors were encountered: