pub struct CsrMutableEdges { /* private fields */ }Expand description
Mutable edge storage combining CSR base with delta slab
Provides efficient edge mutations with automatic rebuild when delta grows too large.
Implementations§
Source§impl CsrMutableEdges
impl CsrMutableEdges
Sourcepub fn with_coords(coords: Vec<PackedCoord>) -> Self
pub fn with_coords(coords: Vec<PackedCoord>) -> Self
Create with initial vertex coordinates
Sourcepub fn add_edge(&mut self, from: VertexId, to: VertexId)
pub fn add_edge(&mut self, from: VertexId, to: VertexId)
Add an edge, rebuilding if threshold reached
Sourcepub fn remove_edge(&mut self, from: VertexId, to: VertexId)
pub fn remove_edge(&mut self, from: VertexId, to: VertexId)
Remove an edge, rebuilding if threshold reached
Sourcepub fn out_edges(&self, v: VertexId) -> Vec<VertexId>
pub fn out_edges(&self, v: VertexId) -> Vec<VertexId>
Get outgoing edges for a vertex (merged view)
Sourcepub fn in_edges(&self, v: VertexId) -> &[VertexId]
pub fn in_edges(&self, v: VertexId) -> &[VertexId]
Get incoming edges from base CSR (delta not applied for performance) After rebuild, this will include all changes
Sourcepub fn delta_size(&self) -> usize
pub fn delta_size(&self) -> usize
Get the current delta size
Sourcepub fn begin_batch(&mut self)
pub fn begin_batch(&mut self)
Enter batch mode - defer rebuilds until end_batch() is called
Sourcepub fn add_vertex(&mut self, coord: PackedCoord, vertex_id: u32) -> usize
pub fn add_vertex(&mut self, coord: PackedCoord, vertex_id: u32) -> usize
Add a new vertex with its coordinate and ID
Sourcepub fn add_vertices_batch(&mut self, items: &[(PackedCoord, u32)])
pub fn add_vertices_batch(&mut self, items: &[(PackedCoord, u32)])
Add many vertices at once; single rebuild at end.
Sourcepub fn update_coord(&mut self, vertex_id: VertexId, new_coord: PackedCoord)
pub fn update_coord(&mut self, vertex_id: VertexId, new_coord: PackedCoord)
Update coordinate for a vertex in the cache Marks for rebuild to maintain sort order
Sourcepub fn build_from_adjacency(
&mut self,
adjacency: Vec<(u32, Vec<u32>)>,
coords: Vec<PackedCoord>,
vertex_ids: Vec<u32>,
)
pub fn build_from_adjacency( &mut self, adjacency: Vec<(u32, Vec<u32>)>, coords: Vec<PackedCoord>, vertex_ids: Vec<u32>, )
Build underlying CSR directly from adjacency and provided coords/ids. This replaces the current base and clears the delta slab.
Trait Implementations§
Source§impl Debug for CsrMutableEdges
impl Debug for CsrMutableEdges
Auto Trait Implementations§
impl Freeze for CsrMutableEdges
impl RefUnwindSafe for CsrMutableEdges
impl Send for CsrMutableEdges
impl Sync for CsrMutableEdges
impl Unpin for CsrMutableEdges
impl UnwindSafe for CsrMutableEdges
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
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