/** * Tropical (min-plus) sparse matrix–vector multiply on CSR graphs. * * Matches the semiring used in `@holoscript/snn-webgpu` / `TropicalShortestPaths` * (`INF = 1e30`). One SpMV step computes * y_i = min_j (A_ij + x_j) * over stored entries only. * * Used for CPU reference checks, graph benchmarks (ER / scale-free / layered), * and comparison against the dense min-plus path. */ /** Same sentinel as `TropicalShortestPaths` / WGSL kernels. */ export declare const TROPICAL_INF = 1e+30; /** CSR adjacency (square n×n), row-major compressed sparse rows. */ export interface TropicalCsrMatrix { readonly n: number; readonly rowPtr: Uint32Array; readonly colIdx: Uint32Array; readonly values: Float32Array; } /** Deterministic PRNG (Mulberry32) for reproducible graph builds. */ export declare function mulberry32(seed: number): () => number; /** * Min-plus SpMV: y_i = min_k (values[k] + x[colIdx[k]]) for entries in row i. * Rows with no entries get y_i = TROPICAL_INF. */ export declare function tropicalMinPlusSpmv(csr: TropicalCsrMatrix, x: Float32Array, y: Float32Array): void; /** Dense min-plus SpMV (reference): y_i = min_j (A_ij + x_j). */ export declare function tropicalMinPlusSpmvDense(n: number, aRowMajor: Float32Array, x: Float32Array, y: Float32Array): void; /** Build CSR from dense matrix, storing only finite entries strictly below INF. */ export declare function csrFromDense(n: number, dense: Float32Array): TropicalCsrMatrix; /** Directed Erdős–Rényi G(n,p): edge i→j with probability p, weight in (0,1]. */ export declare function erdosRenyiCsr(n: number, p: number, rng: () => number): TropicalCsrMatrix; /** * Barabási–Albert–style directed graph: each new vertex adds up to `m` outgoing * edges to strictly older vertices; targets are chosen with probability * proportional to (indegree + 1). */ export declare function barabasiAlbertCsr(n: number, m: number, rng: () => number): TropicalCsrMatrix; /** Layered feedforward with random skip connections (neural-graph toy). */ export declare function layeredNeuralCsr(n: number, layers: number, skipProbability: number, rng: () => number): TropicalCsrMatrix; /** Max absolute difference between two vectors (skipping mutual INF). */ export declare function maxAbsDiff(a: Float32Array, b: Float32Array): number;