Hypergraph Analysis and Visualization in PythonThe hatvis toolbox

Appendix A
API reference

This appendix lists every public class and function of hatvis, module by module, with the first sentence of its docstring. The lists are generated from the __all__ attribute of each module by book/build_api_appendix.py, so they are complete by construction; the full signatures, parameters, and attributes are in the online documentation and in the docstrings (help(hatvis.layout.layout_membership)). The conventions shared by all functions are described in section 1.5, and the notation of the docstrings is that of table 1.2.

A.1 hatvis.core: Hypergraph data structures

Name

Kind

Description

Hypergraph

class

Undirected (multi-, weighted, fuzzy) hypergraph

DirectedHypergraph

class

Directed hypergraph: every hyperarc e = (T(e),H(e)) has a tail and a head set

TemporalHypergraph

class

Hypergraph whose hyperedges carry a time stamp (or any ordered group label)

A.2 hatvis.representations: Expansions, matrices, and tensors

Name

Kind

Description

clique_adjacency

function

Weighted adjacency matrix of the clique expansion (2-section)

clique_expansion

function

Clique expansion as a weighted networkx.Graph (edge attribute weight)

star_expansion

function

Star expansion: the bipartite vertex–hyperedge (Levi / König) graph

line_graph

function

The s-line graph Ls(H) of the hyperedges (Aksoy et al. 2020)

s_line_graph

function

s-line graph of the hyperedges (edges=True) or of the vertices

intersection_matrix

function

Hyperedge intersection sizes |e ∩f|= (BTB) ef (diagonal: sizes)

cooccurrence_matrix

function

Number of shared hyperedges (BBT) ij (diagonal: degrees)

laplacian

function

Hypergraph Laplacian matrices (vertex space, n ×n)

adjacency_tensor

function

Adjacency tensor of a k-uniform hypergraph (Cooper and Dutle 2012)

degree_tensor

function

Diagonal degree tensor D (d_i on the super-diagonal) of a uniform hypergraph

laplacian_tensor

function

Laplacian tensor L = D −A of a uniform hypergraph (as in HAT)

tensor_apply

function

Tensor–vector product (Axk−1) i = ∑ ⁡ e∋iwe ∏ j∈e∖ixj

uniform_layers

function

Split a hypergraph into its uniform layers {size: sub-hypergraph} (a multilayer view)

simplicial_closure

function

Downward closure: add every non-empty subset of every hyperedge (an abstract simplicial complex)

from_cliques

function

Hypergraph of the maximal cliques of a graph (a lossy inverse of the clique expansion)

from_graph_edges

function

A graph as a 2-uniform hypergraph (one hyperedge per graph edge)

to_bipartite_frame

function

Incidence list (node, edge, value) — the long form of the incidence matrix

A.3 hatvis.io: Interchange formats and converters

Name

Kind

Description

to_hif

function

Convert to a HIF dictionary (network-type, nodes, edges, incidences)

from_hif

function

Build a hypergraph from a HIF dictionary

write_hif

function

Write a HIF JSON file

read_hif

function

Read a HIF JSON file

write_hypergodot

function

Write a hypergraph in the HyperGodot text format (vertex labels must not contain spaces)

read_hypergodot

function

Read a HyperGodot input file (see parse_hypergodot)

parse_hypergodot

function

Parse the HyperGodot text format

read_spmf_itemsets

function

