Skip to main content

graph_core/
lib.rs

1//! Shared graph kernels for Mnemosyne.
2//!
3//! This crate is reusable between the native PyO3 crate
4//! (`mnemosyne_rs`) and the forthcoming `graph_wasm` sub-crate
5//! (Wave 2 of Phase 223). It contains:
6//!
7//! * [`util`] — runtime-dispatched AVX2+FMA dot products. Moved
8//!   here from `mnemosyne_rs::util` so both surfaces can share one
9//!   SIMD implementation.
10//! * [`force`] — Barnes-Hut 2D force simulation (`Simulation`,
11//!   `SimulationConfig`).
12//! * [`viewport`] — R-tree viewport spatial index with lazy
13//!   incremental updates (`ViewportIndex`, `IndexPoint`, `ScoreKey`).
14//!
15//! ## Features
16//!
17//! * `native` (default) — enables rayon. Intended for the host-side
18//!   PyO3 crate and any integration tests that want parallelism.
19//! * `wasm` — opts out of rayon and any other host-only deps. The
20//!   WASM sub-crate sets `default-features = false, features = ["wasm"]`.
21//!
22//! Rayon is optional because the Wave 1 force simulation is single-
23//! threaded (see the note in `force.rs`); the feature flag reserves
24//! the parallel code path for when we need it.
25
26pub mod force;
27pub mod force_3d;
28#[cfg(test)]
29mod force_3d_tests;
30pub mod util;
31pub mod viewport;
32
33pub use force::{Simulation, SimulationConfig};
34pub use glam::{Vec2, Vec3};
35pub use viewport::{IndexPoint, ScoreKey, ViewportIndex};