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
impl ChunkedAdjacency
Sourcepub fn with_chunk_capacity(capacity: usize) -> Self
pub fn with_chunk_capacity(capacity: usize) -> Self
Creates a new chunked adjacency with custom chunk capacity.
Sourcepub fn add_edge(&self, src: NodeId, dst: NodeId, edge_id: EdgeId)
pub fn add_edge(&self, src: NodeId, dst: NodeId, edge_id: EdgeId)
Adds an edge from src to dst.
Sourcepub fn mark_deleted(&self, src: NodeId, edge_id: EdgeId)
pub fn mark_deleted(&self, src: NodeId, edge_id: EdgeId)
Marks an edge as deleted.
Sourcepub fn neighbors(&self, src: NodeId) -> Vec<NodeId>
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.
Sourcepub fn edges_from(&self, src: NodeId) -> Vec<(NodeId, EdgeId)>
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.
Sourcepub fn out_degree(&self, src: NodeId) -> usize
pub fn out_degree(&self, src: NodeId) -> usize
Returns the out-degree of a node.
Sourcepub fn compact_if_needed(&self)
pub fn compact_if_needed(&self)
Compacts delta buffers that exceed the threshold.
Sourcepub fn total_edge_count(&self) -> usize
pub fn total_edge_count(&self) -> usize
Returns the total number of edges (including deleted).
Sourcepub fn active_edge_count(&self) -> usize
pub fn active_edge_count(&self) -> usize
Returns the number of active (non-deleted) edges.
Sourcepub fn node_count(&self) -> usize
pub fn node_count(&self) -> usize
Returns the number of nodes with adjacency lists.