Skip to content

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

Description

@ntamas

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions