pub struct ActivationConfig {
pub decay_factor: f64,
pub epsilon: f64,
pub max_iterations: usize,
pub max_depth: usize,
pub inhibition_strength: f64,
pub inhibition_threshold: f64,
pub max_frontier_size: usize,
}Expand description
Activation configuration.
Fields§
§decay_factor: f64Depth decay factor (default 0.7). Each layer multiplies activation by d.
epsilon: f64Convergence threshold — nodes below this are excluded from results (default 0.01).
max_iterations: usizeMaximum propagation iterations (default 10).
Acts as a secondary cap in addition to max_depth.
max_depth: usizeMaximum traversal depth from seed nodes (default 3).
inhibition_strength: f64Lateral inhibition strength μ (default 0.1). Set to 0.0 to disable.
inhibition_threshold: f64Cosine similarity threshold for lateral inhibition (default 0.7). Nodes with similarity above this to seeds but not graph-connected are suppressed.
max_frontier_size: usizeHard safety cap on frontier size per depth level (default 10,000). When the frontier exceeds this limit, only the highest-scoring entries are kept. Prevents OOM/DoS from high-degree hub nodes (F-ENG-01).
Implementations§
Source§impl ActivationConfig
impl ActivationConfig
Sourcepub fn validate(&self) -> HirnResult<()>
pub fn validate(&self) -> HirnResult<()>
Validate graph activation bounds before execution.
pub const fn propagation_steps(&self) -> usize
Sourcepub fn tuned_for_graph(&self, node_count: usize, edge_count: usize) -> Self
pub fn tuned_for_graph(&self, node_count: usize, edge_count: usize) -> Self
Return a copy of this config with max_frontier_size adaptively scaled to
the observed graph density (F-103 fix).
The heuristic is:
- If the graph has no edges or no nodes, return self unchanged.
- Compute average out-degree =
edge_count / node_count. effective = min(max_frontier_size, max(256, avg_degree * 100))
This caps the frontier relative to how dense the graph actually is, so a sparse graph doesn’t waste a 10 K buffer and a dense hub graph doesn’t build a 100 K BinaryHeap per depth step.
Trait Implementations§
Source§impl Clone for ActivationConfig
impl Clone for ActivationConfig
Source§fn clone(&self) -> ActivationConfig
fn clone(&self) -> ActivationConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more