hatvis: hypergraph analysis and visualization in Python#

hatvis

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. It is the Python successor of two tools of the Abonyi group at the University of Pannonia, the MATLAB-based HAT-VIS (similarity-based hypergraph visualization) and the interactive HyperGodot viewer, and it integrates the hypergraph methods of the group’s work on quality function deployment and on collaborative manufacturing spaces with the most useful methods of the wider literature. Data move to and from HyperNetX, XGI and Hypergraphx through converters and the Hypergraph Interchange Format (HIF).

Representations

Incidence matrices, weighted, fuzzy, directed and temporal hypergraphs; clique and star expansions, s-line graphs, Laplacians, tensors.

hatvis.representations
Interchange

HIF, HyperGodot and SPMF files, CSV and Excel; converters to HyperNetX, XGI and Hypergraphx.

hatvis.io
Visualization

Seriated incidence matrices, PAOH and UpSet views, hulls, isocontours, ellipses, stars and trees; HAT-VIS, HyperGodot and membership-aware layouts; an interactive HTML viewer.

hatvis.plotting
Structure and centrality

s-walks and s-components, s-betweenness and s-closeness, tensor and nonlinear node-edge eigenvector centralities, PageRank, hyper-cores.

hatvis.centrality
Clustering and patterns

Hypergraph modularity and Louvain, spectral and co-clustering, FM partitioning; frequent itemsets, rules, validated hyperedges.

hatvis.community
Problems, dynamics, learning

Covering and transversals, acyclicity and join trees, directed hyperpaths, QFD; contagion and consensus; label spreading and HGNN.

hatvis.problems

Quick start#

pip install hatvis
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
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

Where to go next#

  • Installation: requirements and optional extras.

  • Example gallery: the example gallery, one runnable script per method; every example prints the numbers quoted in the book and can be opened as a Jupyter notebook.

  • The book: the book Hypergraph Analysis and Visualization in Python: theory in one notation, algorithm boxes, and the same examples.

  • API reference: the API reference.

  • Migration guide: coming from HAT-VIS, HyperGodot or another package.