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

Enhancement request: add parameter to 'find_partition' to stop iterations if optimised partition was found earlier #76

Closed ivan-marroquin closed 3 years ago

ivan-marroquin commented 3 years ago

Hi,

Thanks for making available such great package!

I am using Python 3.6.5 with leidenalg 0.8.4. I was wondering if it could be possible to add a parameter to function 'find_partition' that will stop the search given a number of iterations as soon as an optimised partition was found earlier. I think that such parameter could save time as unnecessary search steps are avoided.

Best regards, Ivan

ivan-marroquin commented 3 years ago

I found the answer in the documentation:

n_iterations (int) – Number of iterations to run the Leiden algorithm. By default, 2 iterations are run. If the number of iterations is negative, the Leiden algorithm is run until an iteration in which there was no improvement.

Sorry for the inconvenience

Ivan