Skip to main content

Module linalg

Module linalg 

Source
Expand description

Matrices derived from the bipartite hypergraph substrate.

Row order follows Hypergraph::node_ids (node insertion order); column order follows Hypergraph::edge_ids (edge insertion order). This is the III.7 determinism contract and matches XGI’s dict-ordering (xgi/linalg/hypergraph_matrix.py).

Enums§

LinalgError
Errors raised by linear-algebra operators that have preconditions.

Functions§

adjacency_matrix
Adjacency matrix A (nodes × nodes). A = I·Iᵀ with the diagonal zeroed; then thresholded by s overlapping edges. If weighted, the surviving entries carry the shared-edge count; otherwise they are 1.0.
clique_motif_matrix
Weighted clique-motif matrix — adjacency_matrix(H, None, 1, true).
degree_matrix
Degree vector K (one entry per node) = incidence row sums.
incidence_matrix
Dense incidence matrix I (rows = nodes, cols = edges); I[i,j] = 1 iff node i is a member of edge j.
incidence_matrix_sparse
Sparse (CSR) incidence matrix — same values and ordering as incidence_matrix, as a sprs::CsMat<f64>.
intersection_profile
Intersection profile P = Iᵀ·I (edges × edges). P[a,b] is the number of nodes shared by edges a and b; the diagonal is each edge’s size.
laplacian
Order-d Laplacian L = d·diag(K) − A (A = weighted adjacency at order d).
multiorder_laplacian
Multiorder Laplacian Σ_d L_d · w_d / mean(K_d), skipping orders with no edges.
normalized_hypergraph_laplacian
Normalized hypergraph Laplacian L = I − Dv^{-1/2}·Inc·W·De^{-1}·Incᵀ·Dv^{-1/2}.