Skip to main content

Module spreading_activation

Module spreading_activation 

Source
Expand description

Spreading activation — associative retrieval over a weighted graph.

§The idea (cognitive science → retrieval)

In ACT-R and classic semantic-network models (Collins & Loftus 1975), recall works by spreading activation: cue concepts light up, and energy flows along associative links to related concepts, attenuating with distance. Items that many short, strong paths reach end up most activated — i.e. most relevant to the cue.

We apply this to code: seed activation at the files/symbols a task names, then spread it across the project graph (imports, calls, co-access). The resulting activation is an associative relevance signal that complements lexical BM25 — it surfaces files that are structurally close to the seeds even when they share no query terms.

§Convergence

Each node’s outgoing edges are fan-out-normalised (they sum to 1), so a node re-emits at most decay · energy (with decay < 1). Total energy in the system is therefore strictly decreasing, guaranteeing termination; a firing threshold prunes negligible pulses so cost stays near the active frontier.

Functions§

related_ranked
Convenience: spread from seeds and return the top-k non-seed nodes by activation, strongest first — the files most associatively related to the cues but not already named by them.
spread
Spread seeds over adjacency for up to iterations hops.