Description
graph_recall_astar in crates/zeph-memory/src/graph/retrieval_astar.rs runs an A* search from every seed entity to every other node in the in-memory graph (lines 257–283). With limit seeds and N BFS-reachable nodes the complexity is O(limit × N × E log N) where E is the edge count per hop. No cap is applied to node_map size.
Actual Behavior
For a populated graph with many entities and max_hops = 2, the inner loop over node_map.values() can grow large. The spreading-activation path (activation.rs) caps activated nodes at 5; the A* path has no analogous guard.
Expected Behavior
Add a MAX_GRAPH_NODES constant (e.g. 500) and truncate node_map to the highest-scored nodes before the A* loop, consistent with how spreading-activation guards itself.
Environment
- HEAD: 9d76476
- File:
crates/zeph-memory/src/graph/retrieval_astar.rs:257-283
Description
graph_recall_astarincrates/zeph-memory/src/graph/retrieval_astar.rsruns an A* search from every seed entity to every other node in the in-memory graph (lines 257–283). Withlimitseeds andNBFS-reachable nodes the complexity isO(limit × N × E log N)whereEis the edge count per hop. No cap is applied tonode_mapsize.Actual Behavior
For a populated graph with many entities and
max_hops = 2, the inner loop overnode_map.values()can grow large. The spreading-activation path (activation.rs) caps activated nodes at 5; the A* path has no analogous guard.Expected Behavior
Add a
MAX_GRAPH_NODESconstant (e.g. 500) and truncatenode_mapto the highest-scored nodes before the A* loop, consistent with how spreading-activation guards itself.Environment
crates/zeph-memory/src/graph/retrieval_astar.rs:257-283