sample_tdcsbm {nett}R Documentation

Sample truncated DCSBM (fast)

Description

Sample an adjacency matrix from a truncated degree-corrected block model (DCSBM) using a fast algorithm.

Usage

sample_tdcsbm(z, B, theta = 1)

Arguments

z

Node labels (n * 1)

B

Connectivity matrix (K * K)

theta

Node connectivity propensity vector (n * 1)

Details

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, \theta_i \theta_j).

The approach uses the masking idea of Aiyou Chen, leading to fast sampling for sparse networks. The masking, however, truncates \theta_i \theta_j to at most 1, hence we refer to it as the truncated DCSBM.

Value

An adjacency matrix following DCSBM

Examples

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)))

[Package nett version 1.0.0 Index]