We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents e42d407 + 0b085cc commit d40473cCopy full SHA for d40473c
brainx/modularity.py
@@ -1359,7 +1359,9 @@ def _divide_partition(p, max_div=np.inf):
1359
# if the mask is all True or all False, this will not split the partition
1360
# and would create an empty partition
1361
# catch by checking max vector contains pos and neg values
1362
- if np.abs(v_max.sum()) == np.abs(v_max).sum():
+ is_positive = np.sign(v_max) >= 0
1363
+ is_negative = np.sign(v_max) <= 0
1364
+ if np.all(is_positive) or np.all(is_negative):
1365
return [p]
1366
s = np.ones_like(v_max)
1367
s[mask] = -1
0 commit comments