pub struct RandomRegularGenerator { /* private fields */ }Expand description
Generates random k-regular graphs where every vertex has the same degree.
Uses the pairing (configuration) model: create k stubs for each vertex,
then randomly match stubs. Self-loops and multi-edges are discarded and
re-attempted.
Implementations§
Source§impl RandomRegularGenerator
impl RandomRegularGenerator
Sourcepub fn new(num_vertices: usize, degree: usize, seed: u64) -> Self
pub fn new(num_vertices: usize, degree: usize, seed: u64) -> Self
Creates a new random regular graph generator.
§Arguments
num_vertices— number of verticesdegree— the common degree k (n*k must be even)seed— PRNG seed
Sourcepub fn generate(&self) -> RandResult<AdjacencyList>
pub fn generate(&self) -> RandResult<AdjacencyList>
Generates a random k-regular undirected graph.
§Errors
Returns RandError::InvalidSize if num_vertices * degree is odd,
or degree >= num_vertices.
Auto Trait Implementations§
impl Freeze for RandomRegularGenerator
impl RefUnwindSafe for RandomRegularGenerator
impl Send for RandomRegularGenerator
impl Sync for RandomRegularGenerator
impl Unpin for RandomRegularGenerator
impl UnsafeUnpin for RandomRegularGenerator
impl UnwindSafe for RandomRegularGenerator
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