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

coexnet findThreshold() test will break in igraph 1.2.7 #4

Open
ntamas opened this issue Oct 13, 2021 · 0 comments
Open

coexnet findThreshold() test will break in igraph 1.2.7 #4

ntamas opened this issue Oct 13, 2021 · 0 comments

Comments

@ntamas
Copy link

ntamas commented Oct 13, 2021

The test_findThreshold() test case in coexnet will break with the next patch release of igraph (version 1.2.7); hereby I am seeking help from the maintainers of coexnet to fix this issue in coexnet before the next release of igraph gets submitted to CRAN.

I am not familiar with how findThreshold() is supposed to work, but I have noticed that it is doing several calls to igraph's fit_power_law() function; in this particular case, the function is called with several vectors that definitely do not follow a power-law distribution, or vectors where it is impossible to decide because the vector itself is too short to draw any meaningful conclusions. igraph 1.2.6 (the version on CRAN) and 1.2.7 (the upcoming version) both return a fit object with a log-likelihood of NaN and a fitted exponent of infinity to indicate that. The Kolmogorov-Smirnov statistic is also very high (on my machine it is 1.79e+308) to indicate failure. Unfortunately, igraph 1.2.6 (or, more precisely, the vendored plfit library in it) had a bug that returned a Kolmogorov-Smirnov p value of 1 in this case instead of 0, which would be the correct value. igraph 1.2.7 will fix this bug, but as a consequence the test_findThreshold() test case will fail with the first example (where it uses a correlation matrix of size 5x5).

I managed to debug this up to the point where it seems that mtr_p in the findThreshold function contains one element only, and thus mtr_f becomes empty because it looks for values in mtr_p that are strictly larger than the minimum value in mtr_p. Replacing the > operator with >= in the appropriate comparison fixes the original error I saw in the test case, but now the output is different and is not equal to the expected 0.01 that the test case wants.

All in all, I think that findThreshold() should check whether the result of the power-law fit makes sense (by, e.g., looking at whether the exponent is finite). This would make the behaviour consistent between igraph 1.2.6 and igraph 1.2.7, although the test case will require adjustments.

You can install the development version of igraph (the upcoming 1.2.7 release) with devtools::install_github("igraph/rigraph") if you would like to test this yourself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant