(
candidates: &mut HashMap<String, CandidateScore>,
node_id: &str,
path: Option<String>,
base: f64,
neighbor: bool,
)
| 98 | } |
| 99 | |
| 100 | pub fn merge_candidate( |
| 101 | candidates: &mut HashMap<String, CandidateScore>, |
| 102 | node_id: &str, |
| 103 | path: Option<String>, |
| 104 | base: f64, |
| 105 | neighbor: bool, |
| 106 | ) { |
| 107 | candidates |
| 108 | .entry(node_id.to_string()) |
| 109 | .and_modify(|candidate| { |
| 110 | candidate.base = candidate.base.max(base); |
| 111 | candidate.neighbor |= neighbor; |
| 112 | if candidate.path.is_none() { |
| 113 | candidate.path = path.clone(); |
| 114 | } |
| 115 | }) |
| 116 | .or_insert(CandidateScore { |
| 117 | base, |
| 118 | neighbor, |
| 119 | path, |
| 120 | }); |
| 121 | } |
| 122 | |
| 123 | /// Add all memory nodes adjacent to `node_id` as neighbor candidates. |
| 124 | fn add_memory_neighbors( |
no test coverage detected