pub struct CsrGraph {
pub offsets: Vec<u64>,
pub targets: Vec<NodeId>,
pub weights: Vec<AtomicU32>,
pub inhibitory: Vec<bool>,
pub relations: Vec<InternedStr>,
pub directions: Vec<EdgeDirection>,
pub causal_strengths: Vec<FiniteF32>,
pub rev_offsets: Vec<u64>,
pub rev_sources: Vec<NodeId>,
pub rev_edge_idx: Vec<EdgeIdx>,
pub pending_edges: Vec<PendingEdge>,
}Expand description
Compressed Sparse Row graph with forward and reverse adjacency.
For node i, outgoing edges span offsets[i]..offsets[i+1]
into targets, weights, inhibitory, relations, directions, causal_strengths.
Fields§
§offsets: Vec<u64>Length: num_nodes + 1. offsets[num_nodes] == total_edges.
targets: Vec<NodeId>Length: total_edges. Target node for each edge.
weights: Vec<AtomicU32>Length: total_edges. Edge weight — atomic for lock-free plasticity updates (FM-ACT-021).
inhibitory: Vec<bool>Length: total_edges. true = inhibitory edge.
relations: Vec<InternedStr>Length: total_edges. Relation type (interned).
directions: Vec<EdgeDirection>Length: total_edges. Forward or Bidirectional.
causal_strengths: Vec<FiniteF32>Length: total_edges. Causal strength in [0.0, 1.0].
rev_offsets: Vec<u64>Length: num_nodes + 1.
rev_sources: Vec<NodeId>Length: total_edges. Source node for each reverse edge.
rev_edge_idx: Vec<EdgeIdx>Length: total_edges. Index into forward arrays for this reverse edge.
pending_edges: Vec<PendingEdge>Pre-finalize edge staging area.
Implementations§
Source§impl CsrGraph
impl CsrGraph
Sourcepub fn in_range(&self, node: NodeId) -> Range<usize>
pub fn in_range(&self, node: NodeId) -> Range<usize>
Incoming edge range for node (reverse CSR).
Sourcepub fn read_weight(&self, edge: EdgeIdx) -> FiniteF32
pub fn read_weight(&self, edge: EdgeIdx) -> FiniteF32
Read weight atomically as FiniteF32 (FM-ACT-021).
Sourcepub fn atomic_max_weight(
&self,
edge: EdgeIdx,
new_val: FiniteF32,
max_retries: u32,
) -> M1ndResult<()>
pub fn atomic_max_weight( &self, edge: EdgeIdx, new_val: FiniteF32, max_retries: u32, ) -> M1ndResult<()>
Atomic CAS max on edge weight. Returns Ok on success, Err after retry limit (FM-ACT-019). Replaces: engine_fast.py direct weight assignment (now lock-free).
Sourcepub fn atomic_write_weight(
&self,
edge: EdgeIdx,
new_val: FiniteF32,
max_retries: u32,
) -> M1ndResult<()>
pub fn atomic_write_weight( &self, edge: EdgeIdx, new_val: FiniteF32, max_retries: u32, ) -> M1ndResult<()>
Atomic CAS write on edge weight (for plasticity). Returns Ok on success, Err after retry limit.