hatvis: hypergraph analysis and visualization in Python

hatvis is a Python toolbox for the analysis and visualization of
hypergraphs, the natural model of interactions that join more than two
entities at once: a manufacturing task that needs an operator, a robot and a
fixture together, a news article that combines several topics, a customer
requirement served by several engineering solutions. It is the Python
successor of two tools of the Abonyi group at the University of Pannonia,
the MATLAB-based HAT-VIS
(Czvetkó and Abonyi, SoftwareX 2024) and the interactive HyperGodot viewer
(Ficsor et al., SoftwareX 2025). It contains the hypergraph methods of the
group's work on quality function deployment (Heliyon 2022) and on
collaborative manufacturing spaces (J. Manuf. Syst. 2022), and the most
useful methods of the wider literature, from s-walk centralities and
hypergraph modularity to h-motifs, validated hyperedges and hypergraph neural
networks. Data move to and from HyperNetX, XGI and Hypergraphx through
converters and the Hypergraph Interchange Format (HIF).
| Module |
Contents |
hatvis.core |
Hypergraph (sparse incidence matrix, weights, fuzzy memberships, α-cuts, attributes, dual, restriction), DirectedHypergraph, TemporalHypergraph |
hatvis.representations |
clique and star expansions, line and s-line graphs, intersection and co-occurrence matrices, Laplacians (normalized, random-walk, Bolla, clique), adjacency, degree and Laplacian tensors, simplicial closure |
hatvis.io |
HIF, HyperGodot and SPMF files, incidence CSV and Excel; converters to and from HyperNetX, XGI, Hypergraphx and NetworkX bipartite graphs |
hatvis.seriation |
barycentric (HAT-VIS), correspondence-analysis and hierarchical (optimal leaf ordering) ordering of incidence matrices, quality measures, bicluster blocks |
hatvis.layout, hatvis.similarity |
HAT-VIS similarity with max-product transitive closure, classical MDS and Sammon mapping, HyperGodot force-directed layout, a membership-aware layout, circular, radial, spectral and bipartite layouts, layout quality (stress, intrusions), hypergraph distances |
hatvis.plotting, hatvis.interactive |
seven hyperedge styles (hull, padded concentric hull, smooth curve, isocontour, minimum-volume ellipse, star, spanning tree), seriated incidence matrices, PAOH and UpSet views, house of quality, primal-dual views, s-walk and motif profiles, interactive HTML viewer |
hatvis.metrics, hatvis.centrality, hatvis.spectral |
s-components, s-distances and s-profiles; s-betweenness and s-closeness, clique, Z-, H- and nonlinear node-edge eigenvector centralities, PageRank, hyper-cores; random walks and spectral embedding; clustering, assortativity, nestedness, simpliciality |
hatvis.community, hatvis.partition |
strict and all-or-nothing hypergraph modularity, hypergraph Louvain, label propagation, spectral clustering and co-clustering, Fiduccia-Mattheyses bisection, cut and connectivity metrics |
hatvis.patterns |
itemset hypergraphs, frequent, closed and maximal itemsets, association-rule hyperarcs, ARHP clustering weights, statistically validated hyperedges, inclusion lattices and formal concepts |
hatvis.motifs, hatvis.models |
the 26 h-motifs and node motifs with z-scores; uniform, random, Chung-Lu, configuration and planted-partition models |
hatvis.problems, hatvis.qfd |
set cover and hitting set (exact ILP and greedy), minimal transversals, matching, coloring and 2-colorability, GYO reduction and join trees, conformality, Helly property, B-reachability and shortest hyperpaths; hypergraph and network-flow based quality function deployment |
hatvis.dynamics, hatvis.learning, hatvis.temporal |
diffusion, nonlinear group consensus, threshold contagion; label spreading, HGNN features and classifier, hyperedge prediction; turnover, persistence, differences and temporal centrality |
hatvis.datasets |
the HAT-VIS and HyperGodot examples, the collaborative manufacturing cyber-physical system, the electric-car QFD, a wire-harness assembly network and a synthetic news-topic generator |
Installation
pip install hatvis
pip install "hatvis[interop]" # HyperNetX, XGI, Hypergraphx converters and Excel input
Python ≥ 3.10; depends on numpy, scipy, pandas, networkx, scikit-learn and matplotlib.
Quick start
import hatvis as hv
from hatvis.plotting import draw_hypergraph, plot_incidence
H = hv.Hypergraph({"e1": ["v1", "v2", "v3"], "e2": ["v1", "v2", "v4"], "e3": ["v3", "v4", "v5"]})
H.degrees() # pandas Series indexed by the vertices
S = hv.vertex_similarity(H, transitive=True) # HAT-VIS similarity
hv.s_betweenness(H, s=2) # s-walk centrality of the hyperedges
draw_hypergraph(H, layout="membership", style="smooth")
plot_incidence(H, order="barycentric")
hv.to_html(H, "my_hypergraph.html") # interactive viewer in the browser
cps = hv.datasets.load_manufacturing_cps() # collaborative manufacturing space
hv.community.hypergraph_louvain(cps, random_state=0)
Documentation and book
- Documentation: https://complexsystemsintelligence.github.io/hatvis,
with an example gallery of 39 scripts (each can be opened as a Jupyter
notebook or in Google Colab) and the API reference.
- Book: Hypergraph Analysis and Visualization in Python: The hatvis
toolbox by János Abonyi, Tímea Czvetkó and Attila Ficsor, 13 chapters and 3 appendices:
read online,
PDF,
EPUB.
The book develops every method in one notation and uses the gallery scripts
as its examples, so the book, the documentation and the code show the same
numbers.
Development
git clone https://github.com/ComplexSystemsIntelligence/hatvis.git
cd hatvis
pip install -e ".[dev]"
pytest # unit tests and doctests
python docs/build_api_pages.py && sphinx-build -b html docs docs/_build/html
book/build.sh # book PDF (TeX Live, latexmk, biber)
DESIGN.md fixes the notation and the API conventions shared by the code,
the documentation and the book.
Citing
If you use hatvis, please cite it (see CITATION.cff) together with the
original publications of the methods you use; the docstrings and the book
list them. The predecessors of the toolbox are
- T. Czvetkó, J. Abonyi, Version [1.0]- HAT-VIS — A MATLAB-based hypergraph visualization tool, SoftwareX 28 (2024) 101963, doi:10.1016/j.softx.2024.101963
- A. Ficsor, T. Czvetkó, V. Sebestyén, J. Abonyi, HyperGodot: Interactive hypergraph visualization tool, SoftwareX 31 (2025) 102315, doi:10.1016/j.softx.2025.102315
- J. Abonyi, T. Czvetkó, Hypergraph and network flow-based quality function deployment, Heliyon 8 (2022) e12263, doi:10.1016/j.heliyon.2022.e12263
- L. Nagy, T. Ruppert, A. Löcklin, J. Abonyi, Hypergraph-based analysis and design of intelligent collaborative manufacturing space, J. Manuf. Syst. 65 (2022) 88–103, doi:10.1016/j.jmsy.2022.08.001
License and acknowledgment
Code: MIT License. Book (book/ directory): CC BY 4.0.
The development was supported by the National Research, Development and
Innovation Office of Hungary (NKFIH) through the OTKA K 143482 project
Monitoring complex systems by goal-oriented clustering algorithms.