NetworkGrouping

Trait NetworkGrouping 

Source
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§

Source

fn create_isolated(node_count: usize) -> Self

Creates a grouping where each node is in its own isolated group.

Source

fn create_unified(node_count: usize) -> Self

Creates a grouping where all nodes are in a single unified group.

Source

fn from_assignments(assignments: &[usize]) -> Self

Creates a grouping from an array of group assignments.

Source

fn get_group_members(&self) -> Vec<Vec<usize>>

Returns a vector of vectors, where each inner vector contains the nodes in that group.

Source

fn get_group(&self, node: usize) -> usize

Gets the group ID for a given node.

Source

fn get_groups_range(&self, range: Range<usize>) -> &[usize]

Gets the group IDs for a range of nodes.

Source

fn set_group(&mut self, node: usize, group: usize)

Sets the group for a given node.

Source

fn set_groups_bulk(&mut self, nodes: &[usize], group: usize)

Sets groups for multiple nodes at once.

Source

fn node_count(&self) -> usize

Gets the total number of nodes.

Source

fn group_count(&self) -> usize

Gets the total number of groups.

Source

fn normalize_groups(&mut self)

Renumbers groups to eliminate gaps in group IDs.

Provided Methods§

Source

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.

Source

fn clear(&mut self)

Resets all nodes to group 0, effectively creating a single unified group.

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.

Implementors§