Files
ruvnet--RuView/v2/crates/ruv-neural/ruv-neural-embed/README.md
T
rUv f49c722764 chore(repo): rename rust-port/wifi-densepose-rs → v2/ (flatten to one level) (#427)
The Rust port lived two directories deep (rust-port/wifi-densepose-rs/)
without any sibling under rust-port/ that warranted the extra level.
Move the whole workspace up to v2/ to match v1/ (Python) at the same
depth and shorten every cd / build command across the repo.

git mv preserves history for all tracked files. 60 files updated for
path references (CI workflows, ADRs, docs, scripts, READMEs, internal
.claude-flow state). Two manual fixes for relative-cd paths in
CLAUDE.md and ADR-043 that became wrong after the depth change
(cd ../.. → cd ..).

Validated:
- cargo check --workspace --no-default-features → clean (after target/
  nuke; the gitignored target/ was carried by the OS rename and had
  hard-coded old paths in build scripts)
- cargo test --workspace --no-default-features → 1,539 passed, 0 failed,
  8 ignored (same totals as pre-rename)
- ESP32-S3 on COM7 → still streaming live CSI (cb #40300, RSSI -64 dBm)

After-merge follow-up: contributors should `rm -rf v2/target` once and
let cargo regenerate from the new path.
2026-04-25 21:28:13 -04:00

91 lines
3.5 KiB
Markdown

# ruv-neural-embed
Graph embedding generation for brain connectivity states using RuVector format.
## Overview
`ruv-neural-embed` converts brain connectivity graphs into fixed-dimensional
vector representations suitable for downstream classification, clustering, and
temporal analysis. It provides multiple embedding methods and supports export
to the RuVector `.rvf` binary format for interoperability with the broader
RuVector ecosystem.
## Features
- **Spectral embedding** (`spectral_embed`): Laplacian eigenvector-based positional
encoding from the graph's normalized Laplacian
- **Topology embedding** (`topology_embed`): Hand-crafted topological feature vectors
derived from graph-theoretic metrics
- **Node2Vec** (`node2vec`): Random-walk co-occurrence embeddings using configurable
walk length, return parameter (p), and in-out parameter (q)
- **Combined embedding** (`combined`): Weighted concatenation of multiple embedding
methods into a single vector
- **Temporal embedding** (`temporal`): Sliding-window context-enriched embeddings
that capture graph dynamics over time
- **Distance metrics** (`distance`): Embedding distance and similarity computations
- **RVF export** (`rvf_export`): Serialization of embeddings and trajectories to the
RuVector `.rvf` binary format
- **Helper utilities**: `default_metadata` for quick `EmbeddingMetadata` construction
## Usage
```rust
use ruv_neural_embed::{
NeuralEmbedding, EmbeddingMetadata, EmbeddingTrajectory,
default_metadata,
};
use ruv_neural_core::brain::Atlas;
// Create an embedding with metadata
let meta = default_metadata("spectral", Atlas::Schaefer100);
let emb = NeuralEmbedding::new(vec![0.1, 0.5, -0.3, 0.8], 1000.0, meta).unwrap();
assert_eq!(emb.dimension, 4);
// Compute similarity between embeddings
let other = NeuralEmbedding::new(
vec![0.2, 0.4, -0.2, 0.9],
1001.0,
default_metadata("spectral", Atlas::Schaefer100),
).unwrap();
let similarity = emb.cosine_similarity(&other).unwrap();
let distance = emb.euclidean_distance(&other).unwrap();
// Build a trajectory from a sequence of embeddings
let trajectory = EmbeddingTrajectory {
embeddings: vec![emb, other],
timestamps: vec![1000.0, 1001.0],
};
assert_eq!(trajectory.len(), 2);
```
## API Reference
| Module | Key Types / Functions |
|------------------|-----------------------------------------------------|
| `spectral_embed` | Spectral positional encoding from graph Laplacian |
| `topology_embed` | Topological feature vector extraction |
| `node2vec` | Random-walk based node embeddings |
| `combined` | Weighted multi-method embedding concatenation |
| `temporal` | Sliding-window temporal context embeddings |
| `distance` | Distance and similarity computations |
| `rvf_export` | RVF binary format serialization |
## Feature Flags
| Feature | Default | Description |
|---------|---------|-------------------------------------|
| `std` | Yes | Standard library support |
| `wasm` | No | WASM-compatible implementations |
| `rvf` | No | RuVector RVF format export support |
## Integration
Depends on `ruv-neural-core` for `NeuralEmbedding`, `BrainGraph`, and
`EmbeddingGenerator` trait. Receives graphs from `ruv-neural-graph` or
`ruv-neural-mincut`. Produced embeddings are stored by `ruv-neural-memory`
and classified by `ruv-neural-decoder`.
## License
MIT OR Apache-2.0