fastRG quickly samples a broad class of network models known as generalized random product graphs. In particular, for matrices X, S and Y, fastRG samples a matrix A with expectation X S Y^T where individual entries are Poisson distributed. We recommend that you think of A as the adjacency matrix for a graph (or a multi-graph). Crucially, the sampling is O(m), where m is the number of the edges in graph. Other algorithms are O(n^2), where n is the number of nodes in the network. For additional details, see the paper.

Installation

fastRG is not yet on CRAN. You can install the development version with:

Example Usage

The easiest way to use fastRG is to use wrapper functions that sample from popular graph models. For example, to sample from an Erdos-Renyi graph n = 1,000,000 nodes and expected degree of five, we can use the erdos_renyi() function.

We strongly advise that you always set avg_deg, as it is easy to request very large and dense graphs without this scaling.

By default we always get a Matrix::sparseMatrix(), but we can also ask for the graph as an edgelist as well.

This results in a fast way to create igraph objects using igraph::graph_from_edgelist().

Other languages

The fastRG sampler has been implemented in Python here.