set.seed(27)
lazy_dcsbm <- dcsbm(n = 100, k = 5, expected_density = 0.01)
lazy_dcsbm
# sometimes you gotta let the world burn and
# sample a wildly dense graph
dense_lazy_dcsbm <- dcsbm(n = 50, k = 3, expected_density = 0.8)
dense_lazy_dcsbm
# explicitly setting the degree heterogeneity parameter,
# mixing matrix, and relative community sizes rather
# than using randomly generated defaults
k <- 5
n <- 100
B <- matrix(stats::runif(k * k), nrow = k, ncol = k)
theta <- round(stats::rlnorm(n, 2))
pi <- c(1, 2, 4, 1, 1)
custom_dcsbm <- dcsbm(
theta = theta,
B = B,
pi = pi,
expected_degree = 50
)
custom_dcsbm
edgelist <- sample_edgelist(custom_dcsbm)
edgelist
dcsbm_explicit_block_sizes <- dcsbm(
theta = rexp(100, 1 / 3) + 1,
B = B,
block_sizes = c(13, 17, 40, 14, 16),
expected_degree = 5
)
# respects block sizes
summary(dcsbm_explicit_block_sizes$z)
# 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_dcsbm)
Run the code above in your browser using DataLab