Community detection (Leiden algorithm) for graphify.
Partitions the knowledge graph into communities using the Leiden algorithm, which improves upon Louvain by adding a refinement phase that guarantees well-connected communities. Falls back to greedy modularity when refinement yields no improvement.