mirror of
https://github.com/ruvnet/RuVector.git
synced 2026-05-28 01:44:41 +00:00
Ships src/analysis/leiden::leiden_labels_cpm (Constant Potts Model
quality function, Traag's own default in leidenalg) alongside the
existing modularity-based leiden_labels. Same multi-level loop
(local moves → aggregate → repeat) but with CPM's move gain
`k_{v,C} - γ·n_C` instead of modularity's Newman-Girvan gain.
Measured on default N=1024 SBM across γ ∈ {0.005, 0.01, 0.02,
0.05, 0.1, 0.2, 0.5, 1.0}:
γ ≤ 0.5 : collapses to 1 community (ARI = 0.000)
γ = 1.0 : 15 communities, ARI = -0.039
modularity-Leiden baseline: ARI = 0.089
Also measured on 2-community planted SBM at γ = 0.05: 1 community,
ARI = 0.000. Same under-merging failure.
**16th measurement-driven discovery — naive CPM at edge-weight
scale is the wrong formulation.** The move gain parametrizes γ in
edge-weight units but synapse weights here are f64 of order
10–100. At γ = 0.05 the penalty γ·n_c is dwarfed by any positive
inter-community sum-of-weights, so level-1 greedily merges
everything into one community; at γ = 1.0 CPM still over-merges
because per-pair weight magnitudes are >> 1. Traag's own
`leidenalg` normalizes edges (or rescales γ by total-weight
density). **Weight-normalized CPM is the next attempt, named
explicitly in §17 item 16.**
Secondary pattern surfacing at §17: *published-algorithm
implementations usually need a substrate-specific normalization
before they match the paper's behaviour on non-toy inputs.*
Three instances now — AC-5 null degree-scaling (item 1), Lanczos
shift-and-invert (item 7), CPM weight normalization (item 16).
The paper describes the algorithm on an idealised graph; the
substrate has real-world distributions (heavy-tailed weights,
hub structure, float precision) that require a calibration
rider that is almost never in the paper. ADR §17 closing
paragraph extended to name this as a branch-wide rule.
Tests are publish-only — tests/leiden_cpm.rs gates on 'some
community formed' (sanity), not on precision@ARI, until the
normalized variant lands. Both tests pass.
Files:
- src/analysis/leiden.rs: +165 LOC (leiden_labels_cpm,
level1_moves_cpm, aggregate_cpm, compact_cpm_labels)
- tests/leiden_cpm.rs: new, 184 LOC, 2/2 pass
- docs/adr/ADR-154: §17 item 16 + §17 closing-paragraph
secondary-pattern note
All 89 prior tests unchanged. No API regression.
Co-Authored-By: claude-flow <ruv@ruv.net>
EOF
)
|
||
|---|---|---|
| .. | ||
| agentic-jujutsu | ||
| apify | ||
| app-clip | ||
| benchmarks | ||
| boundary-discovery | ||
| brain-boundary-discovery | ||
| climate-consciousness | ||
| cmb-boundary-discovery | ||
| cmb-consciousness | ||
| connectome-fly | ||
| data | ||
| decompiler-dashboard | ||
| delta-behavior | ||
| dna | ||
| docs | ||
| dragnes | ||
| earthquake-boundary-discovery | ||
| ecosystem-consciousness | ||
| edge | ||
| edge-full/pkg | ||
| edge-net | ||
| exo-ai-2025 | ||
| frb-boundary-discovery | ||
| gene-consciousness | ||
| google-cloud | ||
| graph | ||
| gw-consciousness | ||
| health-boundary-discovery | ||
| infrastructure-boundary-discovery | ||
| market-boundary-discovery | ||
| meta-cognition-spiking-neural-network | ||
| mincut | ||
| music-boundary-discovery | ||
| neural-trader | ||
| nodejs | ||
| onnx-embeddings | ||
| onnx-embeddings-wasm | ||
| OSpipe | ||
| pandemic-boundary-discovery | ||
| prime-radiant | ||
| pwa-loader | ||
| quantum-consciousness | ||
| real-eeg-analysis | ||
| real-eeg-multi-seizure | ||
| refrag-pipeline | ||
| robotics | ||
| rust | ||
| ruvLLM | ||
| rvf | ||
| rvf-desktop | ||
| rvf-kernel-optimized | ||
| scipix | ||
| seizure-clinical-report | ||
| seizure-therapeutic-sim | ||
| seti-boundary-discovery | ||
| seti-exotic-signals | ||
| spiking-network | ||
| subpolynomial-time | ||
| temporal-attractor-discovery | ||
| train-discoveries | ||
| ultra-low-latency-sim | ||
| verified-applications | ||
| vibecast-7sense | ||
| void-boundary-discovery | ||
| vwm-viewer | ||
| wasm/ios | ||
| wasm-react | ||
| wasm-vanilla | ||
| weather-boundary-discovery | ||
| bounded_instance_demo.rs | ||
| README.md | ||
| security_hardened.rvf | ||
RuVector Examples
Comprehensive examples demonstrating RuVector's capabilities across multiple platforms and use cases.
Directory Structure
examples/
├── rust/ # Rust SDK examples
├── nodejs/ # Node.js SDK examples
├── graph/ # Graph database features
├── wasm-react/ # React + WebAssembly integration
├── wasm-vanilla/ # Vanilla JS + WebAssembly
├── agentic-jujutsu/ # AI agent version control
├── exo-ai-2025/ # Advanced cognitive substrate
├── refrag-pipeline/ # Document processing pipeline
└── docs/ # Additional documentation
Quick Start by Platform
Rust
cd rust
cargo run --example basic_usage
cargo run --example advanced_features
cargo run --example agenticdb_demo
Node.js
cd nodejs
npm install
node basic_usage.js
node semantic_search.js
WebAssembly (React)
cd wasm-react
npm install
npm run dev
WebAssembly (Vanilla)
cd wasm-vanilla
# Open index.html in browser
Example Categories
| Category | Directory | Description |
|---|---|---|
| Core API | rust/basic_usage.rs |
Vector DB fundamentals |
| Batch Ops | rust/batch_operations.rs |
High-throughput ingestion |
| RAG Pipeline | rust/rag_pipeline.rs |
Retrieval-Augmented Generation |
| Advanced | rust/advanced_features.rs |
Hypergraphs, neural hashing |
| AgenticDB | rust/agenticdb_demo.rs |
AI agent memory system |
| GNN | rust/gnn_example.rs |
Graph Neural Networks |
| Graph | graph/ |
Cypher queries, clustering |
| Node.js | nodejs/ |
JavaScript integration |
| WASM React | wasm-react/ |
Modern React apps |
| WASM Vanilla | wasm-vanilla/ |
Browser without framework |
| Agentic Jujutsu | agentic-jujutsu/ |
Multi-agent version control |
| EXO-AI 2025 | exo-ai-2025/ |
Cognitive substrate research |
| Refrag | refrag-pipeline/ |
Document fragmentation |
Feature Highlights
Vector Database Core
- High-performance similarity search
- Multiple distance metrics (Cosine, Euclidean, Dot Product)
- Metadata filtering
- Batch operations
Advanced Features
- Hypergraph Index: Multi-entity relationships
- Temporal Hypergraph: Time-aware relationships
- Causal Memory: Cause-effect chains
- Learned Index: ML-optimized indexing
- Neural Hash: Locality-sensitive hashing
- Topological Analysis: Persistent homology
AgenticDB
- Reflexion episodes (self-critique)
- Skill library (consolidated patterns)
- Causal memory (hypergraph relationships)
- Learning sessions (RL training data)
- Vector embeddings (core storage)
EXO-AI Cognitive Substrate
- exo-core: IIT consciousness, thermodynamics
- exo-temporal: Causal memory coordination
- exo-hypergraph: Topological structures
- exo-manifold: Continuous deformation
- exo-exotic: 10 cutting-edge experiments
- exo-wasm: Browser deployment
- exo-federation: Distributed consensus
- exo-node: Native bindings
- exo-backend-classical: Classical compute
Running Benchmarks
# Rust benchmarks
cargo bench --example advanced_features
# Refrag pipeline benchmarks
cd refrag-pipeline
cargo bench
# EXO-AI benchmarks
cd exo-ai-2025
cargo bench
Related Documentation
License
MIT OR Apache-2.0