Struct net_ensembles::watts_strogatz::SmallWorldWS
source · [−]pub struct SmallWorldWS<T, R> { /* private fields */ }
Expand description
Implements small-world graph ensemble
- Note the implemented traits!
Implementations
sourceimpl<T, R> SmallWorldWS<T, R>
impl<T, R> SmallWorldWS<T, R>
sourcepub fn neighbor_distance(&self) -> NonZeroUsize
pub fn neighbor_distance(&self) -> NonZeroUsize
Returns neigbor distance of the initial ring
A neighbor distance of 1 means, in the original ring structure every node is connected to its two nearest neigbors, a neighbor distance of 2 means, it is connected to its 4 nearest neigbors and so on
The graph will contain neighbor_distance * system size (i.e. graph.vertex_count()) connections
sourcepub fn rewire_prob(&self) -> f64
pub fn rewire_prob(&self) -> f64
retunrs rewire probability the ensemble is set to
On average, a fraction of rewire_prob nodes should be rewired
sourceimpl<T, R> SmallWorldWS<T, R>where
T: Node,
R: Rng,
impl<T, R> SmallWorldWS<T, R>where
T: Node,
R: Rng,
sourcepub fn new(
n: u32,
neighbor_distance: NonZeroUsize,
rewire_probability: f64,
rng: R
) -> Result<Self, WSCreationError>
pub fn new(
n: u32,
neighbor_distance: NonZeroUsize,
rewire_probability: f64,
rng: R
) -> Result<Self, WSCreationError>
Initialize a WS - a small-world ensemble
n
is the system size, i.e., how many nodes there should be in the created graphsneighbor_distance
is needed for the initial ring structure. See also WS::neigbor_distancerewire_probability
- each edge will be rewired with a probability ofrewire_probability
- see also WS::rewire_probrng
- random number generator
Trait Implementations
sourceimpl<T, R> AsRef<GenericGraph<T, WSContainer<T>>> for SmallWorldWS<T, R>
impl<T, R> AsRef<GenericGraph<T, WSContainer<T>>> for SmallWorldWS<T, R>
sourceimpl<T: Clone, R: Clone> Clone for SmallWorldWS<T, R>
impl<T: Clone, R: Clone> Clone for SmallWorldWS<T, R>
sourcefn clone(&self) -> SmallWorldWS<T, R>
fn clone(&self) -> SmallWorldWS<T, R>
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<T, R> Contained<T> for SmallWorldWS<T, R>where
T: Node,
impl<T, R> Contained<T> for SmallWorldWS<T, R>where
T: Node,
sourcefn get_contained(&self, index: usize) -> Option<&T>
fn get_contained(&self, index: usize) -> Option<&T>
Returns a reference to the element stored in the specified node or
None
if out of Boundssourcefn get_contained_mut(&mut self, index: usize) -> Option<&mut T>
fn get_contained_mut(&mut self, index: usize) -> Option<&mut T>
Returns a mutable reference to the element stored in the specified node or
None
if out of Boundssourceunsafe fn get_contained_unchecked(&self, index: usize) -> &T
unsafe fn get_contained_unchecked(&self, index: usize) -> &T
For a save alternative see get_contained Read more
sourceunsafe fn get_contained_unchecked_mut(&mut self, index: usize) -> &mut T
unsafe fn get_contained_unchecked_mut(&mut self, index: usize) -> &mut T
Returns a mutable reference to the element stored in the specified node Read more
sourceimpl<T: Debug, R: Debug> Debug for SmallWorldWS<T, R>
impl<T: Debug, R: Debug> Debug for SmallWorldWS<T, R>
sourceimpl<'de, T, R> Deserialize<'de> for SmallWorldWS<T, R>where
T: Deserialize<'de>,
R: Deserialize<'de>,
impl<'de, T, R> Deserialize<'de> for SmallWorldWS<T, R>where
T: Deserialize<'de>,
R: Deserialize<'de>,
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> GraphIterators<T, GenericGraph<T, WSContainer<T>>, WSContainer<T>> for SmallWorldWS<T, R>where
T: Node + SerdeStateConform,
R: Rng,
impl<T, R> GraphIterators<T, GenericGraph<T, WSContainer<T>>, WSContainer<T>> for SmallWorldWS<T, R>where
T: Node + SerdeStateConform,
R: Rng,
sourcefn contained_iter(&self) -> ContainedIter<'_, T, WSContainer<T>>ⓘNotable traits for ContainedIter<'a, T, A>impl<'a, T, A> Iterator for ContainedIter<'a, T, A>where
T: 'a + Node,
A: AdjContainer<T>, type Item = &'a T;
fn contained_iter(&self) -> ContainedIter<'_, T, WSContainer<T>>ⓘNotable traits for ContainedIter<'a, T, A>impl<'a, T, A> Iterator for ContainedIter<'a, T, A>where
T: 'a + Node,
A: AdjContainer<T>, type Item = &'a T;
T: 'a + Node,
A: AdjContainer<T>, type Item = &'a T;
Node
(for example EmptyNode
or whatever you used)self.container_iter().map(|container| container.contained())
sourcefn contained_iter_neighbors(
&self,
index: usize
) -> NContainedIter<'_, T, WSContainer<T>, IterWrapper<'_>>ⓘNotable traits for NContainedIter<'a, T, A, I>impl<'a, T, A, I> Iterator for NContainedIter<'a, T, A, I>where
T: 'a,
A: AdjContainer<T>,
I: Iterator<Item = &'a usize> + 'a, type Item = &'a T;
fn contained_iter_neighbors(
&self,
index: usize
) -> NContainedIter<'_, T, WSContainer<T>, IterWrapper<'_>>ⓘNotable traits for NContainedIter<'a, T, A, I>impl<'a, T, A, I> Iterator for NContainedIter<'a, T, A, I>where
T: 'a,
A: AdjContainer<T>,
I: Iterator<Item = &'a usize> + 'a, type Item = &'a T;
T: 'a,
A: AdjContainer<T>,
I: Iterator<Item = &'a usize> + 'a, type Item = &'a T;
index
&T
sort_adj
will affect the ordersourcefn contained_iter_neighbors_with_index(
&self,
index: usize
) -> NIContainedIter<'_, T, WSContainer<T>>ⓘNotable traits for NIContainedIter<'a, T, A>impl<'a, T, A> Iterator for NIContainedIter<'a, T, A>where
T: 'a + Node,
A: AdjContainer<T>, type Item = (usize, &'a T);
fn contained_iter_neighbors_with_index(
&self,
index: usize
) -> NIContainedIter<'_, T, WSContainer<T>>ⓘNotable traits for NIContainedIter<'a, T, A>impl<'a, T, A> Iterator for NIContainedIter<'a, T, A>where
T: 'a + Node,
A: AdjContainer<T>, type Item = (usize, &'a T);
T: 'a + Node,
A: AdjContainer<T>, type Item = (usize, &'a T);
index
index_neighbor
,&T
)sort_adj
will affect the ordersourcefn container_iter(&self) -> Iter<'_, WSContainer<T>>
fn container_iter(&self) -> Iter<'_, WSContainer<T>>
AdjContainer<Node>
, i.e., A
sourcefn container_iter_neighbors(
&self,
index: usize
) -> NContainerIter<'_, T, WSContainer<T>, IterWrapper<'_>>ⓘNotable traits for NContainerIter<'a, T, A, I>impl<'a, T, A, I> Iterator for NContainerIter<'a, T, A, I>where
T: 'a,
A: AdjContainer<T>,
I: Iterator<Item = &'a usize> + 'a, type Item = &'a A;
fn container_iter_neighbors(
&self,
index: usize
) -> NContainerIter<'_, T, WSContainer<T>, IterWrapper<'_>>ⓘNotable traits for NContainerIter<'a, T, A, I>impl<'a, T, A, I> Iterator for NContainerIter<'a, T, A, I>where
T: 'a,
A: AdjContainer<T>,
I: Iterator<Item = &'a usize> + 'a, type Item = &'a A;
T: 'a,
A: AdjContainer<T>,
I: Iterator<Item = &'a usize> + 'a, type Item = &'a A;
index
&T
sort_adj
will affect the ordersourcefn dfs(&self, index: usize) -> Dfs<'_, T, WSContainer<T>>ⓘNotable traits for Dfs<'a, T, A>impl<'a, T, A> Iterator for Dfs<'a, T, A>where
T: 'a,
A: AdjContainer<T>, type Item = &'a T;
fn dfs(&self, index: usize) -> Dfs<'_, T, WSContainer<T>>ⓘNotable traits for Dfs<'a, T, A>impl<'a, T, A> Iterator for Dfs<'a, T, A>where
T: 'a,
A: AdjContainer<T>, type Item = &'a T;
T: 'a,
A: AdjContainer<T>, type Item = &'a T;
returns
Iterator
Read moresourcefn dfs_with_index(&self, index: usize) -> DfsWithIndex<'_, T, WSContainer<T>>ⓘNotable traits for DfsWithIndex<'a, T, A>impl<'a, T, A> Iterator for DfsWithIndex<'a, T, A>where
T: 'a,
A: AdjContainer<T>, type Item = (usize, &'a T);
fn dfs_with_index(&self, index: usize) -> DfsWithIndex<'_, T, WSContainer<T>>ⓘNotable traits for DfsWithIndex<'a, T, A>impl<'a, T, A> Iterator for DfsWithIndex<'a, T, A>where
T: 'a,
A: AdjContainer<T>, type Item = (usize, &'a T);
T: 'a,
A: AdjContainer<T>, type Item = (usize, &'a T);
returns
Iterator
Read moresourcefn bfs_index_depth(&self, index: usize) -> Bfs<'_, T, WSContainer<T>>ⓘNotable traits for Bfs<'a, T, A>impl<'a, T, A> Iterator for Bfs<'a, T, A>where
T: 'a,
A: AdjContainer<T>, type Item = (usize, &'a T, usize);
fn bfs_index_depth(&self, index: usize) -> Bfs<'_, T, WSContainer<T>>ⓘNotable traits for Bfs<'a, T, A>impl<'a, T, A> Iterator for Bfs<'a, T, A>where
T: 'a,
A: AdjContainer<T>, type Item = (usize, &'a T, usize);
T: 'a,
A: AdjContainer<T>, type Item = (usize, &'a T, usize);
returns
Iterator
Read moresourceimpl<T, R> GraphIteratorsMut<T, GenericGraph<T, WSContainer<T>>, WSContainer<T>> for SmallWorldWS<T, R>where
T: Node + SerdeStateConform,
R: Rng,
impl<T, R> GraphIteratorsMut<T, GenericGraph<T, WSContainer<T>>, WSContainer<T>> for SmallWorldWS<T, R>where
T: Node + SerdeStateConform,
R: Rng,
sourcefn contained_iter_neighbors_mut(
&mut self,
index: usize
) -> NContainedIterMut<'_, T, WSContainer<T>, IterWrapper<'_>>ⓘNotable traits for NContainedIterMut<'a, T, A, I>impl<'a, T, A, I> Iterator for NContainedIterMut<'a, T, A, I>where
T: 'a,
A: AdjContainer<T>,
I: Iterator<Item = &'a usize> + 'a, type Item = &'a mut T;
fn contained_iter_neighbors_mut(
&mut self,
index: usize
) -> NContainedIterMut<'_, T, WSContainer<T>, IterWrapper<'_>>ⓘNotable traits for NContainedIterMut<'a, T, A, I>impl<'a, T, A, I> Iterator for NContainedIterMut<'a, T, A, I>where
T: 'a,
A: AdjContainer<T>,
I: Iterator<Item = &'a usize> + 'a, type Item = &'a mut T;
T: 'a,
A: AdjContainer<T>,
I: Iterator<Item = &'a usize> + 'a, type Item = &'a mut T;
index
&mut T
sort_adj
will affect the ordersourcefn contained_iter_neighbors_mut_with_index(
&mut self,
index: usize
) -> INContainedIterMut<'_, T, WSContainer<T>>ⓘNotable traits for INContainedIterMut<'a, T, A>impl<'a, T, A> Iterator for INContainedIterMut<'a, T, A>where
T: 'a + Node,
A: AdjContainer<T>, type Item = (usize, &'a mut T);
fn contained_iter_neighbors_mut_with_index(
&mut self,
index: usize
) -> INContainedIterMut<'_, T, WSContainer<T>>ⓘNotable traits for INContainedIterMut<'a, T, A>impl<'a, T, A> Iterator for INContainedIterMut<'a, T, A>where
T: 'a + Node,
A: AdjContainer<T>, type Item = (usize, &'a mut T);
T: 'a + Node,
A: AdjContainer<T>, type Item = (usize, &'a mut T);
index
(index_neighbor: usize, neighbor: &mut T)
sort_adj
will affect the ordersourcefn contained_iter_mut(&mut self) -> ContainedIterMut<'_, T, WSContainer<T>>ⓘNotable traits for ContainedIterMut<'a, T, A>impl<'a, T, A> Iterator for ContainedIterMut<'a, T, A>where
T: 'a + Node,
A: AdjContainer<T>, type Item = &'a mut T;
fn contained_iter_mut(&mut self) -> ContainedIterMut<'_, T, WSContainer<T>>ⓘNotable traits for ContainedIterMut<'a, T, A>impl<'a, T, A> Iterator for ContainedIterMut<'a, T, A>where
T: 'a + Node,
A: AdjContainer<T>, type Item = &'a mut T;
T: 'a + Node,
A: AdjContainer<T>, type Item = &'a mut T;
Node
(for example EmptyNode
or whatever you used)sourceimpl<T, R> HasRng<R> for SmallWorldWS<T, R>where
R: Rng,
impl<T, R> HasRng<R> for SmallWorldWS<T, R>where
R: Rng,
sourceimpl<T, R> Serialize for SmallWorldWS<T, R>where
T: Serialize,
R: Serialize,
impl<T, R> Serialize for SmallWorldWS<T, R>where
T: Serialize,
R: Serialize,
sourceimpl<T, R> SimpleSample for SmallWorldWS<T, R>where
R: Rng,
impl<T, R> SimpleSample for SmallWorldWS<T, R>where
R: Rng,
sourceimpl<T, R> WithGraph<T, GenericGraph<T, WSContainer<T>>> for SmallWorldWS<T, R>
impl<T, R> WithGraph<T, GenericGraph<T, WSContainer<T>>> for SmallWorldWS<T, R>
Auto Trait Implementations
impl<T, R> RefUnwindSafe for SmallWorldWS<T, R>where
R: RefUnwindSafe,
T: RefUnwindSafe,
impl<T, R> Send for SmallWorldWS<T, R>where
R: Send,
T: Send,
impl<T, R> Sync for SmallWorldWS<T, R>where
R: Sync,
T: Sync,
impl<T, R> Unpin for SmallWorldWS<T, R>where
R: Unpin,
T: Unpin,
impl<T, R> UnwindSafe for SmallWorldWS<T, R>where
R: UnwindSafe,
T: UnwindSafe,
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