CWTSLeiden / networkanalysis

Java package that provides data structures and algorithms for network analysis.
MIT License
144 stars 33 forks source link

Clustering: added some convenience functions. #15

Closed vtraag closed 3 years ago

vtraag commented 3 years ago

This PR allows to also indicate negative cluster identifiers for nodes, which could then be interpreted as indicating that a node is not assigned to a cluster. In principle, a negative cluster could already be set, but this would break a number of operations that assume that cluster numbers are non-negative.

Additionally, three convenience functions are added: clusterWeights and getClusterIsNotEmpty and getNNonEmptyClusters, which are also used internally for some operations.

Finally, the relabeling of empty clusters can now also be done starting from some higher cluster number in removeEmptyClustersLargerThan.

vtraag commented 3 years ago

As discussed, I removed the possibility of using negative cluster numbers to identify missing clusters. So this PR now essentially adds a number of convenience functions.

vtraag commented 3 years ago

Everything is now corrected as requested.