Skip to content

@graphty/algorithms / index / leiden

Function: leiden() ​

leiden(graph, options): LeidenResult

Defined in: algorithms/community/leiden.ts:591

Leiden algorithm for community detection Improves upon Louvain by ensuring well-connected communities

Parameters ​

graph ​

Graph

Undirected weighted graph - accepts Graph class or Map representation

options ​

LeidenOptions = {}

Algorithm options

Returns ​

LeidenResult

Community assignments and modularity

Time Complexity: O(m) per iteration, typically O(m log m) total Space Complexity: O(n + m)