△ Mechanism confirmed, baseline not beaten 2026

LNC-Compressed Dense Message Passing

Implementation & benchmark of arXiv:2608.25212 — Time-Optimal APSP and Matrix Multiplication in Classes of Linear Neighborhood Complexity

Usefulness7/10
Difficulty7/10
Novelty7/10

Source paper: Time-Optimal APSP and Matrix Multiplication in Classes of Linear Neighborhood Complexity arXiv:2608.25212 ⓘ · analyzed Aug 29, 2026

AI-generated research hypothesis, automatically tested. Not peer-reviewed.

Idea description

For a fixed structured graph, preprocess its adjacency matrix into the linear-time matrix-vector multiplication data structure guaranteed for classes of linear neighborhood complexity. Replace every dense aggregation Y=MX in a GNN by batched queries to this exact data structure, reducing a dense O(n^2d) aggregation to O(nd) after O(n^2) one-time preprocessing. This is especially useful for dense graphs from bounded-clique-width, bounded-expansion, minor-closed, twin-width, or related structured families.

Formulas

$$\pi_G(m):=\max_{X\subseteq V(G),\,|X|\leq m}\left|\{N_G(v)\cap X:v\in V(G)\}\right|,$$
$$\pi_G(m)\leq c\,m\qquad\text{for all }m\in\mathbb N,$$
$$y=Mx,\qquad y_u=\sum_{v\in N_G(u)}x_v,$$
$$\operatorname{Preprocess}(G):O(n^2),\qquad \operatorname{Query}(x)=Mx:O(n).$$

Mathematical statement

The paper defines the neighborhood shatter function of a graph G=(V,E) by \(\pi_G(m):=\max_{X\subseteq V,\,|X|\le m}|\{N_G(v)\cap X:v\in V\}|\), where N_G(v) is the neighborhood of vertex v and m is the size of the tested subset. G has c-linear neighborhood complexity when \(\pi_G(m)\le cm\) for every positive integer m; c is a graph-class constant. The central algorithmic guarantee stated by the paper is that, for an n-vertex graph in such a class, one can perform quadratic preprocessing and then multiply its adjacency matrix M by any vector x in O(n) time. Thus the exact graph aggregation \(y=Mx\), with \(y_u=\sum_{v\in N_G(u)}x_v\), can be applied to a feature matrix X in \(\mathbb R^{n\times d}\) column-by-column in O(nd) time rather than O(n^2d). The paper obtains the data structure through an sd-degeneracy sequence of constant width; the extracted result states that bounded versatile symmetric difference yields such a sequence after O(n^2) time, and LNC classes admit constant-width sequences in expected linear time for the relevant construction. The ML adaptation treats the resulting query structure as an exact operator \(\mathcal Q_G(x)=Mx\); no approximation, learned sparsification, or low-rank assumption is introduced.

Implementation notes

Integrate this at the fixed-graph aggregation operation of a message-passing GNN, not at the learned feature transformation. Given node states H in R^{n x d}, the baseline computes Z=MH with a dense matrix multiply and then applies H' = phi(ZW + H W_0). In the proposed model, run a one-time preprocessing routine on the fixed graph G: construct the paper's LNC/sd-degeneracy representation and store the auxiliary structures needed by its adjacency-matrix-vector query algorithm. At every training or inference step, compute each feature column by calling the exact query routine: for j=1,...,d, set Z_{:,j}=Q_G(H_{:,j}), where Q_G(x)=Mx. In practice, batch columns into blocks of width b and use the same traversal/decomposition while accumulating b scalar coordinates per vertex; this preserves the O(nb) query target while improving CPU vectorization. Pseudocode is: state = preprocess(G); for layer: H_in = H; Z = zeros(n,d); for feature_block X in blocks(H,d,b): Z_block = query_adjacency(state,X) # exact M X; H = activation(Z W + residual(H_in)). The mathematical quantities computed from the paper are the neighborhood-complexity/decomposition data and the exact identity Z=MH; the constant c and whether the input graph satisfies LNC should be estimated or certified empirically by sampling subsets X and counting distinct restricted neighborhoods. The first cheap experiment should use dense planar-derived or low-clique-width synthetic graphs with n in {4096,16384,65536}, a 2-4 layer GCN, and compare dense matmul, ordinary sparse matmul, and the compressed query at equal outputs. Measure preprocessing time separately, per-layer wall-clock time, peak memory, and numerical error. Success means amortized aggregation approaching linear scaling in n and at least a 3x speedup over dense aggregation once several layers or repeated inference queries amortize preprocessing, with identical validation accuracy.

Verification

Mechanism confirmed, baseline not beaten

Stage 1 · Toy mechanism gate: Passed ✓

Stage 2 · Mechanism transferred to benchmark: Confirmed ✓

