bipartite.add.blocks: Adds a block structure to a bipartite network
Description
`bipartite.add.blocks` rewires a bipartite graph B to have a block structure such that edges are
located within-block with `density` probability, while preserving both degree distributions.
Usage
bipartite.add.blocks(B, blocks = 2, density = 0.5, max.tries = 1e+05)
Arguments
B
A bipartite network object of class "matrix", "sparseMatrix", igraph, matrix or dataframe edgelist, or network
blocks
integer: number of blocks to add (between 2 and 26)
density
numeric: desired within-block density
max.tries
numeric: number of ineligible re-wiring attempts before giving up
Details
Each row node and each column node are randomly assigned to one of `blocks` number of groups. Then
degree-preserving checkerboard swaps are performed that increase the within-block density, until `density`
is achieved. Eligible swaps are identified randomly, so the re-wiring can be slow when B is large. The process
can get stuck when no eligible swaps remain but the target `density` has not been achieved; if this happens, increase
`max.tries` to keep looking for eligible swaps or reduce the target `density`.