pub struct GraphSnapshot { /* private fields */ }Expand description
A frozen, read-only view of a NativeGraph at the instant
NativeGraph::snapshot was called. Reads are
served from the captured Arc and are unaffected by later writes to the
engine, so a whole traversal sees one consistent version of the graph.
Implementations§
Source§impl GraphSnapshot
impl GraphSnapshot
Sourcepub fn get_node(&self, id: u64) -> Option<Node>
pub fn get_node(&self, id: u64) -> Option<Node>
Fetch a node by id, or None if absent in this snapshot.
Sourcepub fn get_edge(&self, id: u64) -> Option<Edge>
pub fn get_edge(&self, id: u64) -> Option<Edge>
Fetch an edge by id, or None if absent in this snapshot.
Sourcepub fn get_node_arc(&self, id: u64) -> Option<Arc<Node>>
pub fn get_node_arc(&self, id: u64) -> Option<Arc<Node>>
Zero-copy node fetch within the snapshot — an Arc<Node> handle instead
of a deep clone (see NativeGraph::get_node_arc).
Sourcepub fn get_edge_arc(&self, id: u64) -> Option<Arc<Edge>>
pub fn get_edge_arc(&self, id: u64) -> Option<Arc<Edge>>
Zero-copy edge fetch within the snapshot (see
NativeGraph::get_edge_arc).
Sourcepub fn neighbor_ids(
&self,
node_id: u64,
direction: Direction,
kind: Option<&str>,
) -> Vec<u64>
pub fn neighbor_ids( &self, node_id: u64, direction: Direction, kind: Option<&str>, ) -> Vec<u64>
Distinct neighbour ids in direction, optionally kind-filtered.
Sourcepub fn neighbors_arc(
&self,
node_id: u64,
direction: Direction,
kind: Option<&str>,
) -> Vec<Arc<Node>>
pub fn neighbors_arc( &self, node_id: u64, direction: Direction, kind: Option<&str>, ) -> Vec<Arc<Node>>
Distinct neighbours as zero-copy Arc<Node> handles (see
NativeGraph::neighbors_arc).
Sourcepub fn neighbors(
&self,
node_id: u64,
direction: Direction,
kind: Option<&str>,
) -> Vec<Node>
pub fn neighbors( &self, node_id: u64, direction: Direction, kind: Option<&str>, ) -> Vec<Node>
Adjacent nodes in direction, optionally kind-filtered.
Sourcepub fn edges_of(&self, node_id: u64, direction: Direction) -> Vec<Edge>
pub fn edges_of(&self, node_id: u64, direction: Direction) -> Vec<Edge>
Full edge records incident to node_id in direction.
Sourcepub fn nodes_by_kind(
&self,
kind: &str,
limit: usize,
offset: usize,
) -> Vec<Node>
pub fn nodes_by_kind( &self, kind: &str, limit: usize, offset: usize, ) -> Vec<Node>
Nodes of kind, paginated by limit/offset.
Sourcepub fn csr_out(&self) -> CsrAdjacency
pub fn csr_out(&self) -> CsrAdjacency
A Compressed-Sparse-Row view of this snapshot’s out-adjacency
(CsrAdjacency) — the cache-friendly, lock-free substrate for
whole-graph parallel scans and algorithms. Vertices are the
snapshot’s node ids in ascending order; each vertex’s neighbours are its
distinct out-neighbours (as in neighbor_ids with
no kind filter). Built by flattening the frozen snapshot, so it is a
consistent one-version view with no locking.
Sourcepub fn csr_in(&self) -> CsrAdjacency
pub fn csr_in(&self) -> CsrAdjacency
A Compressed-Sparse-Row view of this snapshot’s in-adjacency — the
reverse of csr_out: each vertex’s “neighbours” are its
distinct predecessors (nodes with an edge into it). Same
CsrAdjacency type and dense-index layout, so reverse traversal and
pull-style algorithms (reverse reachability, in-degree, reverse PageRank)
run over it exactly as forward ones run over csr_out.