Skip to main content

Module pagerank

Module pagerank 

Source
Expand description

Weighted PageRank centrality.

Standard power iteration with dangling-node redistribution. Edges carry weights (relationship strength), so rank flows along an out-edge in proportion to that edge’s weight divided by the source’s total out-weight — stronger relations pass more rank, matching the smart_recall boost semantics.

The iterative math is pure-Rust over a CsrGraph and backend-agnostic, so the SQLite and PostgreSQL recall paths can import the same pagerank_default and stay drift-free (see recall.rs’s compute_recency for the same principle).

Constants§

PAGERANK_DAMPING
damping factor (rank a node keeps vs. teleports); the canonical 0.85.
PAGERANK_EPS
L1-norm convergence threshold; iteration stops once the rank vector stops moving more than this between steps.
PAGERANK_ITERS
Maximum power-iteration count before giving up on further convergence.

Functions§

pagerank
Weighted PageRank over g, returning one score per node index.
pagerank_default
PageRank with the canonical defaults (PAGERANK_DAMPING, PAGERANK_ITERS).
pagerank_scores
Build a CSR snapshot from conn and return (node_id, score) pairs in node-index order.