Skip to main content

Module algo

Module algo 

Source
Expand description

Graph algorithms operating on an in-memory CSR snapshot.

These algorithms (PageRank, connected components, shortest path, similarity) are pure-Rust, zero-dependency, and backend-agnostic: they consume a CsrGraph built from the edge set rather than running SQL per step. This keeps the iterative math identical across the SQLite and PostgreSQL backends — the same zero-drift principle as recall.rs’s compute_recency.

Available on the graph feature with no extra feature gate (the algorithms add no dependencies).

Re-exports§

pub use community::LABEL_PROPAGATION_ITERS;
pub use community::connected_components;
pub use community::label_propagation;
pub use community::label_propagation_default;
pub use csr::CsrGraph;
pub use pagerank::PAGERANK_DAMPING;
pub use pagerank::PAGERANK_EPS;
pub use pagerank::PAGERANK_ITERS;
pub use pagerank::pagerank;
pub use pagerank::pagerank_default;
pub use pagerank::pagerank_scores;
pub use path::SHORTEST_PATH_W_MIN;
pub use path::dijkstra;
pub use path::shortest_path;
pub use path::shortest_path_ids;
pub use similarity::adamic_adar;
pub use similarity::common_neighbors;
pub use similarity::jaccard_similarity;

Modules§

community
Community detection: connected components and label propagation.
csr
Compressed Sparse Row (CSR) representation of the knowledge graph.
pagerank
Weighted PageRank centrality.
path
Weighted shortest path via Dijkstra.
similarity
Node similarity and link prediction.