Expand description
Markov step of configuration model
Variants
Error
step did not succeed
Added((usize, usize), (usize, usize))
- Step did succeed and can be undone using this
- contains the newly added edges, which is enough information to know which edges were removed
Trait Implementations
sourceimpl Clone for ConfigurationModelStep
impl Clone for ConfigurationModelStep
sourcefn clone(&self) -> ConfigurationModelStep
fn clone(&self) -> ConfigurationModelStep
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresourceimpl Debug for ConfigurationModelStep
impl Debug for ConfigurationModelStep
sourceimpl<'de> Deserialize<'de> for ConfigurationModelStep
impl<'de> Deserialize<'de> for ConfigurationModelStep
sourcefn 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
sourceimpl<T, R> MarkovChain<ConfigurationModelStep, Result<(), UndoStepErrorCM>> for ConfigurationModel<T, R>where
T: Node + SerdeStateConform,
R: Rng,
impl<T, R> MarkovChain<ConfigurationModelStep, Result<(), UndoStepErrorCM>> for ConfigurationModel<T, R>where
T: Node + SerdeStateConform,
R: Rng,
sourcefn m_step(&mut self) -> ConfigurationModelStep
fn m_step(&mut self) -> ConfigurationModelStep
Markov step
- use this to perform a markov step, e.g., to create a markov chain
- result
ConfigurationModelStep
can be used to undo the step withself.undo_step(result)
How it works
- it draws two distinct vertices, weighted with the Vertex degree
- then for each vertex a random edge is drawn from the respective adjacency list. let these edges be edge1 = (n, j) and edge2 = (k, l). These edges are removed and the edges (n, k) and (j, l) are added.
- If the above would result in an invalid topology,
nothing is added or removed and
ConfigurationModelStep::Error
is returned
sourcefn undo_step(
&mut self,
step: &ConfigurationModelStep
) -> Result<(), UndoStepErrorCM>
fn undo_step(
&mut self,
step: &ConfigurationModelStep
) -> Result<(), UndoStepErrorCM>
Undo a markcov step
- adds removed edge and removes added edge, or does nothing
Important:
Restored graph is the same as before the random step except the order of nodes in the adjacency list might be shuffled!
Error
If an error is encountered, this will revert the graph to the state, before trying to undo the step. The returned Error gives a hint for why this did not succeed.
sourcefn undo_step_quiet(&mut self, step: &ConfigurationModelStep)
fn undo_step_quiet(&mut self, step: &ConfigurationModelStep)
Undo a markcov step
- adds removed edge and removes added edge, or does nothing
- as long as you know, that you undo the steps in the correct order, this is the prefered method as this more efficent
- panics if an Error is encountered
sourcefn m_steps_quiet(&mut self, count: usize)
fn m_steps_quiet(&mut self, count: usize)
Markov steps without return Read more
sourcefn m_step_acc<Acc, AccFn>(&mut self, acc: &mut Acc, acc_fn: AccFn) -> Swhere
AccFn: FnMut(&Self, &S, &mut Acc),
fn m_step_acc<Acc, AccFn>(&mut self, acc: &mut Acc, acc_fn: AccFn) -> Swhere
AccFn: FnMut(&Self, &S, &mut Acc),
Accumulating markov step Read more
sourcefn m_steps_acc<Acc, AccFn>(
&mut self,
count: usize,
steps: &mut Vec<S, Global>,
acc: &mut Acc,
acc_fn: AccFn
)where
AccFn: FnMut(&Self, &S, &mut Acc),
fn m_steps_acc<Acc, AccFn>(
&mut self,
count: usize,
steps: &mut Vec<S, Global>,
acc: &mut Acc,
acc_fn: AccFn
)where
AccFn: FnMut(&Self, &S, &mut Acc),
Accumulating markov steps Read more
sourcefn m_steps_acc_quiet<Acc, AccFn>(
&mut self,
count: usize,
acc: &mut Acc,
acc_fn: AccFn
)where
AccFn: FnMut(&Self, &S, &mut Acc),
fn m_steps_acc_quiet<Acc, AccFn>(
&mut self,
count: usize,
acc: &mut Acc,
acc_fn: AccFn
)where
AccFn: FnMut(&Self, &S, &mut Acc),
Accumulating markov steps Read more
sourcefn undo_steps_quiet(&mut self, steps: &[S])
fn undo_steps_quiet(&mut self, steps: &[S])
Undo markov steps Read more
sourcefn steps_accepted(&mut self, _steps: &[S])
fn steps_accepted(&mut self, _steps: &[S])
Function called whenever the steps are accepted. Read more
sourcefn steps_rejected(&mut self, _steps: &[S])
fn steps_rejected(&mut self, _steps: &[S])
Function called whenever the steps are rejected. Read more
sourceimpl Serialize for ConfigurationModelStep
impl Serialize for ConfigurationModelStep
impl Copy for ConfigurationModelStep
Auto Trait Implementations
impl RefUnwindSafe for ConfigurationModelStep
impl Send for ConfigurationModelStep
impl Sync for ConfigurationModelStep
impl Unpin for ConfigurationModelStep
impl UnwindSafe for ConfigurationModelStep
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<S, T> CastFloat<T> for Swhere
T: ConvFloat<S>,
impl<S, T> CastFloat<T> for Swhere
T: ConvFloat<S>,
fn cast_trunc(self) -> T
fn cast_trunc(self) -> T
Cast to integer, truncating Read more
fn cast_nearest(self) -> T
fn cast_nearest(self) -> T
Cast to the nearest integer Read more
fn cast_floor(self) -> T
fn cast_floor(self) -> T
Cast the floor to an integer Read more
fn try_cast_trunc(self) -> Result<T, Error>
fn try_cast_trunc(self) -> Result<T, Error>
Try converting to integer with truncation Read more
fn try_cast_nearest(self) -> Result<T, Error>
fn try_cast_nearest(self) -> Result<T, Error>
Try converting to the nearest integer Read more
fn try_cast_floor(self) -> Result<T, Error>
fn try_cast_floor(self) -> Result<T, Error>
Try converting the floor to an integer Read more
fn try_cast_ceil(self) -> Result<T, Error>
fn try_cast_ceil(self) -> Result<T, Error>
Try convert the ceiling to an integer Read more