Skip to main content

Module csr

Module csr 

Source
Expand description

Compressed Sparse Row (CSR) representation of the knowledge graph.

CsrGraph is a backend-agnostic in-memory snapshot of the directed, weighted edge set, built once and reused by all graph algorithms. Storing the graph as CSR โ€” rather than querying SQL per algorithm step โ€” lets the iterative algorithms (PageRank, label propagation) run in cache-friendly contiguous sweeps over flat Vecs.

relation is intentionally collapsed: every algorithm treats the graph as a single directed weighted graph, matching the existing smart_recall graph-boost semantics (recall.rs). Multi-relational PageRank is out of scope for the agent-memory workload.

Structsยง

CsrGraph
A directed, weighted graph in Compressed Sparse Row format.