hatvis.representations.clique_adjacency#

hatvis.representations.clique_adjacency(H, weighting='count', dense=True)[source]#

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

Two vertices are adjacent if they share a hyperedge. The weight of the pair \(\{i,j\}\) is \(a_{ij}=\sum_{e\ni i,j} w_e\,c(e)\) with

  • "count": \(c(e)=1\) (number or total weight of shared hyperedges),

  • "size": \(c(e)=1/|e|\) (the normalization of Zhou et al. 2006),

  • "pairs": \(c(e)=1/(|e|-1)\), so that every vertex receives total weight \(w_e\) from each of its hyperedges.

The incidence pattern (0/1) is used; the diagonal is zero.

>>> H = Hypergraph([["a", "b", "c"], ["b", "c"]])
>>> clique_adjacency(H).tolist()
[[0.0, 1.0, 1.0], [1.0, 0.0, 2.0], [1.0, 2.0, 0.0]]