Skip to content
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

Fix assortativity_coeff in graphs.utilities #119

Open
CharJon opened this issue Apr 8, 2021 · 2 comments
Open

Fix assortativity_coeff in graphs.utilities #119

CharJon opened this issue Apr 8, 2021 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@CharJon
Copy link
Owner

CharJon commented Apr 8, 2021

Using this graph in example/graph_properties.py I got:
/home/jochar/miniconda3/envs/geco/lib/python3.8/site-packages/networkx/algorithms/assortativity/correlation.py:287: RuntimeWarning: invalid value encountered in double_scalars return (xy * (M - ab)).sum() / numpy.sqrt(vara * varb)

@CharJon CharJon added the bug Something isn't working label Apr 8, 2021
@mmghannam
Copy link
Collaborator

mmghannam commented Apr 11, 2021

I could not reproduce the error, I loaded the graph and called nx.degree_assortativity_coefficient() on it and -0.020197899023141477 was the result. I looked up the error and it seems like it's a division by zero error because of numerical instability (numbers are too small so they are approximated to zero), I found the info here.

@CharJon
Copy link
Owner Author

CharJon commented Apr 12, 2021

I could not reproduce the error, I loaded the graph and called nx.degree_assortativity_coefficient() on it and -0.020197899023141477 was the result. I looked up the error and it seems like it's a division by zero error because of numerical instability (numbers are too small so they are approximated to zero), I found the info here.

As discussed: We should try to catch this error and set the value to None. And possibly print a warning.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants