pub struct Csr { /* private fields */ }Expand description
Compressed sparse row adjacency for one edge kind and direction.
Implementations§
Source§impl Csr
impl Csr
Sourcepub fn build(
nodes: u32,
edges: impl IntoIterator<Item = (Ordinal, Ordinal)>,
) -> Result<Self, CsrError>
pub fn build( nodes: u32, edges: impl IntoIterator<Item = (Ordinal, Ordinal)>, ) -> Result<Self, CsrError>
Builds adjacency over nodes ordinals from (from, to) pairs.
Duplicate pairs collapse; each row comes out sorted.
§Errors
Returns CsrError::OutOfRange when an edge names an ordinal at or
beyond nodes, and CsrError::Offsets when the edge count exceeds u32.
Sourcepub fn from_parts(
offsets: Vec<u32>,
targets: Vec<u32>,
) -> Result<Self, CsrError>
pub fn from_parts( offsets: Vec<u32>, targets: Vec<u32>, ) -> Result<Self, CsrError>
Reassembles adjacency from its two arrays, checking their consistency.
§Errors
Returns CsrError::Offsets when offsets is empty, not monotone, or
does not end at targets.len().
Sourcepub fn neighbours(&self, node: Ordinal) -> &[u32]
pub fn neighbours(&self, node: Ordinal) -> &[u32]
The neighbours of node, sorted; empty for an unknown node.
Trait Implementations§
impl Eq for Csr
impl StructuralPartialEq for Csr
Auto Trait Implementations§
impl Freeze for Csr
impl RefUnwindSafe for Csr
impl Send for Csr
impl Sync for Csr
impl Unpin for Csr
impl UnsafeUnpin for Csr
impl UnwindSafe for Csr
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