pub struct AdjacencyGraph { /* private fields */ }Expand description
An undirected adjacency graph without self-loops.
Nodes are numbered 0..n. Each node stores a sorted, deduplicated
list of its neighbors.
Implementations§
Source§impl AdjacencyGraph
impl AdjacencyGraph
Sourcepub fn from_adjacency_list(adj: Vec<Vec<usize>>) -> Self
pub fn from_adjacency_list(adj: Vec<Vec<usize>>) -> Self
Create an AdjacencyGraph from a pre-built adjacency list.
Self-loops are removed. Neighbor lists are sorted and deduplicated.
Sourcepub fn from_csr_matrix<T>(mat: &CsrMatrix<T>) -> SparseResult<Self>
pub fn from_csr_matrix<T>(mat: &CsrMatrix<T>) -> SparseResult<Self>
Build an adjacency graph from a CSR matrix.
The matrix is treated as an adjacency matrix. Both upper and lower triangles are considered (symmetrized). Self-loops are removed.
Sourcepub fn from_csr_array<T>(arr: &CsrArray<T>) -> SparseResult<Self>
pub fn from_csr_array<T>(arr: &CsrArray<T>) -> SparseResult<Self>
Build an adjacency graph from a CsrArray.
Sourcepub fn from_csc_array<T>(arr: &CscArray<T>) -> SparseResult<Self>
pub fn from_csc_array<T>(arr: &CscArray<T>) -> SparseResult<Self>
Build an adjacency graph from a CscArray.
Trait Implementations§
Source§impl Clone for AdjacencyGraph
impl Clone for AdjacencyGraph
Source§fn clone(&self) -> AdjacencyGraph
fn clone(&self) -> AdjacencyGraph
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for AdjacencyGraph
impl RefUnwindSafe for AdjacencyGraph
impl Send for AdjacencyGraph
impl Sync for AdjacencyGraph
impl Unpin for AdjacencyGraph
impl UnsafeUnpin for AdjacencyGraph
impl UnwindSafe for AdjacencyGraph
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