@graphty/algorithms
Version:
Graph algorithms library for browser environments implemented in TypeScript
33 lines • 1.08 kB
TypeScript
/**
* Leiden Algorithm for Community Detection
*
* An improved version of the Louvain algorithm that guarantees
* well-connected communities and provides better quality partitions.
*
* Reference: Traag, V.A., Waltman, L. & van Eck, N.J. (2019)
* "From Louvain to Leiden: guaranteeing well-connected communities"
*/
export interface LeidenOptions {
resolution?: number;
randomSeed?: number;
maxIterations?: number;
threshold?: number;
}
export interface LeidenResult {
communities: Map<string, number>;
modularity: number;
iterations: number;
}
/**
* Leiden algorithm for community detection
* Improves upon Louvain by ensuring well-connected communities
*
* @param graph - Undirected weighted graph
* @param options - Algorithm options
* @returns Community assignments and modularity
*
* Time Complexity: O(m) per iteration, typically O(m log m) total
* Space Complexity: O(n + m)
*/
export declare function leiden(graph: Map<string, Map<string, number>>, options?: LeidenOptions): LeidenResult;
//# sourceMappingURL=leiden.d.ts.map