Software for higher-order networks#
CompleX Group Interactions (XGI) is a Python package for modeling, analyzing, and visualizing higher-order networks: hypergraphs, directed hypergraphs, and simplicial complexes. It covers the whole workflow, from start to finish, with data structures, generative models, measures, datasets, and drawing tools.
Higher-order networks generalize standard (pairwise) networks to interactions between any number of entities, such as collaborations between several authors or contagion in groups. For more information, see this brief overview.
If you know NetworkX, you already know XGI: add nodes and edges, then query them, with a familiar API.
Compute, filter, and combine node and edge statistics in one line, e.g., H.nodes.degree.asnumpy() or H.nodes.filterby("degree", 3). See the cheatsheet.
Built on NumPy, SciPy, pandas, NetworkX, and matplotlib. Convert to and from matrices, dataframes, and graphs to use XGI with the rest of your tools.
50+ curated higher-order datasets from XGI-DATA, loaded in one line with xgi.load_xgi_data().
Designed and developed by network scientists, with the latest measures, models, and algorithms from the higher-order network literature.
BSD-licensed and developed in the open. Contributions of any size are welcome: see the contributing guide.
Get started#
Install XGI with
pip install xgi
For other options, see the installation guide. Then, take a look at the XGI in 1 minute tutorial or the other tutorials.
An example
import xgi
# build
hyperedges = [[1, 2, 3], [3, 4, 5], [3, 6], [6, 7, 8, 9], [1, 4, 10, 11, 12], [1, 4]]
H = xgi.Hypergraph(hyperedges)
# analyze
H.edges.size.asnumpy() # array([3, 3, 2, 4, 5, 2])
H.nodes.filterby("degree", 3) # nodes 1, 3, 4
# visualize
pos = xgi.barycenter_spring_layout(H, seed=1)
xgi.draw(H, pos=pos)
Get involved#
Contributions of any size are welcome, and we’re happy to help! To report a bug or request a feature, open an issue. For more, see the contributing guide. Browse the projects using XGI to see how others use it, and add yours!
Cite#
We acknowledge the importance of good software to support research. To demonstrate the value of XGI, we ask that you cite the XGI paper in your work. You can also use the “Cite this repository” button on our GitHub page.
Landry, N. W., Lucas, M., Iacopini, I., Petri, G., Schwarze, A., Patania, A., & Torres, L. (2023). XGI: A Python package for higher-order interaction networks. Journal of Open Source Software, 8(85), 5162.
BibTeX
@article{Landry_XGI_2023,
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},
}
License#
Released under the 3-Clause BSD license.
Support#
See details here.