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

Well-connected communities: code line location #73

Closed fcdimitr closed 2 years ago

fcdimitr commented 3 years ago

Could anyone point us to the location in the source code for checking "well-connected" communities? The well-connected property is supposedly a signature feature of the Leiden algorithm.

The checks are described at lines 34 and 37 of algorithm A.2 in the supplementary material of the paper "From Louvain to Leiden" by van Traag, Waltman, and van Eck, 2019.

Many thanks in advance.

vtraag commented 2 years ago

Sorry for the long delay in answering!

Unfortunately, within the framework of this package that particular check cannot be performed. In particular, that can only be easily done for CPM and Modularity, but not for some of the other quality functions. This package is aimed at being able to optimise arbitrary quality functions (i.e. it only requires a diff_move function essentially). This limitation is also explained in the documentation, please see https://leidenalg.readthedocs.io/en/stable/reference.html#optimiser for more details.

If the particular guarantee of subpartition γ-density is important to you, you can either use the Java implementation available from https://github.com/CWTSLeiden/networkanalysis, or you can use the implementation in igraph itself, see https://igraph.org/python/api/latest/igraph.Graph.html#community_leiden. These implementations follow the original paper exactly, but are less flexible than this package.

I'll close the issue now, but if you have any follow-up questions, let me know and feel free to re-open the issue.