rust-port/wifi-densepose-rs/crates/ruv-neural/ruv-neural-embed/README.md
Graph embedding generation for brain connectivity states using RuVector format.
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.
spectral_embed): Laplacian eigenvector-based positional
encoding from the graph's normalized Laplaciantopology_embed): Hand-crafted topological feature vectors
derived from graph-theoretic metricsnode2vec): Random-walk co-occurrence embeddings using configurable
walk length, return parameter (p), and in-out parameter (q)combined): Weighted concatenation of multiple embedding
methods into a single vectortemporal): Sliding-window context-enriched embeddings
that capture graph dynamics over timedistance): Embedding distance and similarity computationsrvf_export): Serialization of embeddings and trajectories to the
RuVector .rvf binary formatdefault_metadata for quick EmbeddingMetadata constructionuse 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);
| 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 | Default | Description |
|---|---|---|
std | Yes | Standard library support |
wasm | No | WASM-compatible implementations |
rvf | No | RuVector RVF format export support |
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.
MIT OR Apache-2.0