Add all memory nodes adjacent to `node_id` as neighbor candidates.
(
repo: &Repository,
node_id: &str,
depth: u8,
candidates: &mut HashMap<String, CandidateScore>,
)
| 122 | |
| 123 | /// Add all memory nodes adjacent to `node_id` as neighbor candidates. |
| 124 | fn add_memory_neighbors( |
| 125 | repo: &Repository, |
| 126 | node_id: &str, |
| 127 | depth: u8, |
| 128 | candidates: &mut HashMap<String, CandidateScore>, |
| 129 | ) -> Result<(), Status> { |
| 130 | let subgraph = repo |
| 131 | .vault_kg_neighbors(node_id, depth) |
| 132 | .map_err(repository_error)?; |
| 133 | for node in subgraph.nodes { |
| 134 | if node.has_type(atomic_core::kg::ontology::Class::Memory) && node.id != node_id { |
| 135 | merge_candidate( |
| 136 | candidates, |
| 137 | &node.id, |
| 138 | memory_path_from_node(&node), |
| 139 | 0.0, |
| 140 | true, |
| 141 | ); |
| 142 | } |
| 143 | } |
| 144 | Ok(()) |
| 145 | } |
| 146 | |
| 147 | /// Rank-derived score for the `rank`-th KG search result (0-based). |
| 148 | fn rank_score(rank: usize) -> f64 { |
no test coverage detected