Skip to main content

deck_hypergraph

Function deck_hypergraph 

Source
pub fn deck_hypergraph(w: &DeckWorld) -> Hypergraph<Value, Value, Value>
Available on crate feature raster only.
Expand description

The shared DeckWorld -> &Hypergraph adapter (Finding 6): 28 agents become nodes keyed by their id. The single bridge from DeckWorld to the shipped &Hypergraph APIs (subhypergraph, connected_components, Task 7’s normalized_laplacian), none of which take DeckWorld directly.

Review MINOR 8 correction (2026-07-22). This adapter previously built edges from community links only. That is NOT the graph the deck’s spectral() diagonalizes (topology-deck.html:216-220), which is:

  • all-pairs intra-community coupling at weight .25,
  • each community link at weight 1,
  • each extraction tail -> head at weight .5,

accumulated symmetrically (A[a][b] += w), so a pair appearing in several roles sums its weights. Deviation 2 sanctions a different eigensolver producing different eigenvector VALUES; it does not sanction a structurally different input graph. This fn now builds the deck’s actual adjacency.

Weight encoding (declared deviation). The shipped Hypergraph has no per-edge weight and communities::normalized_laplacian builds a 0/1 incidence, so weights are encoded by edge multiplicity: one 2-node edge per 0.25 of weight (.25 -> x1, .5 -> x2, 1 -> x4). This is exact, not approximate — every deck weight is an integer multiple of 0.25. It is also exactly faithful to the spectrum: for 2-node edges (De = 2) the hypergraph normalized Laplacian reduces to L = ½·(I − D^{-1/2} W D^{-1/2}) with W[i,k] the multiplicity and D[i] = Σ_k W[i,k], i.e. exactly one half of the standard weighted normalized Laplacian — a uniform positive scale, which leaves every eigenVECTOR unchanged (only eigenvalues halve). The spectral layout reads eigenvectors only.

Isolated nodes (retained, narrowed). Even under the deck’s full adjacency, 5 of the 28 agents at seed 1917 (ids 7, 9, 11, 15, 27) belong to no community and appear in no extraction hyperedge, so their degree is 0 — verified directly against the reference implementation, whose own deg array carries five zeros. normalized_laplacian divides by node degree and rejects those with SpectralError::IsolatedNode, so each such agent still gets an inert singleton self-edge (add_edge(vec![id])): degree 1, zero coupling to any other node (L[i,i] = 0, its row/column otherwise zero). The deck reaches the same place by a different route — an isolated row of its shifted operator is shift·v[i], i.e. eigenvalue 0 of L, decoupled from everything — so this is a representational necessity of the shipped API, not a structural difference. The count of affected agents drops from 18 to 5 under this correction.