pub struct CommunityDetection;Expand description
Community detection via modularity maximization.
Modularity Q = (1/2m) Σ_{ij} [A_{ij} - k_i k_j / 2m] δ(c_i, c_j)
Implementations§
Source§impl CommunityDetection
impl CommunityDetection
Sourcepub fn modularity(graph: &NetworkGraph, communities: &[usize]) -> f64
pub fn modularity(graph: &NetworkGraph, communities: &[usize]) -> f64
Computes modularity Q for a partition given by communities (node → community id).
Sourcepub fn greedy_modularity(graph: &NetworkGraph) -> Vec<usize>
pub fn greedy_modularity(graph: &NetworkGraph) -> Vec<usize>
Greedy modularity maximization (Clauset-Newman-Moore simplified).
Starts with each node in its own community and greedily merges. Returns the best community assignment found.
Sourcepub fn n_communities(communities: &[usize]) -> usize
pub fn n_communities(communities: &[usize]) -> usize
Returns number of communities in a partition.
Auto Trait Implementations§
impl Freeze for CommunityDetection
impl RefUnwindSafe for CommunityDetection
impl Send for CommunityDetection
impl Sync for CommunityDetection
impl Unpin for CommunityDetection
impl UnsafeUnpin for CommunityDetection
impl UnwindSafe for CommunityDetection
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<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.