pub struct ConnectedComponents {
pub membership: Vec<VertexId>,
pub sizes: Vec<usize>,
pub count: usize,
}Expand description
The connected components of a graph, see Graph::connected_components.
Fields§
§membership: Vec<VertexId>membership[v] is the id (in 0..count) of the component of vertex v.
sizes: Vec<usize>sizes[c] is the number of vertices in component c.
count: usizeThe number of components.
Implementations§
Source§impl ConnectedComponents
impl ConnectedComponents
Sourcepub fn members(&self, c: usize) -> Vec<VertexId> ⓘ
pub fn members(&self, c: usize) -> Vec<VertexId> ⓘ
The vertices of component c, in increasing id order (empty if c
is out of range).
Sourcepub fn groups(&self) -> Vec<Vec<VertexId>>
pub fn groups(&self) -> Vec<Vec<VertexId>>
All the components as vertex lists, indexed by component id.
Sourcepub fn largest(&self) -> Option<usize>
pub fn largest(&self) -> Option<usize>
Id of a largest (“giant”) component, the first one on ties; None
for the null graph.
Sourcepub fn same_component(&self, u: VertexId, v: VertexId) -> bool
pub fn same_component(&self, u: VertexId, v: VertexId) -> bool
Whether vertices u and v lie in the same component (false for
out-of-range ids).
Trait Implementations§
Source§impl Clone for ConnectedComponents
impl Clone for ConnectedComponents
Source§fn clone(&self) -> ConnectedComponents
fn clone(&self) -> ConnectedComponents
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ConnectedComponents
impl Debug for ConnectedComponents
impl Eq for ConnectedComponents
Source§impl PartialEq for ConnectedComponents
impl PartialEq for ConnectedComponents
Source§fn eq(&self, other: &ConnectedComponents) -> bool
fn eq(&self, other: &ConnectedComponents) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for ConnectedComponents
Auto Trait Implementations§
impl Freeze for ConnectedComponents
impl RefUnwindSafe for ConnectedComponents
impl Send for ConnectedComponents
impl Sync for ConnectedComponents
impl Unpin for ConnectedComponents
impl UnsafeUnpin for ConnectedComponents
impl UnwindSafe for ConnectedComponents
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