llm_kernel/graph/algo/mod.rs
1//! Graph algorithms operating on an in-memory CSR snapshot.
2//!
3//! These algorithms (PageRank, connected components, shortest path, similarity)
4//! are pure-Rust, zero-dependency, and backend-agnostic: they consume a
5//! [`CsrGraph`] built from the edge set rather than running SQL per step. This
6//! keeps the iterative math identical across the SQLite and PostgreSQL
7//! backends — the same zero-drift principle as `recall.rs`'s `compute_recency`.
8//!
9//! Available on the `graph` feature with no extra feature gate (the algorithms
10//! add no dependencies).
11
12pub mod community;
13pub mod csr;
14pub mod pagerank;
15pub mod path;
16pub mod similarity;
17
18pub use community::{
19 LABEL_PROPAGATION_ITERS, connected_components, label_propagation, label_propagation_default,
20};
21pub use csr::CsrGraph;
22pub use pagerank::{
23 PAGERANK_DAMPING, PAGERANK_EPS, PAGERANK_ITERS, pagerank, pagerank_default, pagerank_scores,
24};
25pub use path::{SHORTEST_PATH_W_MIN, dijkstra, shortest_path, shortest_path_ids};
26pub use similarity::{adamic_adar, common_neighbors, jaccard_similarity, link_prediction};