pub struct ComponentResult {
pub node_components: HashMap<NodeId, usize>,
pub components: Vec<HashSet<NodeId>>,
pub num_components: usize,
}Expand description
Result of connected components analysis
Fields§
§node_components: HashMap<NodeId, usize>Component ID for each node
components: Vec<HashSet<NodeId>>List of nodes in each component
num_components: usizeNumber of components
Implementations§
Source§impl ComponentResult
impl ComponentResult
Sourcepub fn component_of(&self, node: NodeId) -> Option<usize>
pub fn component_of(&self, node: NodeId) -> Option<usize>
Returns the component ID for a node
Sourcepub fn nodes_in_component(
&self,
component_id: usize,
) -> Option<&HashSet<NodeId>>
pub fn nodes_in_component( &self, component_id: usize, ) -> Option<&HashSet<NodeId>>
Returns all nodes in a component
Sourcepub fn component_sizes(&self) -> Vec<usize>
pub fn component_sizes(&self) -> Vec<usize>
Returns the size of each component
Sourcepub fn largest_component(&self) -> Option<&HashSet<NodeId>>
pub fn largest_component(&self) -> Option<&HashSet<NodeId>>
Returns the largest component
Sourcepub fn are_connected(&self, node1: NodeId, node2: NodeId) -> bool
pub fn are_connected(&self, node1: NodeId, node2: NodeId) -> bool
Checks if two nodes are in the same component
Trait Implementations§
Source§impl Clone for ComponentResult
impl Clone for ComponentResult
Source§fn clone(&self) -> ComponentResult
fn clone(&self) -> ComponentResult
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 ComponentResult
impl RefUnwindSafe for ComponentResult
impl Send for ComponentResult
impl Sync for ComponentResult
impl Unpin for ComponentResult
impl UnwindSafe for ComponentResult
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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