Louvain or other modularity-based community detection algorithms

Hi,

I was looking at the documentation hoping to see if there are any modularity-based community detection algorithms implemented in graph-tool, but could not find any. Could anyone confirm if it is possible to do so in graph-tool?

Thanks!

It is in fact possible to perform modularity maximization with graph-tool. For that you need to use the ModularityState object instead of BlockState, as documented in the inference HOWTO, e.g.

>>> state = gt.minimize_blockmodel_dl(g, state=gt.ModularityState)

However, please note that this is almost always a terrible idea.

Modularity maximization is a substantially inferior method to the inference-based ones that are implemented in graph-tool, since it does not possess any kind of statistical regularization. Among many other problems, the method tends to massively overfit empirical data.

For a more detailed explanation see here: “Modularity maximization considered harmful”