pub struct StochasticBlockModelGenerator { /* private fields */ }Expand description
Generates random graphs with community structure according to the Stochastic Block Model.
Vertices are partitioned into blocks (communities). Within the same block,
edges appear with probability intra_prob; between different blocks, with
probability inter_prob.
Implementations§
Source§impl StochasticBlockModelGenerator
impl StochasticBlockModelGenerator
Sourcepub fn new(
block_sizes: Vec<usize>,
intra_prob: f64,
inter_prob: f64,
seed: u64,
) -> Self
pub fn new( block_sizes: Vec<usize>, intra_prob: f64, inter_prob: f64, seed: u64, ) -> Self
Creates a new SBM generator.
§Arguments
block_sizes— sizes of each communityintra_prob— edge probability within communitiesinter_prob— edge probability between communitiesseed— PRNG seed
Sourcepub fn generate(&self) -> RandResult<AdjacencyList>
pub fn generate(&self) -> RandResult<AdjacencyList>
Generates an undirected SBM graph.
§Errors
Returns RandError::InvalidSize if probabilities are outside [0, 1] or
block_sizes is empty.
Auto Trait Implementations§
impl Freeze for StochasticBlockModelGenerator
impl RefUnwindSafe for StochasticBlockModelGenerator
impl Send for StochasticBlockModelGenerator
impl Sync for StochasticBlockModelGenerator
impl Unpin for StochasticBlockModelGenerator
impl UnsafeUnpin for StochasticBlockModelGenerator
impl UnwindSafe for StochasticBlockModelGenerator
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