vtraag / leidenalg

Implementation of the Leiden algorithm for various quality functions to be used with igraph in Python.
GNU General Public License v3.0
596 stars 78 forks source link

Rename membership argument in renumber_communities #43

Closed vtraag closed 4 years ago

vtraag commented 4 years ago

It might actually make sense to rename membership to fixed_membership. Additionally, a sort of relabelling object might be more appropriate than the map, also in terms of speed. This would essentially consist of two vectors,

vector<size_t> fixed_nodes;
vector<size_t> fixed_memberships;

where fixed_nodes contains the nodes that are fixed, and fixed_memberships is of length the number of nodes in the graph (n), and contains for each node the fixed membership (which is only meaningful for a node in fixed_nodes. Possibly, an additional boolean vector is_node_fixed could be used to determine quickly whether a node is fixed or not, but I don't immediately know whether that is necessary or not.

Or we could work with these two vectors directly.

In addition, we should probably rename fixed_nodes in Optimiser to is_node_fixed for clarity.

Originally posted by @vtraag in https://github.com/vtraag/leidenalg/pull/40