Louvain can leave a community internally disconnected. Leiden inserts a refinement phase between local moving and aggregation: each community is broken back into singletons and rebuilt from the inside, and a node only joins a sub-community that is itself well connected to the rest of its original community.
Details
Determinism: nodes are visited in index order and communities in order of first appearance; no random restarts.
Formula: CPM quality H = sum_c [e_c - gamma * C(n_c, 2)]; a
subset C of community S is well connected when
E(C, S \ C) >= gamma * |C| * (|S| - |C|).