Read SPMF itemset output (1 4 7 #SUP: 25); the support becomes the hyperedge weight

read_spmf_rules

function

Read SPMF association rules (1 2 ==> 5 #SUP: 3 #CONF: 0.75) as a directed hypergraph

write_spmf_itemsets

function

Write hyperedges as SPMF itemsets (the weight is written as #SUP)

read_incidence_csv

function

Read a CSV file

write_incidence_csv

function

Write an incidence list (default) or the incidence matrix as CSV

read_incidence_excel

function

Read an incidence matrix from an Excel sheet (vertices in rows, hyperedges in columns)

to_hypernetx

function

Convert to a hypernetx.Hypergraph (weights as the edge property weight)

from_hypernetx

function

Convert from a hypernetx.Hypergraph (edge weights are read when available)

to_xgi

function

Convert to an xgi.Hypergraph (weights as the edge attribute weight)

from_xgi

function

Convert from an xgi.Hypergraph

to_hypergraphx

function

Convert to a hypergraphx.Hypergraph (hyperedge labels are not kept by Hypergraphx)

from_hypergraphx

function

Convert from a hypergraphx.Hypergraph

from_bipartite

function

Build a hypergraph from a bipartite graph (inverse of star_expansion)

to_networkx_bipartite

function

Alias of star_expansion

A.4 hatvis.similarity: Vertex and hyperedge similarity

Name

Kind

Description

vertex_similarity

function

Vertex similarity matrix S (rows and columns follow H.nodes)

edge_similarity

function

Hyperedge similarity matrix: the vertex similarity of the dual hypergraph

transitive_closure

function

Transitive closure of a similarity matrix (strongest-chain similarity)

dissimilarity

function

Dissimilarity matrix Δ = 1 −S used by the similarity layouts

hypergraph_distance

function

Distance between two hypergraphs

pairwise_profile_similarity

function

Similarity between the rows of a non-negative profile matrix X

A.5 hatvis.metrics: Structural statistics and s-walks

Name

Kind

Description

degree_distribution

function

Number (or fraction) of vertices of each degree

size_distribution

function

Number (or fraction) of hyperedges of each size

intersection_distribution

function

Distribution of |e ∩f| over unordered pairs of distinct hyperedges with a common vertex

s_connected_components

function

The s-connected components

is_s_connected

function

s_distance

function

Length of the shortest s-walk between two hyperedges (or vertices); inf if none

s_distance_matrix

function

All-pairs s-distances (inf for unreachable pairs)

s_diameter

function

Largest finite s-distance (inf if the hypergraph is not s-connected)

s_component_profile

function

How connectivity changes with s: number of components, size of the largest one and diameter

two_node_clustering

function

Two-node clustering coefficient (Gallagher and Goldberg 2013)

clique_clustering

function

Local clustering coefficient of the clique expansion (counts every hyperedge as a clique)

degree_assortativity

function

Degree assortativity of a hypergraph (after Chodrow 2020)

nestedness

function

Inclusion statistics: how many hyperedges are proper subsets of another hyperedge

simpliciality

function

Simpliciality measures of Landry, Young and Eikmeier (2024)

degree_entropy

function

Shannon entropy (bits) of the degree distribution

spectral_entropy

function

von Neumann entropy of the normalized Laplacian, −∑ ⁡ kλk∕nlog ⁡ 2(λk∕n), a basis-free measure of structural heterogeneity

A.6 hatvis.centrality: Centrality measures

Name

Kind

Description

degree_centrality

function

Vertex degree, divided by the number of hyperedges (or the total weight) when normalized

edge_strength

function

Strength of a hyperedge: we ∑ ⁡ ibie (size for an unweighted hypergraph)

s_betweenness

function

The s-betweenness centrality (Aksoy et al. 2020)

s_closeness

function

The s-closeness centrality: reciprocal mean s-distance to the reachable elements

s_harmonic_closeness

function

Harmonic s-closeness: HCCs(e) = 1 |Es|−1 ∑ ⁡ f∈Es,f≠e1∕ds(e,f), with Es = {e : |e|≥s} (unreachable pairs

s_eigenvector

function

The s-eigenvector centrality: principal eigenvector of the s-line graph

average_s_centrality

function

Average of an s-centrality over s = 1,…,smax ⁡

s_centrality_table

function

Table of s-betweenness and harmonic s-closeness for several s values

clique_eigenvector

function

Clique-expansion eigenvector centrality (CEC; Benson 2019): Perron vector of A

z_eigenvector

function

Z-eigenvector centrality (ZEC) of a uniform hypergraph (Benson 2019)

h_eigenvector

function

H-eigenvector centrality (HEC) of a uniform hypergraph (Benson 2019)

node_edge_eigenvector

function

Node and edge nonlinear eigenvector centralities (Tudisco and Higham 2021)

pagerank

function

PageRank of the hypergraph random walk

hypercore_numbers

function

Core numbers of the (k,m)-hyper-core decomposition (Mancastroppa et al. 2023)

hypercoreness

function

Hyper-coreness R(i) = ∑ ⁡ mCm(i)∕kmax ⁡ (m) (Mancastroppa et al. 2023)

A.7 hatvis.spectral: Random walks and spectral methods

Name

Kind

Description

transition_matrix

function

Row-stochastic transition matrix of a random walk on the vertices

stationary_distribution

function

Stationary distribution π = πP of a random walk

spectral_embedding

function

Spectral embedding of the vertices (Zhou et al. 2006)

spectral_clustering

function

Spectral clustering of the vertices with the hypergraph Laplacian (Zhou et al. 2006)

fiedler_vector

function

Eigenvector of the second smallest Laplacian eigenvalue (sign fixed: first entry non-negative)

algebraic_connectivity

function

Second smallest Laplacian eigenvalue (zero iff the hypergraph is disconnected)

A.8 hatvis.community: Modularity and community detection

Name

Kind

Description

modularity

function

Strict (all-or-nothing) hypergraph modularity

graph_modularity

function

Newman–Girvan modularity of a projection (clique expansion of the vertices)

hypergraph_louvain

function

Maximize the strict hypergraph modularity (modularity) by local moving and merging

louvain

function

Louvain communities of a projection (networkx implementation)

label_propagation

function

Label propagation through the incidence structure (after Raghavan et al. 2007)

spectral_coclustering

function

Simultaneous clustering of vertices and hyperedges (spectral co-clustering, Dhillon 2001)

partition_sizes

function

Number of members per community, largest first

communities

function

Partition as a list of member lists (community 0 first)

A.9 hatvis.partition: Hypergraph partitioning

Name

Kind

Description

cut_metrics

function

Quality of a vertex partition

normalized_cut

function

Normalized hypergraph cut of a vertex set S (Zhou et al. 2006)

fm_bisection

function

Balanced bisection minimizing the cut-net metric (Fiduccia and Mattheyses 1982)

recursive_bisection

function

k-way partition by recursive FM bisection (n_blocks a power of two is balanced best)

A.10 hatvis.patterns: Frequent patterns and association rules

Name

Kind

Description

transactions_to_hypergraph

function

One hyperedge per transaction (repeated transactions stay separate hyperedges)

hypergraph_to_transactions

function

Hyperedges as transactions

frequent_itemsets

function

Frequent itemsets of a transaction database or of a hypergraph

closed_itemsets

function

Closed itemsets: no proper superset has the same support (Pasquier et al. 1999)

maximal_itemsets

function

Maximal frequent itemsets: no proper superset is frequent

association_rules

function

Association rules A ⇒C from a table of frequent itemsets

itemset_hypergraph

function

Hypergraph whose hyperedges are itemsets (weights: support by default)

rule_hypergraph

function

Directed hypergraph of association rules: tail = antecedent, head = consequent

arhp_weights

function

Hyperedge weights of association-rule hypergraph partitioning (Han et al. 1997)

validated_hyperedges

function

Statistically validated hyperedges (after Musciotto, Battiston and Mantegna 2021)

inclusion_lattice

function

Hasse diagram of the inclusion order of a family of sets

formal_concepts

function

Formal concepts of the incidence relation (Ganter and Wille 1999)

A.11 hatvis.motifs: Higher-order motifs

Name

Kind

Description

h_motif_catalog

function

The 26 h-motifs: canonical region patterns and a short description

h_motif_pattern

function

h-motif identifier of three hyperedges (sets of vertices)

h_motifs

function

Number of instances of every h-motif among the connected triples of distinct hyperedges

node_motifs

function

Counts of the six connected node motifs of order three

motif_zscores

function

Compare motif counts with a null model

A.12 hatvis.models: Random hypergraph models

Name

Kind

Description

uniform_random

function

Uniform random hypergraph: m hyperedges, each a uniformly random k-subset of n vertices

random_hypergraph

function

Random hypergraph with a prescribed size sequence (each hyperedge a uniform random subset)

chung_lu

function

Chung–Lu hypergraph: vertices enter a hyperedge with probability proportional to their degree

configuration_model

function

Degree- and size-preserving randomization by pairwise reshuffles (Chodrow 2020)

planted_partition

function

Hypergraph stochastic block model with planted communities

temporal_random

function

Temporal hypergraph with tunable persistence: a fraction of the hyperedges is repeated from the last step

A.13 hatvis.problems: Combinatorial problems

Name

Kind

Description

greedy_set_cover

function

Greedy set cover (Chvátal 1979)

set_cover

function

Minimum-cost set cover as an integer program (solved with SciPy’s HiGHS interface)

greedy_hitting_set

function

Greedy hitting set: the greedy set cover of the dual hypergraph

hitting_set

function

Minimum (cost) hitting set, i.e. minimum vertex cover / transversal, as an integer program

minimal_transversals

function

All minimal transversals (Berge’s sequential algorithm)

transversal_hypergraph

function

The transversal (blocker) hypergraph Tr(H) of the minimal transversals

maximum_matching

function

Maximum (weight) matching: pairwise disjoint hyperedges, as an integer program

greedy_coloring

function

Greedy vertex coloring

is_two_colorable

function

Decide Property B (2-colorability without monochromatic hyperedge) by backtracking

gyo_reduction

function

GYO reduction (Graham 1979; Yu and Özsoyoğlu 1979)

is_alpha_acyclic

function

True if the hypergraph is α-acyclic (see gyo_reduction)

join_tree

function

Join tree of an α-acyclic hypergraph

is_conformal

function

Conformality: every maximal clique of the clique expansion lies inside a hyperedge

has_helly_property

function

Helly property: every pairwise intersecting subfamily has a common vertex

b_reachable

function

Vertices B-reachable from sources (B-visit, Gallo et al. 1993)

shortest_hyperpaths

function

Minimum B-hyperpath distances from sources (SBT procedure of Gallo et al. 1993)

A.14 hatvis.qfd: Quality function deployment

Name

Kind

Description

qfd_hypergraph

function

Hypergraph of a house of quality: vertices = requirements, hyperedges = parameters

generalized_qfd_hypergraph

function

Generalized hypergraph of a house of quality (Abonyi and Czvetkó 2022)

correlation_hypergraph

function

Hypergraph of the roof: every parameter is a hyperedge of itself and the parameters it correlates with

qfd_select

function

Choose the development parameters by mixed-integer linear programming (Abonyi and Czvetkó 2022)

qfd_min_cost_assignment

function

QFD as a minimum-cost flow (assignment) problem

technical_importance

function

Classical QFD technical importance tk = ∑ ⁡ iλiaik of every parameter

A.15 hatvis.dynamics: Dynamical processes

Name

Kind

Description

diffusion

function

Linear diffusion x˙ = −Lx with a hypergraph Laplacian

group_consensus

function

Nonlinear group consensus (a generalization of the 3-body model of Neuhäuser et al. 2020)

threshold_contagion

function

Discrete-time SIS contagion through hyperedges with a threshold

random_walk_trajectory

function

Simulate a random walk on the vertices (see transition_matrix)

A.16 hatvis.learning: Semi-supervised learning and prediction

Name

Kind

Description

propagation_operator

function

Normalized propagation operator of the hypergraph

label_spreading

function

Semi-supervised classification on a hypergraph (Zhou et al. 2006)

hgnn_features

function

Propagate vertex features, X ←ΘKX (HGNN operator, linear)

hgnn_classifier

function

Simplified HGNN: hgnn_features + multinomial logistic regression trained on the labeled vertices

hyperedge_score

function

Plausibility score of a candidate vertex set as a hyperedge

hyperedge_prediction

function

Evaluate hyperedge prediction by hiding a fraction of the hyperedges

A.17 hatvis.temporal: Temporal and comparative analysis

Name

Kind

Description

group_statistics

function

Statistics of the hyperedges per group tag (edge_data[group])

turnover

function

Change between consecutive snapshots: new, persisting and dropped vertex sets and their Jaccard similarity

persistence

function

For every distinct vertex set: number of time stamps in which it occurs, first and last occurrence

difference

function

Union of two hypergraphs with edge_data["status"] = both / only first / only second

temporal_centrality

function

Apply a vertex measure (e.g. hatvis.degree_centrality) to every snapshot: time x vertices

A.18 hatvis.seriation: Seriation and biclustering

Name

Kind

Description

barycentric_order

function

Iterative barycentric order of the rows (axis=0) or columns (axis=1) of a matrix

correspondence_order

function

Row and column orders from the first axis of correspondence analysis

hierarchical_order

function

Leaf order of a hierarchical clustering of the rows (or columns), optionally with optimal leaf ordering

seriate

function

Row (vertex) and column (hyperedge) orders of the incidence matrix

seriation_quality

function

Compactness of an ordered incidence matrix

bicluster_blocks

function

Biclusters of the incidence matrix by spectral co-clustering

A.19 hatvis.layout: Layout algorithms

Name

Kind

Description

classical_mds

function

Classical (Torgerson) multidimensional scaling

sammon

function

Sammon mapping (Sammon 1969) of a dissimilarity matrix

layout_similarity

function

Similarity-preserving layout (HAT-VIS)

layout_force

function

Force-directed layout of HyperGodot (Ficsor et al. 2025)

layout_membership

function

Membership-aware layout (new in hatvis)

layout_circular

function

Vertices evenly on a circle; order="seriation" uses the barycentric order to shorten hyperedge spans

layout_grid

function

Vertices on a square grid (row-major, in vertex order or the given order)

layout_radial

function

Radial layout: the most central vertex (largest degree) in the middle, the others on rings by graph distance

layout_spectral

function

Coordinates from the two leading non-trivial Laplacian eigenvectors (Zhou et al. 2006)

layout_bipartite

function

Spring layout of the star expansion; hyperedges act as hidden attractor nodes

edge_centroids

function

Centroid of the member positions of every non-empty hyperedge

layout_quality

function

Quality of a layout for hypergraph drawing

normalize_layout

function

Scale coordinates to the unit box (keeping the aspect ratio) and return a label dict

A.20 hatvis.interactive: Interactive viewer

Name

Kind

Description

to_html

function

Write a self-contained interactive HTML view of a hypergraph and return the HTML text

A.21 hatvis.datasets: Data sets

Name

Kind

Description

Bunch

class

Dictionary with attribute access (like sklearn.utils.Bunch)

hatvis_example

function

The example hypergraph of the HAT-VIS paper (Czvetkó and Abonyi 2024, Table 2)

icms_example

function

Operators and activities (Nagy et al. 2022, Fig

load_electric_car_qfd

function

House of quality of an autonomous electric car, the case study of HAT-VIS

load_manufacturing_cps

function

Cyber-physical production example of HyperGodot (Ficsor et al. 2025, Tables 5–6)

load_wire_harness

function

Intelligent collaborative manufacturing space of a wire harness assembly benchmark

make_news_transactions

function

Synthetic news articles described by their themes (a stand-in for GDELT-type data)

A.22 hatvis.plotting: Plotting

Name

Kind

Description

PALETTE

constant

Okabe–Ito categorical palette; hyperedge or group i always gets PALETTE[i]

BRAND

constant

The Pannon blue (#285780) used for single-color figures

GRAY

constant

Text and neutral colors of the figures

INK

constant

Text and neutral colors of the figures

LINESTYLES

constant

Line styles that tell groups of hyperedges apart (HyperGodot convention)

MARKERS

constant

Marker cycle for vertex types

color_cycle

function

n distinct colors: the Okabe–Ito palette first, then tab20 hues

draw_hypergraph

function

Draw a hypergraph as vertices with hyperedge outlines

draw_hatvis

function

The HAT-VIS drawing (Czvetkó and Abonyi 2024)

draw_bipartite

function

Star-expansion (bipartite, extra-node) drawing: vertices as circles, hyperedges as squares

draw_clique

function

Clique expansion drawn as a weighted graph (line width ~ pair weight)

draw_line_graph

function

The s-line graph: hyperedges as nodes (size ~ |e|), links width ~ |e ∩f|

draw_circular

function

Circular drawing: vertices on a circle, every hyperedge as a hub with curved spokes

draw_primal_dual

function

Linked primal and dual views (after Qu, Zhang and Zhang 2022)

resolve_layout

function

Return pos if given, otherwise compute the named layout

plot_incidence

function

Incidence matrix as a heat map, optionally seriated and with highlighted biclusters

plot_paoh

function

Parallel Aggregated Ordered Hypergraph (PAOH) view (Valdivia et al. 2021)

plot_upset

function

UpSet plot (Lex et al. 2014) of a hypergraph

plot_house_of_quality

function

House of quality diagram: relationship matrix, importance column, technical importance row and roof

plot_similarity_matrix

function

Heat map of the vertex similarity matrix in a seriated order

plot_distributions

function

Degree and hyperedge-size distributions side by side

plot_s_profile

function

The s-profile (new in hatvis): how every hyperedge behaves as the overlap threshold s grows

plot_ranking

function

Horizontal bar chart of the largest values of a centrality (or any) Series

plot_lattice

function

Draw an inclusion lattice (Hasse diagram, inclusion_lattice) in levels by size

plot_motif_profile

function

Bar chart of motif significance (output of motif_zscores)

plot_activity

function

Vertex activity over time: the number of hyperedges of each vertex per time stamp (heat map)

plot_s_walks

function

Side-by-side s-line graphs of the vertices for several s (cf

convex_hull

function

Convex hull vertices in counter-clockwise order (Andrew’s monotone chain)

padded_hull

function

Convex hull of circles of radius pad around the points (HyperGodot style)

smooth_closed_curve

function

Chaikin corner cutting of a closed polygon (rounded hull outlines)

polygon_area

function

Area of a simple polygon (shoelace formula)

min_volume_ellipse

function

Minimum-volume enclosing ellipse of a point set

ellipse_points

function

Boundary points (a closed curve) of the ellipse returned by min_volume_ellipse

minimum_spanning_segments

function

Edges of the minimum spanning tree of a point set (Prim’s algorithm)

isocontour

function

Implicit outline of a point set (in the spirit of Bubble Sets, Collins et al. 2009)