pub struct Graph { /* private fields */ }Expand description
A weighted undirected graph over nodes 0..n. Parallel edges are summed;
self-loops are kept (they affect modularity but not community moves).
Implementations§
Source§impl Graph
impl Graph
Sourcepub fn from_edges(n: usize, edges: &[(usize, usize, f64)]) -> Graph
pub fn from_edges(n: usize, edges: &[(usize, usize, f64)]) -> Graph
Build from undirected weighted edges. (u, v, w) and (v, u, w) are
equivalent; parallel edges accumulate.
pub fn node_count(&self) -> usize
pub fn total_weight(&self) -> f64
Sourcepub fn modularity(&self, comm: &[usize]) -> f64
pub fn modularity(&self, comm: &[usize]) -> f64
Newman modularity of a partition (community id per node).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Graph
impl RefUnwindSafe for Graph
impl Send for Graph
impl Sync for Graph
impl Unpin for Graph
impl UnsafeUnpin for Graph
impl UnwindSafe for Graph
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