library(fastRG)
library(magrittr)
n = 1000
pop = n/2
a = .1
b = .05
B = matrix(c(a,b,b,a), nrow = 2)
b_model = fastRG::sbm(n = n, k =2,
B = B, edge_distribution = "bernoulli")
b_model %>%
sample_sparse(poisson_edges = F) %>%
rowSums %>% mean
pop*a + pop*b # this should be average degree
Dividing B by two fixes the problem:
b_model = fastRG::sbm(n = n, k =2,
B = B/2, edge_distribution = "bernoulli")
b_model %>%
sample_sparse(poisson_edges = F) %>%
rowSums %>% mean
Perhaps we are symmetrizing the edges at some point... this would double the number of edges.