pub struct Graph {
pub nodes: NodeStorage,
pub csr: CsrGraph,
pub edge_plasticity: EdgePlasticity,
pub strings: StringInterner,
pub id_to_node: HashMap<InternedStr, NodeId>,
pub generation: Generation,
pub pagerank_computed: bool,
pub finalized: bool,
}Expand description
The complete property graph. Owns all storage.
Mutation methods increment generation for desync detection (FM-PL-006).
Fields§
§nodes: NodeStorage§csr: CsrGraph§edge_plasticity: EdgePlasticity§strings: StringInterner§id_to_node: HashMap<InternedStr, NodeId>Maps interned external ID -> internal NodeId.
generation: GenerationMonotonic counter incremented on every structural mutation.
pagerank_computed: bool§finalized: boolImplementations§
Source§impl Graph
impl Graph
pub fn new() -> Self
pub fn with_capacity(node_cap: usize, edge_cap: usize) -> Self
Sourcepub fn add_node(
&mut self,
external_id: &str,
label: &str,
node_type: NodeType,
tags: &[&str],
last_modified: f64,
change_frequency: f32,
) -> M1ndResult<NodeId>
pub fn add_node( &mut self, external_id: &str, label: &str, node_type: NodeType, tags: &[&str], last_modified: f64, change_frequency: f32, ) -> M1ndResult<NodeId>
Add a node. Returns its NodeId. Increments generation. Replaces: engine_v2.py PropertyGraph.add_node()
Sourcepub fn add_edge(
&mut self,
source: NodeId,
target: NodeId,
relation: &str,
weight: FiniteF32,
direction: EdgeDirection,
inhibitory: bool,
causal_strength: FiniteF32,
) -> M1ndResult<EdgeIdx>
pub fn add_edge( &mut self, source: NodeId, target: NodeId, relation: &str, weight: FiniteF32, direction: EdgeDirection, inhibitory: bool, causal_strength: FiniteF32, ) -> M1ndResult<EdgeIdx>
Add an edge. Validates source/target existence (FM-ACT-011). Increments generation. Replaces: engine_v2.py PropertyGraph.add_edge()
Sourcepub fn finalize(&mut self) -> M1ndResult<()>
pub fn finalize(&mut self) -> M1ndResult<()>
Build CSR forward + reverse adjacency. Compute PageRank.
Must be called before any query. Sets finalized = true.
Replaces: engine_fast.py FastPropertyGraph.finalize()
Sourcepub fn resolve_id(&self, external_id: &str) -> Option<NodeId>
pub fn resolve_id(&self, external_id: &str) -> Option<NodeId>
Resolve external string ID to NodeId.
pub fn set_node_provenance( &mut self, node: NodeId, provenance: NodeProvenanceInput<'_>, )
pub fn merge_node_provenance( &mut self, node: NodeId, incoming: NodeProvenanceInput<'_>, )
pub fn resolve_node_provenance(&self, node: NodeId) -> ResolvedNodeProvenance
Sourcepub fn avg_degree(&self) -> f32
pub fn avg_degree(&self) -> f32
Average out-degree.
Auto Trait Implementations§
impl Freeze for Graph
impl RefUnwindSafe for Graph
impl Send for Graph
impl Sync for Graph
impl Unpin for Graph
impl UnsafeUnpin for Graph
impl UnwindSafe for Graph
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more