Skip to main content

GraphSnapshot

Struct GraphSnapshot 

Source
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

Source

pub fn get_node(&self, id: u64) -> Option<Node>

Fetch a node by id, or None if absent in this snapshot.

Source

pub fn get_edge(&self, id: u64) -> Option<Edge>

Fetch an edge by id, or None if absent in this snapshot.

Source

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).

Source

pub fn get_edge_arc(&self, id: u64) -> Option<Arc<Edge>>

Zero-copy edge fetch within the snapshot (see NativeGraph::get_edge_arc).

Source

pub fn neighbor_ids( &self, node_id: u64, direction: Direction, kind: Option<&str>, ) -> Vec<u64>

Distinct neighbour ids in direction, optionally kind-filtered.

Source

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).

Source

pub fn neighbors( &self, node_id: u64, direction: Direction, kind: Option<&str>, ) -> Vec<Node>

Adjacent nodes in direction, optionally kind-filtered.

Source

pub fn edges_of(&self, node_id: u64, direction: Direction) -> Vec<Edge>

Full edge records incident to node_id in direction.

Source

pub fn all_nodes(&self) -> Vec<Node>

Every node in this snapshot.

Source

pub fn all_edges(&self) -> Vec<Edge>

Every edge in this snapshot.

Source

pub fn nodes_by_kind( &self, kind: &str, limit: usize, offset: usize, ) -> Vec<Node>

Nodes of kind, paginated by limit/offset.

Source

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.

Source

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.

Trait Implementations§

Source§

impl Clone for GraphSnapshot

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.