[][src]Enum net_ensembles::sw::SwChangeState

pub enum SwChangeState {
    InvalidAdjecency,
    BlockedByExistingEdge,
    Nothing,
    Rewire(u32u32u32),
    Reset(u32u32u32),
    GError(GraphErrors),
}

Returned by markov steps

  • information about the performed step and possible errors

Variants

InvalidAdjecency

ERROR adjecency list invalid?

BlockedByExistingEdge

Can not add edge twice

Nothing

Nothing happend

Rewire(u32u32u32)

old edge: (Rewire.0, Rewire.1), new edge (Rewire.0, Rewire.2)

Reset(u32u32u32)

old edge: (Reset.0, Reset.1), new edge (Reset.0, Reset.2)

GError(GraphErrors)

A GraphError occurred

Implementations

impl SwChangeState[src]

pub fn is_nothing(&self) -> bool[src]

checks if self is Nothing variant

pub fn is_nothing_or_blocked(&self) -> bool[src]

checks if self is Nothing or BlockedByExistingEdge

pub fn not_nothing_or_blocked(&self) -> bool[src]

result is equal to !self.is_nothing_or_blocked()

pub fn is_valid(&self) -> bool[src]

valid states:

  • SwChangeState::Rewire(..)
  • SwChangeState::Reset(..)
  • SwChangeState::Nothing
  • SwChangeState::BlockedByExistingEdge

invalid states:

  • SwChangeState::InvalidAdjecency
  • SwChangeState::GError(..)

Trait Implementations

impl Debug for SwChangeState[src]

impl<T, R> MarkovChain<SwChangeState, SwChangeState> for SwEnsemble<T, R> where
    T: Node + SerdeStateConform,
    R: Rng
[src]

fn m_step(&mut self) -> SwChangeState[src]

Markov step

  • use this to perform a markov step
  • keep in mind, that it is not unlikely for a step to do Nothing as it works by drawing an edge and then reseting it with r_prob, else the edge is rewired
  • result SwChangeState can be used to undo the step with self.undo_step(result)
  • result should never be InvalidAdjecency or GError if used on a valid graph

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

Undo a markov step

  • rewires edge to old state
  • Note: cannot undo InvalidAdjecency or GError, will just return InvalidAdjecency or GError respectively
  • returns result of rewire

Important:

Restored graph is the same as before the random step except the order of nodes in the adjacency list might be shuffled!

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

Undo a Monte Carlo step

  • rewires edge to old state
  • panics if you try to undo InvalidAdjecency or GError
  • panics if rewire result (SwChangeState) is invalid (i.e. !result.is_valid())

Important:

Restored graph is the same as before the random step except the order of nodes in the adjacency list might be shuffled!

Auto Trait Implementations

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, 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>,