This module is an ALIAS. Modularity is implemented once, in
Sgtmodq; this entry point delegates. It is the same quantity as
Modulq; the two module names differ only in which paper they
cite.
Arguments
- A
Symmetric adjacency or weight matrix.
- communities
Integer community label per node.
Value
List with Q, estimate, n_communities, n.
Details
Q = (1 / 2m) sum_ij [A_ij - k_i k_j / 2m] delta(c_i, c_j).
Examples
A <- matrix(0, 6, 6); A[1:3, 1:3] <- 1; A[4:6, 4:6] <- 1; A[3, 4] <- A[4, 3] <- 1; diag(A) <- 0
Modlar(A, communities = c(1, 1, 1, 2, 2, 2))$Q
#> [1] 0.3571429