Skip to contents

Alias of Leidenclus, the Leiden algorithm of Traag, Waltman and van Eck (2019, Algorithm A.2): fast local moving, refinement of each community into well-connected sub-communities, and aggregation, repeated.

Usage

LemR(A, resolution = 1, quality = "modularity", max_iter = 20L, seed = 0)

leiden_grph(
  A,
  resolution = 1,
  quality = "modularity",
  max_iter = 20L,
  seed = 0
)

Arguments

A

Symmetric non-negative weighted adjacency matrix.

resolution

Resolution parameter gamma.

quality

"modularity" or "cpm".

max_iter

Leiden iterations.

seed

Philox seed.

Value

List with labels (0-based, matching the Python arm), estimate, quality, n_communities, connected, passes, n, method.

References

Traag, V. A., Waltman, L. and van Eck, N. J. (2019). From Louvain to Leiden: guaranteeing well-connected communities. Scientific Reports, 9, 5233, arXiv:1810.08473.

Examples

blocks <- matrix(0, 6, 6)
blocks[1:3, 1:3] <- 1; blocks[4:6, 4:6] <- 1; diag(blocks) <- 0
blocks[3, 4] <- blocks[4, 3] <- 1
LemR(blocks)$labels
#> [1] 0 0 0 1 1 1