Stage 2 · Practical benchmark result: No measurable effect

Methodology: 8 paired seeds, permutation test (p<0.05) against a learning-rate-tuned baseline. How verification works

Stage 1 — Mechanism check agent confidence 8/10

Built an exact compressed adjacency-query MVP for disjoint unions of cliques, an explicit LNC subclass: preprocessing stores component IDs and queries compute component sums minus self-features. The mechanism checks passed: maximum numerical error was 8.9e-16, the predicted shatter values pi(m)=m+1 and c=2 bound matched exactly, and compressed query scaling had observed exponent 0.932 versus the predicted linear exponent 1.0. In the denser benchmark, compressed aggregation was 4.5–30.9x faster than dense matmul and 2.9–20.5x faster than CSR, but this is not evidence that the paper's full generic sd-degeneracy structure was implemented.

Agent confidence
8/10
Baseline
Dense aggregation took 0.00301, 0.00299, 0.00400, 0.01624, and 0.04300 seconds for n=256,512,1024,2048,4096; dense memory reached 128 MB at n=4096.
Idea
Exact clique-union query took 9.73e-5, 2.72e-4, 8.96e-4, 1.05e-3, and 2.04e-3 seconds for the same sizes; maximum error versus dense was 2.0e-13 at approximately 0.25 graph density. CSR was slower than the idea at every tested size.

Limitations: Only disjoint unions of cliques were implemented, not the paper's general sd-degeneracy/interval-intersection data structure for arbitrary LNC graphs. The benchmark measured aggregation rather than end-to-end GNN training or validation accuracy, used CPU NumPy/SciPy only, and did not test preprocessing amortization over full models, graph updates, or larger graphs.

How to run: python3 run_experiment.py && /home/maxwelhelp/main/bin/python3 benchmark_dense_graph.py

Stage 2 — Benchmark vs. tuned baseline (arXiv:2608.25212)

No significant difference vs. the tuned baseline (+0.0%, p=0.5091, wins 0 / 8 paired seeds).

Benchmark
LNC clique graph
Model
custom_graph_gnn
Paired seeds
8
Baseline mean
0.2493
Idea mean
0.2493
Effect (Δ)
0 (+0.0%; negative = idea better)
Wins
0 / 8 paired seeds
p-value
0.5091 (permutation test, 20 000 shuffles)
Smallest detectable effect
n/a
Mechanism
Confirmed ✓
Practical effect
No effect
Baseline tuning
swept over 3 configs
Limitations:

The experiment covers the disjoint-union-of-cliques LNC subclass rather than the paper's full generic sd-degeneracy structure. It does not test larger graphs, arbitrary LNC graph classes, isolated GPU speed, preprocessing amortization, or graph updates.

How to run: python3 lnc_bench.py

Verdict computed by deterministic test code from paired-seed statistics — not by the language model.

Stage 2 — Benchmark latest Failed ✗

Agent confidence: 9/10

Built a custom fixed-graph node-regression track and matched GNN comparison using identical architecture and training budget, differing only in dense adjacency aggregation versus exact LNC clique-union queries. Exactness passed with maximum error 8.88e-16 and query scaling exponent 0.905 versus predicted 1.0. Training showed no measurable benefit: baseline MSE 0.249295572 versus idea MSE 0.249295678, paired delta +1.06e-7, permutation p=0.50915.

Baseline
8-seed best dense-GNN MSE 0.2492955718189478; best lr=0.01, epochs=10.
Idea
8-seed best exact compressed-query GNN MSE 0.2492956779897213; best lr=0.01, epochs=10; paired delta +1.0617e-7; p=0.50915; 0 wins.
Mechanism
Exact query max error 8.8818e-16; observed scaling exponent 0.9055 versus predicted 1.0; confirmed=true.

Benchmark result

No significant difference vs. the tuned baseline (+0.0%, p=0.5091, wins 0 / 8 paired seeds).

Benchmark
LNC clique graph
Model
custom_graph_gnn
Paired seeds
8
Baseline mean
0.2493
Idea mean
0.2493
Effect (Δ)
0 (+0.0%; negative = idea better)
Wins
0 / 8 paired seeds
p-value
0.5091 (permutation test, 20 000 shuffles)
Smallest detectable effect
n/a
Mechanism
Confirmed ✓
Practical effect
No effect
Baseline tuning
swept over 3 configs
Limitations:

The experiment covers the disjoint-union-of-cliques LNC subclass rather than the paper's full generic sd-degeneracy structure. It does not test larger graphs, arbitrary LNC graph classes, isolated GPU speed, preprocessing amortization, or graph updates.

How to run: python3 lnc_bench.py

Artifacts

Implementation overview ⬇ Download all as ZIP 10 files · code, reports and structured results