sample_tdcsbm | R Documentation |
Sample an adjacency matrix from a truncated degree-corrected block model (DCSBM) using a fast algorithm.
sample_tdcsbm(z, B, theta = 1)
z |
Node labels (n * 1) |
B |
Connectivity matrix (K * K) |
theta |
Node connectivity propensity vector (n * 1) |
The function samples an adjacency matrix from a truncated DCSBM, with entries having Bernoulli distributions with mean
E[A_{ij} | z] = B_{z_i, z_j} \min(1, θ_i θ_j).
The approach uses the masking idea of Aiyou Chen, leading to fast sampling for sparse networks. The masking, however, truncates θ_i θ_j to at most 1, hence we refer to it as the truncated DCSBM.
An adjacency matrix following DCSBM
B = pp_conn(n = 10^4, oir = 0.1, lambda = 7, pri = rep(1,3))$B head(sample_tdcsbm(sample(1:3, 10^4, replace = TRUE), B, theta = rexp(10^4)))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.