pub struct HarbouredCsrView<'a> { /* private fields */ }Expand description
Zero-copy view over a single harboured graph’s CellAnchor, forward CSR,
backward CSC, and optional f32 edge weight tables.
Implementations§
Source§impl<'a> HarbouredCsrView<'a>
impl<'a> HarbouredCsrView<'a>
Sourcepub fn from_slices(
header: &'a HarbouredGraphHeader,
anchors: &'a [CellAnchor],
csr_row_ptr: &'a [u32],
csr_col_idx: &'a [u32],
edge_anchor: &'a [u32],
csc_col_ptr: &'a [u32],
csc_row_idx: &'a [u32],
edge_weights: Option<&'a [f32]>,
) -> Result<Self, TopologyError>
pub fn from_slices( header: &'a HarbouredGraphHeader, anchors: &'a [CellAnchor], csr_row_ptr: &'a [u32], csr_col_idx: &'a [u32], edge_anchor: &'a [u32], csc_col_ptr: &'a [u32], csc_row_idx: &'a [u32], edge_weights: Option<&'a [f32]>, ) -> Result<Self, TopologyError>
Construct and validate a HarbouredCsrView from pre-sliced tables.
Sourcepub fn from_segment_bytes(
segment: &'a [u8],
header: &'a HarbouredGraphHeader,
) -> Result<Self, TopologyError>
pub fn from_segment_bytes( segment: &'a [u8], header: &'a HarbouredGraphHeader, ) -> Result<Self, TopologyError>
Construct a HarbouredCsrView by slicing a GTOP segment at the offsets in header.
pub const fn header(&self) -> &'a HarbouredGraphHeader
pub const fn vertex_count(&self) -> u32
pub const fn edge_count(&self) -> u32
pub const fn anchors(&self) -> &'a [CellAnchor]
pub const fn csr_row_ptr(&self) -> &'a [u32]
pub const fn csr_col_idx(&self) -> &'a [u32]
pub const fn edge_anchor(&self) -> &'a [u32]
pub const fn edge_anchors(&self) -> &'a [u32]
pub const fn csc_col_ptr(&self) -> &'a [u32]
pub const fn csc_row_idx(&self) -> &'a [u32]
pub const fn edge_weights(&self) -> Option<&'a [f32]>
Sourcepub fn cell_anchor(&self, v: u32) -> Result<&'a CellAnchor, TopologyError>
pub fn cell_anchor(&self, v: u32) -> Result<&'a CellAnchor, TopologyError>
Look up the 16-byte CellAnchor for vertex v.
Sourcepub fn out_neighbors(&self, u: u32) -> Result<&'a [u32], TopologyError>
pub fn out_neighbors(&self, u: u32) -> Result<&'a [u32], TopologyError>
Outgoing neighbour slice for vertex u in $O(1)$.
Sourcepub fn out_edge_anchors(&self, u: u32) -> Result<&'a [u32], TopologyError>
pub fn out_edge_anchors(&self, u: u32) -> Result<&'a [u32], TopologyError>
Outgoing edge anchor indices (1-cell ID or NQuin slot) for vertex u in $O(1)$.
Sourcepub fn out_edge_weights(
&self,
u: u32,
) -> Result<Option<&'a [f32]>, TopologyError>
pub fn out_edge_weights( &self, u: u32, ) -> Result<Option<&'a [f32]>, TopologyError>
Optional outgoing edge weights for vertex u in $O(1)$.
Sourcepub fn in_neighbors(&self, v: u32) -> Result<&'a [u32], TopologyError>
pub fn in_neighbors(&self, v: u32) -> Result<&'a [u32], TopologyError>
Incoming neighbour slice for vertex v in $O(1)$ via backward CSC.
Sourcepub fn out_degree(&self, u: u32) -> Result<u32, TopologyError>
pub fn out_degree(&self, u: u32) -> Result<u32, TopologyError>
Out-degree of vertex u in $O(1)$.
Sourcepub fn in_degree(&self, v: u32) -> Result<u32, TopologyError>
pub fn in_degree(&self, v: u32) -> Result<u32, TopologyError>
In-degree of vertex v in $O(1)$ via backward CSC.
Sourcepub fn find_vertex_by_entity_hash(&self, entity_hash: u64) -> Option<u32>
pub fn find_vertex_by_entity_hash(&self, entity_hash: u64) -> Option<u32>
Find vertex index by 64-bit entity_hash.
Uses binary search when sorted by entity_hash and falls back to a deterministic linear scan.
Sourcepub fn find_vertices_by_cell(
&self,
domain: AnchorDomain,
cell_index: u32,
out: &mut [u32],
) -> usize
pub fn find_vertices_by_cell( &self, domain: AnchorDomain, cell_index: u32, out: &mut [u32], ) -> usize
Collect all vertices anchored to (domain, cell_index) into caller buffer out.
Sourcepub fn collect_roots(&self, out: &mut [u32]) -> usize
pub fn collect_roots(&self, out: &mut [u32]) -> usize
Collect all source/root vertices (in_degree(v) == 0) into out.
Sourcepub fn collect_sinks(&self, out: &mut [u32]) -> usize
pub fn collect_sinks(&self, out: &mut [u32]) -> usize
Collect all sink/leaf vertices (out_degree(u) == 0) into out.
Trait Implementations§
Source§impl<'a> Clone for HarbouredCsrView<'a>
impl<'a> Clone for HarbouredCsrView<'a>
impl<'a> Copy for HarbouredCsrView<'a>
Source§impl<'a> Debug for HarbouredCsrView<'a>
impl<'a> Debug for HarbouredCsrView<'a>
Source§impl<'a> PartialEq for HarbouredCsrView<'a>
impl<'a> PartialEq for HarbouredCsrView<'a>
impl<'a> StructuralPartialEq for HarbouredCsrView<'a>
Auto Trait Implementations§
impl<'a> Freeze for HarbouredCsrView<'a>
impl<'a> RefUnwindSafe for HarbouredCsrView<'a>
impl<'a> Send for HarbouredCsrView<'a>
impl<'a> Sync for HarbouredCsrView<'a>
impl<'a> Unpin for HarbouredCsrView<'a>
impl<'a> UnsafeUnpin for HarbouredCsrView<'a>
impl<'a> UnwindSafe for HarbouredCsrView<'a>
Blanket Implementations§
§impl<S, A> Aggregate<Result<S, Error>> for Awhere
A: Aggregate<S>,
impl<S, A> Aggregate<Result<S, Error>> for Awhere
A: Aggregate<S>,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more