pub trait NetworkGrouping:
Debug
+ Send
+ Sync {
Show 13 methods
// Required methods
fn create_isolated(node_count: usize) -> Self;
fn create_unified(node_count: usize) -> Self;
fn from_assignments(assignments: &[usize]) -> Self;
fn get_group_members(&self) -> Vec<Vec<usize>>;
fn get_group(&self, node: usize) -> usize;
fn get_groups_range(&self, range: Range<usize>) -> &[usize];
fn set_group(&mut self, node: usize, group: usize);
fn set_groups_bulk(&mut self, nodes: &[usize], group: usize);
fn node_count(&self) -> usize;
fn group_count(&self) -> usize;
fn normalize_groups(&mut self);
// Provided methods
fn merge<G: NetworkGrouping>(&mut self, arrangement: &G) { ... }
fn clear(&mut self) { ... }
}
Expand description
Trait for representing node-to-group assignments in networks.
This trait provides a common interface for different grouping implementations used in clustering algorithms. It supports operations like group assignment, merging, and normalization essential for community detection.
Required Methods§
Sourcefn create_isolated(node_count: usize) -> Self
fn create_isolated(node_count: usize) -> Self
Creates a grouping where each node is in its own isolated group.
Sourcefn create_unified(node_count: usize) -> Self
fn create_unified(node_count: usize) -> Self
Creates a grouping where all nodes are in a single unified group.
Sourcefn from_assignments(assignments: &[usize]) -> Self
fn from_assignments(assignments: &[usize]) -> Self
Creates a grouping from an array of group assignments.
Sourcefn get_group_members(&self) -> Vec<Vec<usize>>
fn get_group_members(&self) -> Vec<Vec<usize>>
Returns a vector of vectors, where each inner vector contains the nodes in that group.
Sourcefn get_groups_range(&self, range: Range<usize>) -> &[usize]
fn get_groups_range(&self, range: Range<usize>) -> &[usize]
Gets the group IDs for a range of nodes.
Sourcefn set_groups_bulk(&mut self, nodes: &[usize], group: usize)
fn set_groups_bulk(&mut self, nodes: &[usize], group: usize)
Sets groups for multiple nodes at once.
Sourcefn node_count(&self) -> usize
fn node_count(&self) -> usize
Gets the total number of nodes.
Sourcefn group_count(&self) -> usize
fn group_count(&self) -> usize
Gets the total number of groups.
Sourcefn normalize_groups(&mut self)
fn normalize_groups(&mut self)
Renumbers groups to eliminate gaps in group IDs.
Provided Methods§
Sourcefn merge<G: NetworkGrouping>(&mut self, arrangement: &G)
fn merge<G: NetworkGrouping>(&mut self, arrangement: &G)
Merges groups based on a higher-level grouping scheme.
This is used in multilevel clustering where groups themselves are further grouped into larger communities.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.