pub struct Graph {
pub nodes: Vec<Node>,
pub rels: Vec<Relationship>,
}Expand description
Simple in-memory graph representation for the reference engine.
Not representative of production performance. All lookups are O(n) linear
scans over Vec. Production engines should use indexed storage (e.g.,
HashMap<u64, Node>) or implement StorageAdapter to map Plexus ops onto
their native storage layer. See docs/storage-engine-mapping.md.
Fields§
§nodes: Vec<Node>§rels: Vec<Relationship>Implementations§
Source§impl Graph
impl Graph
Sourcepub fn node_by_id(&self, id: u64) -> Option<&Node>
pub fn node_by_id(&self, id: u64) -> Option<&Node>
O(n) linear scan — production engines should use indexed lookups.
Sourcepub fn node_by_id_mut(&mut self, id: u64) -> Option<&mut Node>
pub fn node_by_id_mut(&mut self, id: u64) -> Option<&mut Node>
O(n) linear scan — production engines should use indexed lookups.
Sourcepub fn rel_by_id(&self, id: u64) -> Option<&Relationship>
pub fn rel_by_id(&self, id: u64) -> Option<&Relationship>
O(n) linear scan — production engines should use indexed lookups.
Sourcepub fn rel_by_id_mut(&mut self, id: u64) -> Option<&mut Relationship>
pub fn rel_by_id_mut(&mut self, id: u64) -> Option<&mut Relationship>
O(n) linear scan — production engines should use indexed lookups.
Trait Implementations§
impl StructuralPartialEq for Graph
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