vtraag / leidenalg

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

Function find_partition() have no is_membership_fixed argument #99

Open CDPDisk opened 2 years ago

CDPDisk commented 2 years ago

I noticed that in your docs about fixed nodes it says:

This can be done using the _is_membershipfixed argument of find_partition(), see 2 for some details.

And a sample program is provided. But after I viewed the code of _findpartition(), I found that _findpartition() does not support the argument _is_membershipfixed. If I were to use it, I'd have to give up _findpartition() and customize a new _findpartition() myself to use this argument. Although it is easy, I'd like to add the argument to find_partition() in the future version.

vtraag commented 2 years ago

Indeed, find_partition does not support this argument now right away. For more advanced uses, you should construct an Optimiser object and call optimise_partition, for which you can use the argument is_membership_fixed, e.g. for some partition and some list fixed indicating for each node whether its membership is fixed, you can call it like

optimiser = la.Optimiser()
diff = optimiser.optimise_partition(partition, is_membership_fixed=fixed)

Your question is essentially whether is_membership_fixed can also be made available directly through find_partition?

CDPDisk commented 2 years ago

Yes, I hope is_membership_fixed can also be made available directly through find_partition. So fixing membership can be more easy.