fastball randomizes a binary matrix, preserving the row and column sums
fastball(M, trades = 5 * nrow(M))
matrix: a binary matrix (see details)
integer: number of trades; the default is 5R trades (approx. mixing time)
Given a matrix
fastball randomly samples a new matrix from the space of all matrices with the same row and column sums as
matrix: A random binary matrix with same row sums and column sums as M.
Godard, Karl and Neal, Zachary P. 2022. fastball: A fast algorithm to sample bipartite graphs with fixed degree sequences. arXiv:2112.04017
M <- matrix(rbinom(200,1,0.5),10,20) #A random 10x20 binary matrix Mrand <- fastball(M) #Random matrix with same row and column sums
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.