set.seed(27)
lazy_mmsbm <- mmsbm(n = 1000, k = 5, expected_density = 0.01)
lazy_mmsbm
# sometimes you gotta let the world burn and
# sample a wildly dense graph
dense_lazy_mmsbm <- mmsbm(n = 500, k = 3, expected_density = 0.8)
dense_lazy_mmsbm
# explicitly setting the degree heterogeneity parameter,
# mixing matrix, and relative community sizes rather
# than using randomly generated defaults
k <- 5
n <- 1000
B <- matrix(stats::runif(k * k), nrow = k, ncol = k)
theta <- round(stats::rlnorm(n, 2))
alpha <- c(1, 2, 4, 1, 1)
custom_mmsbm <- mmsbm(
theta = theta,
B = B,
alpha = alpha,
expected_degree = 50
)
custom_mmsbm
edgelist <- sample_edgelist(custom_mmsbm)
edgelist
# efficient eigendecompostion that leverages low-rank structure in
# E(A) so that you don't have to form E(A) to find eigenvectors,
# as E(A) is typically dense. computation is
# handled via RSpectra
population_eigs <- eigs_sym(custom_mmsbm)
svds(custom_mmsbm)$d
Run the code above in your browser using DataLab