sample_bsbm {motifcluster}R Documentation

Sample a bipartite stochastic block model (BSBM)

Description

Sample the (weighted) adjacency matrix of a (weighted) bipartite stochastic block model (BSBM) with specified parameters.

Usage

sample_bsbm(
  source_block_sizes,
  dest_block_sizes,
  bipartite_connection_matrix,
  bipartite_weight_matrix = NULL,
  sample_weight_type = c("unweighted", "constant", "poisson")
)

Arguments

source_block_sizes

A vector containing the size of each block of source vertices.

dest_block_sizes

A vector containing the size of each block of destination vertices.

bipartite_connection_matrix

A matrix containing the source block to destination block connection probabilities.

bipartite_weight_matrix

A matrix containing the source block to destination block weight parameters. Unused for sample_weight_type = "constant". Defaults to NULL.

sample_weight_type

The type of weighting scheme. One of "unweighted", "constant" or "poisson".

Value

A randomly sampled (weighted) adjacency matrix of a BSBM.

Examples

source_block_sizes <- c(10, 10)
dest_block_sizes <- c(10, 10, 10)
bipartite_connection_matrix <- matrix(c(0.8, 0.5, 0.1, 0.1, 0.5, 0.8),
      nrow = 2, byrow = TRUE)
bipartite_weight_matrix = matrix(c(20, 10, 2, 2, 10, 20),
      nrow = 2, byrow = TRUE)
sample_bsbm(source_block_sizes, dest_block_sizes,
      bipartite_connection_matrix, bipartite_weight_matrix, "poisson")

[Package motifcluster version 0.2.3 Index]