hatvis.io#

Reading, writing and converting hypergraphs.

Formats#

  • HIF – the Hypergraph Interchange Format (Coll et al. 2025), a JSON schema shared by HyperNetX, XGI, Hypergraphx and HAT;

  • HyperGodot text format – one hyperedge per line with #WEIGHT and #GROUP tags (Ficsor et al. 2025);

  • SPMF itemset and rule output (#SUP:, #CONF:);

  • incidence lists (CSV) and incidence matrices (CSV, Excel).

Converters to and from HyperNetX, XGI, Hypergraphx and networkx bipartite graphs import those packages lazily.

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

Functions#

to_hif(H[, metadata])

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

from_hif(data)

Build a hypergraph from a HIF dictionary.

write_hif(H, path, **kwargs)

Write a HIF JSON file.

read_hif(path)

Read a HIF JSON file.

write_hypergodot(H, path[, group])

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

read_hypergodot(path[, name])

Read a HyperGodot input file (see parse_hypergodot()).

parse_hypergodot(text[, name])

Parse the HyperGodot text format.

read_spmf_itemsets(path_or_text[, item_names])

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

read_spmf_rules(path_or_text[, item_names])

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

write_spmf_itemsets(H, path)

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

read_incidence_csv(path[, node_col, ...])

Read a CSV file.

write_incidence_csv(H, path[, matrix])

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

read_incidence_excel(path[, sheet_name, ...])

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

to_hypernetx(H)

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

from_hypernetx(Hx)

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

to_xgi(H)

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

from_xgi(X)

Convert from an xgi.Hypergraph.

to_hypergraphx(H)

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

from_hypergraphx(G)

Convert from a hypergraphx.Hypergraph.

from_bipartite(G[, edge_nodes, kind_attr, ...])

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

to_networkx_bipartite(H)

Alias of hatvis.representations.star_expansion().