The CompleX Group Interactions (XGI) library provides data structures and algorithms for modeling and analyzing complex systems with group (higher-order) interactions. For more information about what higher-order interactions are, see a brief overview.

Many datasets can be represented as graphs, where pairs of entities (or nodes) are related via links (or edges). Examples are road networks, energy grids, social networks, neural networks, etc. However, in many other datasets, more than two entities can be related at a time. For example, many scientists (entities) can collaborate on a scientific article together (links), and multiple email accounts (entities) can all participate on the same email thread (links). In this latter case, graphs no longer present a viable alternative to represent such datasets. It is for this kind of datasets, where the interactions are given among groups of more than two entities (also called higher-order interactions), that XGI was designed for.

XGI is implemented in pure Python and is designed to seamlessly interoperate with the rest of the Python scientific stack (numpy, scipy, pandas, matplotlib, etc). XGI is designed and developed by network scientists with the needs of network scientists in mind.

Sign up for our mailing list and follow XGI on Twitter or Mastodon!


To install and use XGI as an end user, execute

pip install xgi

To install for development purposes, first clone the repository and then execute

pip install -e .['all']

If that command does not work, you may try the following instead

pip install -e .\[all\]

XGI was developed and tested for Python 3.8-3.12 on Mac OS, Windows, and Ubuntu.

Corresponding Data

A number of higher-order datasets are available in the XGI-DATA repository and can be easily accessed with the load_xgi_data() function.


If you want to contribute to this project, please make sure to read the contributing guidelines. We expect respectful and kind interactions by all contributors and users as laid out in our code of conduct.

The XGI community always welcomes contributions, no matter how small. We’re happy to help troubleshoot XGI issues you run into, assist you if you would like to add functionality or fixes to the codebase, or answer any questions you may have.

Some concrete ways that you can get involved:

  • Get XGI updates by following the XGI Twitter account, signing up for our mailing list, or starring this repository.

  • Spread the word when you use XGI by sharing with your colleagues and friends.

  • Request a new feature or report a bug by raising a new issue.

  • Create a Pull Request (PR) to address an open issue or add a feature.

  • Join our Zulip channel to be a part of the daily goings-on of XGI.

How to Cite

We acknowledge the importance of good software to support research, and we note that research becomes more valuable when it is communicated effectively. To demonstrate the value of XGI, we ask that you cite the XGI paper in your work. You can cite XGI either by going to our repository page repository page and clicking the “cite this repository” button on the right sidebar (which will generate a citation in your preferred format) or by copying the following BibTeX entry:

author = {Landry, Nicholas W. and Lucas, Maxime and Iacopini, Iacopo and Petri, Giovanni and Schwarze, Alice and Patania, Alice and Torres, Leo},
title = {{XGI: A Python package for higher-order interaction networks}},
doi = {10.21105/joss.05162},
journal = {Journal of Open Source Software},
publisher = {The Open Journal},
year = {2023},
month = may,
volume = {8},
number = {85},
pages = {5162},
url = {https://doi.org/10.21105/joss.05162},

Academic References


The XGI package has been supported by NSF Grant 2121905, HNDS-I: Using Hypergraphs to Study Spreading Processes in Complex Social Networks.


This project is licensed under the BSD 3-Clause License.

Copyright (C) 2021-2023 XGI Developers