bctpy icon indicating copy to clipboard operation
bctpy copied to clipboard

local_assortativity_wu_sign not separating signs properly

Open ghost opened this issue 1 year ago • 0 comments

In computing the local assortativity for signed, unweighted networks, local_assortativity_wu_sign executes the following two lines r_pos = assortativity_wei(W * (W > 0)) r_neg = assortativity_wei(W * (W < 0))

np.isnan(r_neg).any()) would return True no matter what network I input into this function.

In the second line, the array passed to assortativity_wei has strictly negative values. In assortativity_wei, we compute i, j = np.where(np.triu(CIJ, 1) > 0)

This will always give back i = j = 0. I would get divide by 0 warnings when this function divided by K = len(i) in later steps.

I made the methods functional by adding a negative sign to the argument where we find r_neg, i.e., r_neg = assortativity_wei(-W * (W < 0)) But I don't know if this compromises the statistics.

ghost avatar Sep 28 '23 15:09 ghost