Skip to main content

Module graph

Module graph 

Source
Expand description

Graph traversal helpers over the entities and relationships tables. Entity graph traversal (BFS over memory_entities + relations).

Queries the SQLite entity and relation tables to expand neighbourhood sets used by the related, recall, hybrid-search, deep-research and graph traverse commands.

walk holds the single BFS engine; the other modules are thin adapters. traverse answers “which memories are within N hops”, bfs additionally records the predecessor of each entity so evidence chains can be reconstructed.

Re-exports§

pub use walk::EdgeArrival;
pub use walk::GraphWalk;
pub use walk::InMemoryNeighbors;
pub use walk::MemoryEdge;
pub use walk::NeighborSource;
pub use walk::SqlNeighbors;
pub use walk::WalkDirection;
pub use walk::WalkOutcome;

Modules§

walk
Single bounded-BFS engine behind every graph traversal in the codebase.

Functions§

bfs_with_predecessors
BFS that also returns a predecessor map for path reconstruction.
traverse_from_memories_with_hops
BFS graph traversal returning the hop distance for each reached memory.
traverse_from_memories_with_hops_capped
Extended variant that accepts an optional neighbour cap per hop.

Type Aliases§

EntityDepthMap
Depth map from BFS: entity_id → hop distance from seeds.
PredecessorMap
Predecessor map from BFS: entity_id → (parent_entity_id, relation_type, edge_weight).