Generic badge DOI Generic badge License: AGPL v3 Travis build status


ghypernet is an OpenSource R package that allows to estimate and work with Generalised Hypergeometric Ensembles of Random Graphs (gHypEG).

ghypernet has been developed specifically for the analysis of networks characterised by a large number of repeated edges. It provides efficient methods to perform hypothesis testing and model selection on such data.

Explore the provided Vignettes for some examples on how to analyse networks with ghypernet.


# Install ghypernet from CRAN

# Or the development version from GitHub:


The package uses the library BiasedUrn to work with Wallenius’ non-central hypergeometric distribution. Although this is not required, it is recommended to install the BiasedUrn R package, increasing the number of ‘colours’, i.e., the number of dimensions of the distribution. It can be easily done modifying the makevar file. In case the BiasedUrn library cannot be found, all computations will be performed using the multinomial approximation.


The theoretical foundation of the generalised hypergeometric ensemble, gHypEGs, has been developed in the following works:

Casiraghi, G., Nanumyan, V., Scholtes, I., & Schweitzer, F. (2016). Generalized Hypergeometric Ensembles: Statistical Hypothesis Testing in Complex Networks. ArXiv Preprint ArXiv:1607.02441.

Casiraghi, G. (2017). Multiplex Network Regression: How do relations drive interactions?. ArXiv Preprint ArXiv:1702.02048, 15.

Casiraghi, G., Nanumyan, V., Scholtes, I., & Schweitzer, F. (2017). From Relational Data to Graphs: Inferring Significant Links Using Generalized Hypergeometric Ensembles (Vol. 10540, pp. 111–120). Springer Verlag.

Casiraghi, G. (2019). The block-constrained configuration model. Applied Network Science, 4(1), 123.

Brandenberger, L., Casiraghi, G., Nanumyan, V., & Schweitzer, F. (2019). Quantifying triadic closure in multi-edge social networks. Proceedings of the 2019 IEEE/ACM International Conference on Advances in Social Networks Analysis and Mining, 307–310.

Casiraghi, G., & Nanumyan, V. (2021). Configuration models as an urn problem. Sci Rep 11, 13416.

Casiraghi, G. (2021) The likelihood-ratio test for multi-edge network models. J. Phys. Complex. 2 035012.


The research and development behind ghypernet is performed at the Chair of Systems Design, ETH Zürich.


Giona Casiraghi (project lead)

Vahan Nanumyan

Laurence Brandenberger


ghypernet is licensed under the GNU Affero General Public License.

  1. Copyright ETH Zürich, 2016-2021