Skip to main content

spread

Function spread 

Source
pub fn spread(
    seeds: &HashMap<String, f64>,
    adjacency: &HashMap<String, Vec<(String, f64)>>,
    decay: f64,
    iterations: usize,
) -> HashMap<String, f64>
Expand description

Spread seeds over adjacency for up to iterations hops.

  • seeds: initial activation per node (the query cues).
  • adjacency: node → [(neighbour, weight)]; weights need not be normalised (we fan-out-normalise internally).
  • decay: per-hop attenuation in (0, 1); smaller ⇒ activation stays more local. Values outside the range are clamped.

Returns accumulated activation per reached node (including seeds). Nodes not reachable from any seed are absent (implicitly zero).