Skip to main content

LouvainLevels

Struct LouvainLevels 

Source
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

Source

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.

Source

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.

Source

pub fn partition(&self) -> &[Vec<usize>]

The partition the last Self::advance yielded, as node positions (each community in ascending order).

Source

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.

Source

pub fn node_names(&self) -> &[String]

The graph’s node names, in position order.

Trait Implementations§

Source§

impl Clone for LouvainLevels

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for LouvainLevels

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

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

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

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

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.