Skip to main content

ChunkedAdjacency

Struct ChunkedAdjacency 

Source
pub struct ChunkedAdjacency { /* private fields */ }
Expand description

Chunked adjacency lists with delta buffers.

This is the primary structure for storing edge connectivity. It supports efficient insertion, deletion (via tombstones), and sequential scanning.

Implementations§

Source§

impl ChunkedAdjacency

Source

pub fn new() -> Self

Creates a new chunked adjacency structure.

Source

pub fn with_chunk_capacity(capacity: usize) -> Self

Creates a new chunked adjacency with custom chunk capacity.

Source

pub fn add_edge(&self, src: NodeId, dst: NodeId, edge_id: EdgeId)

Adds an edge from src to dst.

Source

pub fn mark_deleted(&self, src: NodeId, edge_id: EdgeId)

Marks an edge as deleted.

Source

pub fn neighbors(&self, src: NodeId) -> Vec<NodeId>

Returns all neighbors of a node.

Note: This allocates a Vec to collect neighbors while the internal lock is held, then returns the Vec. For traversal performance, consider using edges_from if you also need edge IDs, to avoid multiple lookups.

Source

pub fn edges_from(&self, src: NodeId) -> Vec<(NodeId, EdgeId)>

Returns all (neighbor, edge_id) pairs for outgoing edges from a node.

Note: This allocates a Vec to collect edges while the internal lock is held, then returns the Vec. This is intentional to avoid holding the lock across iteration.

Source

pub fn out_degree(&self, src: NodeId) -> usize

Returns the out-degree of a node.

Source

pub fn compact(&self)

Compacts all adjacency lists.

Source

pub fn compact_if_needed(&self)

Compacts delta buffers that exceed the threshold.

Source

pub fn total_edge_count(&self) -> usize

Returns the total number of edges (including deleted).

Source

pub fn active_edge_count(&self) -> usize

Returns the number of active (non-deleted) edges.

Source

pub fn node_count(&self) -> usize

Returns the number of nodes with adjacency lists.

Source

pub fn clear(&self)

Clears all adjacency lists.

Trait Implementations§

Source§

impl Default for ChunkedAdjacency

Source§

fn default() -> Self

Returns the “default value” for a type. 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> 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> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.