hatvis.representations#

Alternative representations of a hypergraph.

A hypergraph can be expanded into ordinary graphs (clique, star and line graphs), described by matrices (incidence, adjacency, Laplacians) or by tensors (uniform hypergraphs). Every representation answers a different question and loses a different part of the information; Chapter 2 of the book compares them.

Clique and star expansions, s-line graphs, Laplacians, adjacency tensors, uniform layers, simplicial closure.

Functions#

clique_adjacency(H[, weighting, dense])

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

clique_expansion(H[, weighting])

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

star_expansion(H[, edge_suffix])

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

line_graph(H[, s, weighted])

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

s_line_graph(H[, s, edges, weighted])

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

intersection_matrix(H)

Hyperedge intersection sizes \(|e\cap f| = (\mathbf{B}^\mathsf{T}\mathbf{B})_{ef}\) (diagonal: sizes).

cooccurrence_matrix(H)

Number of shared hyperedges \((\mathbf{B}\mathbf{B}^\mathsf{T})_{ij}\) (diagonal: degrees).

laplacian(H[, kind, dense])

Hypergraph Laplacian matrices (vertex space, \(n\times n\)).

adjacency_tensor(H)

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

degree_tensor(H)

Diagonal degree tensor \(\mathcal{D}\) (d_i on the super-diagonal) of a uniform hypergraph.

laplacian_tensor(H)

Laplacian tensor \(\mathcal{L}=\mathcal{D}-\mathcal{A}\) of a uniform hypergraph (as in HAT).

tensor_apply(H, x)

Tensor–vector product \((\mathcal{A}\mathbf{x}^{k-1})_i=\sum_{e\ni i} w_e\prod_{j\in e\setminus i}x_j\).

uniform_layers(H)

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

simplicial_closure(H[, max_size])

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

from_cliques(G[, min_size, name])

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

from_graph_edges(G[, weight])

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

to_bipartite_frame(H)

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