Enum net_ensembles::sw::SwChangeState [−][src]
pub enum SwChangeState {
InvalidAdjecency,
BlockedByExistingEdge,
Nothing,
Rewire(usize, usize, usize),
Reset(usize, usize, usize),
GError(GraphErrors),
}
Expand description
Returned by markov steps
- information about the performed step and possible errors
Variants
ERROR adjecency list invalid?
Can not add edge twice
Nothing happend
old edge: (Rewire.0, Rewire.1), new edge (Rewire.0, Rewire.2)
old edge: (Reset.0, Reset.1), new edge (Reset.0, Reset.2)
GError(GraphErrors)
A GraphError occurred
Tuple Fields of GError
0: GraphErrors
Implementations
checks if self is Nothing
variant
checks if self is Nothing
or BlockedByExistingEdge
result is equal to !self.is_nothing_or_blocked()
valid states:
SwChangeState::Rewire(..)
SwChangeState::Reset(..)
SwChangeState::Nothing
SwChangeState::BlockedByExistingEdge
invalid states:
SwChangeState::InvalidAdjecency
SwChangeState::GError(..)
Trait Implementations
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl<T, R> MarkovChain<SwChangeState, SwChangeState> for SwEnsemble<T, R> where
T: Node + SerdeStateConform,
R: Rng,
impl<T, R> MarkovChain<SwChangeState, SwChangeState> for SwEnsemble<T, R> where
T: Node + SerdeStateConform,
R: Rng,
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 withr_prob
, else the edge is rewired - result
SwChangeState
can be used to undo the step withself.undo_step(result)
- result should never be
InvalidAdjecency
orGError
if used on a valid graph
Undo a markov step
- rewires edge to old state
- Note: cannot undo
InvalidAdjecency
orGError
, will just returnInvalidAdjecency
orGError
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!
Undo a Monte Carlo step
- rewires edge to old state
- panics if you try to undo
InvalidAdjecency
orGError
- 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!
Markov steps without return Read more
Accumulating markov step Read more
Accumulating markov steps Read more
Accumulating markov steps Read more
Undo markov steps Read more
Auto Trait Implementations
impl RefUnwindSafe for SwChangeState
impl Send for SwChangeState
impl Sync for SwChangeState
impl Unpin for SwChangeState
impl UnwindSafe for SwChangeState
Blanket Implementations
Mutably borrows from an owned value. Read more
pub fn cast_trunc(self) -> T
pub fn cast_trunc(self) -> T
Cast to integer, truncating Read more
pub fn cast_nearest(self) -> T
pub fn cast_nearest(self) -> T
Cast to the nearest integer Read more
pub fn cast_floor(self) -> T
pub fn cast_floor(self) -> T
Cast the floor to an integer Read more
pub fn try_cast_trunc(self) -> Result<T, Error>
pub fn try_cast_trunc(self) -> Result<T, Error>
Try converting to integer with truncation Read more
pub fn try_cast_nearest(self) -> Result<T, Error>
pub fn try_cast_nearest(self) -> Result<T, Error>
Try converting to the nearest integer Read more
pub fn try_cast_floor(self) -> Result<T, Error>
pub fn try_cast_floor(self) -> Result<T, Error>
Try converting the floor to an integer Read more
pub fn try_cast_ceil(self) -> Result<T, Error>
pub fn try_cast_ceil(self) -> Result<T, Error>
Try convert the ceiling to an integer Read more