pub struct IndexedUndirectedGraph<C> { /* private fields */ }Expand description
An undirected graph stored as dense usize indices with weighted adjacency lists.
Implementations§
Source§impl<C> IndexedUndirectedGraph<C>
impl<C> IndexedUndirectedGraph<C>
Sourcepub fn from_edges(node_count: usize, edges: Vec<(usize, usize, C)>) -> Selfwhere
C: Clone,
pub fn from_edges(node_count: usize, edges: Vec<(usize, usize, C)>) -> Selfwhere
C: Clone,
Build an undirected indexed graph from a list of edges.
Sourcepub const fn node_count(&self) -> usize
pub const fn node_count(&self) -> usize
Return the number of nodes in the graph.
Sourcepub fn successors(&self, node: usize) -> &[(usize, C)]
pub fn successors(&self, node: usize) -> &[(usize, C)]
Return the adjacency list for node.
Sourcepub fn edges(&self) -> &[(usize, usize, C)]
pub fn edges(&self) -> &[(usize, usize, C)]
Return the canonical edge list (each edge appears once).
Sourcepub fn connected_components(&self) -> Vec<Vec<usize>>
pub fn connected_components(&self) -> Vec<Vec<usize>>
Compute connected components of the graph.
Sourcepub fn component_index(&self) -> Vec<usize>
pub fn component_index(&self) -> Vec<usize>
Return the component index for each node.
Sourcepub fn components(&self) -> Vec<Vec<usize>>
pub fn components(&self) -> Vec<Vec<usize>>
Return connected components (alias of Self::connected_components).
Sourcepub fn separate_components(&self) -> (Vec<usize>, Vec<usize>)
pub fn separate_components(&self) -> (Vec<usize>, Vec<usize>)
Separate connected components using neighbor groups derived from adjacency.
Sourcepub fn maximal_cliques_collect(&self) -> Vec<Vec<usize>>
pub fn maximal_cliques_collect(&self) -> Vec<Vec<usize>>
Enumerate all maximal cliques and collect them into a vector.
Sourcepub fn maximal_cliques<CO>(&self, consumer: CO)
pub fn maximal_cliques<CO>(&self, consumer: CO)
Enumerate all maximal cliques and send them to consumer.
Sourcepub fn kruskal(&self) -> Vec<(usize, usize, C)>
pub fn kruskal(&self) -> Vec<(usize, usize, C)>
Compute a minimum spanning tree using Kruskal’s algorithm (collected).
Sourcepub fn kruskal_indices(&self) -> impl Iterator<Item = (usize, usize, C)>
pub fn kruskal_indices(&self) -> impl Iterator<Item = (usize, usize, C)>
Compute a minimum spanning tree using Kruskal’s algorithm (iterator).
Trait Implementations§
Source§impl<C: Clone> Clone for IndexedUndirectedGraph<C>
impl<C: Clone> Clone for IndexedUndirectedGraph<C>
Source§fn clone(&self) -> IndexedUndirectedGraph<C>
fn clone(&self) -> IndexedUndirectedGraph<C>
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<C> Freeze for IndexedUndirectedGraph<C>
impl<C> RefUnwindSafe for IndexedUndirectedGraph<C>where
C: RefUnwindSafe,
impl<C> Send for IndexedUndirectedGraph<C>where
C: Send,
impl<C> Sync for IndexedUndirectedGraph<C>where
C: Sync,
impl<C> Unpin for IndexedUndirectedGraph<C>where
C: Unpin,
impl<C> UnsafeUnpin for IndexedUndirectedGraph<C>
impl<C> UnwindSafe for IndexedUndirectedGraph<C>where
C: UnwindSafe,
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