pub struct CsrEdges { /* private fields */ }Expand description
Compressed Sparse Row (CSR) format for edge storage
Replaces Vec
- offsets: Start index for each vertex’s edges
- edges: All edges concatenated
Memory usage: O(V + E) instead of O(V * avg_degree * vec_overhead)
Implementations§
Source§impl CsrEdges
impl CsrEdges
Sourcepub fn from_adjacency(adj: Vec<(u32, Vec<u32>)>, coords: &[PackedCoord]) -> Self
pub fn from_adjacency(adj: Vec<(u32, Vec<u32>)>, coords: &[PackedCoord]) -> Self
Create CSR from adjacency list representation
§Arguments
- adj: Vector of (vertex_id, outgoing_edges) where vertex_id is the actual VertexId value
- coords: Packed coordinates for each vertex (used for deterministic ordering)
§Edge Ordering
Edges are sorted by (row, col, vertex_id) to ensure deterministic evaluation order for formulas (important for functions with side effects)
Sourcepub fn in_edges(&self, v: VertexId) -> &[VertexId]
pub fn in_edges(&self, v: VertexId) -> &[VertexId]
Get incoming edges for a vertex (who depends on this vertex)
Sourcepub fn out_degree(&self, v: VertexId) -> usize
pub fn out_degree(&self, v: VertexId) -> usize
Get the out-degree of a vertex
Sourcepub fn num_vertices(&self) -> usize
pub fn num_vertices(&self) -> usize
Number of vertices in the graph
Sourcepub fn memory_usage(&self) -> usize
pub fn memory_usage(&self) -> usize
Memory usage in bytes
Sourcepub fn builder() -> CsrBuilder
pub fn builder() -> CsrBuilder
Builder pattern for incremental construction
Sourcepub fn iter(&self) -> CsrIterator<'_> ⓘ
pub fn iter(&self) -> CsrIterator<'_> ⓘ
Iterate over all vertices and their outgoing edges
Trait Implementations§
Auto Trait Implementations§
impl Freeze for CsrEdges
impl RefUnwindSafe for CsrEdges
impl Send for CsrEdges
impl Sync for CsrEdges
impl Unpin for CsrEdges
impl UnwindSafe for CsrEdges
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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