pub struct DegreeCache { /* private fields */ }Expand description
Pre-computed out-degree for every node slot across all relationship types.
Built lazily on first call to Engine::top_k_by_degree or
Engine::out_degree by scanning:
- CSR forward files (checkpointed edges) — contribution per slot from offsets.
- Delta log records (uncheckpointed edges) — each
DeltaRecord.srcincrements the source slot’s count.
Keyed by the lower-32-bit slot extracted from NodeId.0
(i.e. node_id & 0xFFFF_FFFF).
Lookup is O(1). Engine::top_k_by_degree uses this cache to answer
“top-k highest-degree nodes of label L” in O(N log k) where N is the
label’s node count (HWM), rather than O(N × E) full edge scans.
Queries that never call top_k_by_degree (e.g. point lookups, scans,
hop traversals) pay zero cost: no CSR iteration, no delta-log reads.
Implementations§
Source§impl DegreeCache
impl DegreeCache
Sourcepub fn out_degree(&self, slot: u64) -> u32
pub fn out_degree(&self, slot: u64) -> u32
Return the total out-degree for slot across all relationship types.
Returns 0 for slots that have no outgoing edges.
Trait Implementations§
Source§impl Debug for DegreeCache
impl Debug for DegreeCache
Source§impl Default for DegreeCache
impl Default for DegreeCache
Source§fn default() -> DegreeCache
fn default() -> DegreeCache
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for DegreeCache
impl RefUnwindSafe for DegreeCache
impl Send for DegreeCache
impl Sync for DegreeCache
impl Unpin for DegreeCache
impl UnsafeUnpin for DegreeCache
impl UnwindSafe for DegreeCache
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> 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>
Converts
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>
Converts
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