incidence.from.vector: Generates an incidence matrix with given row and column...

View source: R/incidence.from.vector.R

incidence.from.vectorR Documentation

Generates an incidence matrix with given row and column marginal sums

Description

incidence.from.vector generates a random incidence matrix with given row and column sums

Usage

incidence.from.vector(R, C, class = "matrix", narrative = FALSE)

Arguments

R

numeric vector: row marginal sums

C

numeric vector: column marginal sums

class

string: the class of the returned backbone graph, one of c("matrix", "Matrix", "igraph").

narrative

boolean: TRUE if suggested text & citations should be displayed.

Value

An incidence matrix of class matrix or Matrix, or a bipartite graph of class igraph.

References

Neal, Z. P., Domagalski, R., and Sagan, B. 2021. Comparing alternatives to the fixed degree sequence model for extracting the backbone of bipartite projections. Scientific Reports, 11, 23929. doi: 10.1038/s41598-021-03238-3

Neal, Z. P. 2022. incidentally: An R package to generate incidence matrices and bipartite graphs. OSF Preprints doi: 10.31219/osf.io/ectms

Examples

I <- incidence.from.vector(R = c(1,1,2), C = c(1,1,2))
I <- incidence.from.vector(R = c(1,1,2), C = c(1,1,2),
     class = "igraph", narrative = TRUE)

zpneal/incidentally documentation built on Feb. 23, 2023, 11:54 a.m.