diff --git a/poc-memory/src/search.rs b/poc-memory/src/search.rs index ad867a9..fb4f269 100644 --- a/poc-memory/src/search.rs +++ b/poc-memory/src/search.rs @@ -656,13 +656,14 @@ fn spreading_activation( } // Propagate hop by hop — all sources simultaneously + // Node weight does NOT gate traversal — only edge_decay and edge strength. + // Node weight is applied at the end for ranking. for _hop in 0..max_hops { let mut next_frontier: HashMap = HashMap::new(); for (key, act) in &frontier { for (neighbor, strength) in graph.neighbors(key) { - let neighbor_weight = store.node_weight(neighbor.as_str()); - let propagated = act * edge_decay * neighbor_weight * strength as f64; + let propagated = act * edge_decay * strength as f64; if propagated < min_activation { continue; } *next_frontier.entry(neighbor.clone()).or_insert(0.0) += propagated; @@ -678,7 +679,13 @@ fn spreading_activation( frontier = next_frontier; } - let mut results: Vec<_> = activation.into_iter().collect(); + // Apply node weight for ranking, not traversal + let mut results: Vec<_> = activation.into_iter() + .map(|(key, act)| { + let weight = store.node_weight(&key); + (key, act * weight) + }) + .collect(); results.sort_by(|a, b| b.1.total_cmp(&a.1)); results }