pub struct LouvainLevels { /* private fields */ }Expand description
networkx’s louvain_partitions(G, ...) one generator resume at a time
(br-r37-c1-81vo1): LouvainLevels::advance runs exactly the code
networkx runs between two yields - a shuffle draw per _one_level - so a
caller stepping it lazily, drawing from the same generator in between,
sees networkx’s stream. The partition is over node positions, in the
order of node_names.
Implementations§
Source§impl LouvainLevels
impl LouvainLevels
Sourcepub fn new<'a>(
graph: impl Into<LouvainInput<'a>>,
resolution: f64,
weight_attr: &str,
threshold: f64,
sum: PythonSum,
) -> Option<Self>
pub fn new<'a>( graph: impl Into<LouvainInput<'a>>, resolution: f64, weight_attr: &str, threshold: f64, sum: PythonSum, ) -> Option<Self>
The generator’s state before its first resume, read from graph as
networkx reads G there. None - before any draw - where networkx
would raise (a weight it cannot add, a zero or overflowing m**2) or
where f64 could not follow its int arithmetic exactly (int weights
whose magnitudes total 225 or more, where a degree product can pass
253); the caller runs networkx then.
Sourcepub fn advance(&mut self, rng: Option<&mut MT19937>) -> bool
pub fn advance(&mut self, rng: Option<&mut MT19937>) -> bool
One generator resume: true with the next partition in
Self::partition, false once networkx’s generator would raise
StopIteration.
Sourcepub fn partition(&self) -> &[Vec<usize>]
pub fn partition(&self) -> &[Vec<usize>]
The partition the last Self::advance yielded, as node positions
(each community in ascending order).
Sourcepub fn moves(&self) -> &[LouvainMove] ⓘ
pub fn moves(&self) -> &[LouvainMove] ⓘ
The moves of the level the last Self::advance yielded, in the
order networkx makes them (none for the singletons of an edgeless
graph). networkx’s yielded sets are its partition’s after every move of
every level so far, so their iteration order is this history’s: a
caller replaying it on real sets (br-r37-c1-ygt3z) gets networkx’s.
Sourcepub fn node_names(&self) -> &[String]
pub fn node_names(&self) -> &[String]
The graph’s node names, in position order.
Trait Implementations§
Source§impl Clone for LouvainLevels
impl Clone for LouvainLevels
Auto Trait Implementations§
impl Freeze for LouvainLevels
impl RefUnwindSafe for LouvainLevels
impl Send for LouvainLevels
impl Sync for LouvainLevels
impl Unpin for LouvainLevels
impl UnsafeUnpin for LouvainLevels
impl UnwindSafe for LouvainLevels
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more