[][src]Struct net_ensembles::er_m::ErEnsembleM

pub struct ErEnsembleM<T: Node, R: Rng> { /* fields omitted */ }

Implements Erdős-Rényi graph ensemble

Constant number of edges

Methods

impl<T: Node, R: Rng> ErEnsembleM<T, R>[src]

pub fn new(n: u32, m: usize, rng: R) -> Self[src]

Initialize

create new ErEnsembleM graph with:

  • n vertices
  • m edges
  • rng is consumed and used as random number generator in the following
  • internally uses Graph<T>::new(n)
  • generates random edges according to ER model

pub fn get_m(&self) -> usize[src]

Return total number of edges

pub fn sort_adj(&mut self)[src]

Sort adjecency lists

If you depend on the order of the adjecency lists, you can sort them

Performance

  • internally uses pattern-defeating quicksort as long as that is the standard
  • sorts an adjecency list with length d in worst-case: O(d log(d))
  • is called for each adjecency list, i.e., self.vertex_count() times

pub fn graph(&self) -> &Graph<T>[src]

returns reference to the underlying topology aka, the Graph<T>

Use this to call functions regarding the topology

pub fn at(&self, index: usize) -> &T[src]

access additional information at vertex

pub fn at_mut(&mut self, index: usize) -> &mut T[src]

mutable access of additional information at index

Trait Implementations

impl<T: Clone + Node, R: Clone + Rng> Clone for ErEnsembleM<T, R>[src]

impl<T: Debug + Node, R: Debug + Rng> Debug for ErEnsembleM<T, R>[src]

impl<T, R> Ensemble<ErStepM, ErStepM> for ErEnsembleM<T, R> where
    T: Node,
    R: Rng
[src]

fn undo_step(&mut self, step: ErStepM) -> ErStepM[src]

  • undo a monte carlo step, return result-state
  • if you want to undo more than one step see undo_steps

fn undo_step_quiet(&mut self, step: ErStepM)[src]

  • undo a monte carlo step, panic on invalid result state
  • for undoing multiple steps see undo_steps_quiet

fn randomize(&mut self)[src]

Randomizes self according to model

fn mc_step(&mut self) -> ErStepM[src]

Monte Carlo step

  • use this to perform a Monte Carlo step
  • for doing multiple mc steps at once, use mc_steps

impl<T, R> EnsembleRng<ErStepM, ErStepM, R> for ErEnsembleM<T, R> where
    T: Node,
    R: Rng
[src]

fn rng(&mut self) -> &mut R[src]

Access RNG

If, for some reason, you want access to the internal random number generator: Here you go

fn swap_rng(&mut self, rng: R) -> R[src]

Swap random number generator

  • returns old internal rng

Auto Trait Implementations

impl<T, R> RefUnwindSafe for ErEnsembleM<T, R> where
    R: RefUnwindSafe,
    T: RefUnwindSafe

impl<T, R> Send for ErEnsembleM<T, R> where
    R: Send,
    T: Send

impl<T, R> Sync for ErEnsembleM<T, R> where
    R: Sync,
    T: Sync

impl<T, R> Unpin for ErEnsembleM<T, R> where
    R: Unpin,
    T: Unpin

impl<T, R> UnwindSafe for ErEnsembleM<T, R> where
    R: UnwindSafe,
    T: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,