pub struct CommunityResult {
pub assignments: HashMap<EntityId, u64>,
pub iterations: usize,
pub converged: bool,
pub num_communities: usize,
}Expand description
Result of community detection.
Fields§
§assignments: HashMap<EntityId, u64>Community assignments: node -> community ID
iterations: usizeNumber of iterations performed.
converged: boolWhether the algorithm converged.
num_communities: usizeNumber of distinct communities found.
Implementations§
Source§impl CommunityResult
impl CommunityResult
Sourcepub fn community(&self, node: EntityId) -> Option<u64>
pub fn community(&self, node: EntityId) -> Option<u64>
Get the community ID for a specific node.
Sourcepub fn members(&self, community_id: u64) -> Vec<EntityId>
pub fn members(&self, community_id: u64) -> Vec<EntityId>
Get all nodes in a specific community.
Sourcepub fn community_sizes(&self) -> HashMap<u64, usize>
pub fn community_sizes(&self) -> HashMap<u64, usize>
Get community sizes.
Sourcepub fn communities_by_size(&self) -> Vec<(u64, usize)>
pub fn communities_by_size(&self) -> Vec<(u64, usize)>
Get communities sorted by size (descending).
Sourcepub fn largest_community(&self) -> Option<(u64, usize)>
pub fn largest_community(&self) -> Option<(u64, usize)>
Get the largest community.
Sourcepub fn smallest_community(&self) -> Option<(u64, usize)>
pub fn smallest_community(&self) -> Option<(u64, usize)>
Get the smallest community.
Sourcepub fn same_community(&self, node1: EntityId, node2: EntityId) -> bool
pub fn same_community(&self, node1: EntityId, node2: EntityId) -> bool
Check if two nodes are in the same community.
Trait Implementations§
Source§impl Clone for CommunityResult
impl Clone for CommunityResult
Source§fn clone(&self) -> CommunityResult
fn clone(&self) -> CommunityResult
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 moreAuto Trait Implementations§
impl Freeze for CommunityResult
impl RefUnwindSafe for CommunityResult
impl Send for CommunityResult
impl Sync for CommunityResult
impl Unpin for CommunityResult
impl UnsafeUnpin for CommunityResult
impl UnwindSafe for CommunityResult
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