Add ruvector-sparsifier: dynamic spectral graph sparsification#272
Merged
Add ruvector-sparsifier: dynamic spectral graph sparsification#272
Conversation
…cation Implements AdaptiveGeoSpar, a dynamic spectral sparsifier that maintains a compressed shadow graph preserving Laplacian energy within (1±ε). Core crate (ruvector-sparsifier): - SparseGraph with dynamic edge operations and Laplacian QF - Backbone spanning forest via union-find for connectivity - Random walk effective resistance estimation for importance scoring - Spectral sampling proportional to weight × importance × log(n)/ε² - SpectralAuditor with quadratic form, cut, and conductance probes - Pluggable traits: Sparsifier, ImportanceScorer, BackboneStrategy - 49 tests (31 unit + 17 integration + 1 doc-test), all passing - Benchmarks: build 161µs, insert 81µs, audit 39µs (n=100) WASM crate (ruvector-sparsifier-wasm): - Full wasm-bindgen bindings via WasmSparsifier and WasmSparseGraph - JSON-based API for browser/edge deployment - Compiles cleanly on native target Research (docs/research/spectral-sparsification/): - 00: Executive summary and impact projections - 01: SOTA survey (ADKKP 2016 → STACS 2026) - 02: Rust crate design and API - 03: RuVector integration architecture (4-tier control plane) - 04: Companion systems (conformal drift, attributed ANN) https://claude.ai/code/session_01A6YKtTrSPeV36Xamz9hRCb
…hot paths Core distance.rs: - Manhattan distance now delegates to SIMD (was pure scalar) - Cosine fallback uses single-pass computation (was 3 separate passes) - Euclidean fallback uses 4x loop unrolling for better ILP SIMD intrinsics: - Add AVX2 manhattan distance (was only AVX-512 or scalar fallback) - 2x loop unrolling with dual accumulators for AVX2 manhattan - Sign-bit mask absolute value for branchless abs diff Sparsifier (O(m) -> O(1) per insert): - Cache total importance to avoid iterating ALL edges per insert - Parallel edge scoring via rayon for graphs >100 edges - Pre-sized HashMap adjacency lists (4 neighbors avg) - Inline annotations on hot-path graph query methods https://claude.ai/code/session_01A6YKtTrSPeV36Xamz9hRCb
- Replace map_or(false, ...) with is_some_and(...) in graph.rs - Derive Default instead of manual impl for LocalImportanceScorer - Fix inner/outer attribute conflict on prelude module Co-Authored-By: claude-flow <ruv@ruv.net>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Introduces
ruvector-sparsifier, a new Rust crate implementing dynamic spectral graph sparsification based on the ADKKP16 algorithm. This provides an always-on compressed world model that maintains a shadow graph with O(n log n / ε²) edges, preserving the Laplacian spectral properties of the full graph within (1±ε) relative error.Key Changes
New Crates
ruvector-sparsifier: Core implementation with:SparseGraph: adjacency-list weighted graph with dynamic edge operations and Laplacian quadratic form computationAdaptiveGeoSpar: main sparsifier maintaining full graph, compressed sparsifier, backbone spanning forest, importance scorer, and auditorBackbone: union-find based spanning forest for connectivity guaranteesLocalImportanceScorer: random-walk based effective resistance estimationSpectralSampler: probability-proportional edge samplingSpectralAuditor: periodic spectral quality verification via Laplacian quadratic form probesruvector-sparsifier-wasm: WebAssembly bindings enabling browser and edge deployment withwasm-bindgenDocumentation
Research series (5 documents):
00-executive-summary.md: Strategic overview and thesis01-algorithms-sota.md: Algorithmic foundations and state-of-the-art survey02-rust-crate-design.md: Module architecture and ecosystem analysis03-ruvector-integration.md: Four-tier control plane integration with min-cut and conformal drift detection04-companion-systems.md: Drift detection and attributed ANN systemsCrate READMEs: Usage guides, architecture diagrams, and integration examples
Testing & Benchmarking
Minor Changes
Cargo.tomlto include new cratesruvector-core/simd_intrinsics.rsanddistance.rsImplementation Details
RwLockfor concurrent reader access via snapshot cloningx^T L xpreserved within (1±ε) for all vectors xSparsifierConfigThe implementation is production-ready with comprehensive error handling, statistics tracking, and integration points for
ruvector-solver's 7 solver engines via CSR matrix export.https://claude.ai/code/session_01A6YKtTrSPeV36Xamz9hRCb