Struct net_ensembles::BAensemble
source · [−]Expand description
Implements a Barabási-Albert Graph ensemble
Implementations
sourceimpl<T, R> BAensemble<T, R>where
T: Node + SerdeStateConform,
R: Rng,
impl<T, R> BAensemble<T, R>where
T: Node + SerdeStateConform,
R: Rng,
sourcepub fn new(n: usize, rng: R, m: usize, source_n: usize) -> Self
pub fn new(n: usize, rng: R, m: usize, source_n: usize) -> Self
Initialize
- create simplest form of Barabási-Albert graph
m
= 1n
: Number of nodes,n > 1
has to be true panics otherwiserng
: Rng to use
sourcepub fn new_from_graph<B>(n: usize, rng: R, m: usize, source_graph: B) -> Selfwhere
B: Borrow<Graph<T>>,
pub fn new_from_graph<B>(n: usize, rng: R, m: usize, source_graph: B) -> Selfwhere
B: Borrow<Graph<T>>,
Generate a new BA graph ensemble with a specified source graph
- panics if
source_graph
contains any vertices with degree 0 m
: how many edges should each newly added vertex have originallyrng
: Random number generatorn
: Number of nodes,n > source_graph.vertex_count()
has to be true panics otherwise
sourcepub fn new_from_generic_graph<A2, B>(
n: usize,
rng: R,
m: usize,
generic_source_graph: B
) -> Selfwhere
A2: AdjContainer<T>,
B: Borrow<GenericGraph<T, A2>>,
pub fn new_from_generic_graph<A2, B>(
n: usize,
rng: R,
m: usize,
generic_source_graph: B
) -> Selfwhere
A2: AdjContainer<T>,
B: Borrow<GenericGraph<T, A2>>,
Generate a new BA graph ensemble with a specified generic source graph
- panics if
generic_source_graph
contains any vertices with degree 0 m
: how many edges should each newly added vertex have originallyrng
: Random number generatorn
: Number of nodes,n > source_graph.vertex_count()
has to be true panics otherwise
sourcepub fn source_graph(&self) -> &Graph<T>
pub fn source_graph(&self) -> &Graph<T>
get reference to original graph, which is at the core of the BA graph
Trait Implementations
sourceimpl<T, R> AsRef<GenericGraph<T, NodeContainer<T>>> for BAensemble<T, R>where
T: Node,
R: Rng,
impl<T, R> AsRef<GenericGraph<T, NodeContainer<T>>> for BAensemble<T, R>where
T: Node,
R: Rng,
sourceimpl<T, R> Borrow<GenericGraph<T, NodeContainer<T>>> for BAensemble<T, R>where
T: Node,
R: Rng,
impl<T, R> Borrow<GenericGraph<T, NodeContainer<T>>> for BAensemble<T, R>where
T: Node,
R: Rng,
sourceimpl<T: Clone, R: Clone> Clone for BAensemble<T, R>where
T: Node,
R: Rng,
impl<T: Clone, R: Clone> Clone for BAensemble<T, R>where
T: Node,
R: Rng,
sourcefn clone(&self) -> BAensemble<T, R>
fn clone(&self) -> BAensemble<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<'de, T, R> Deserialize<'de> for BAensemble<T, R>where
T: Node,
R: Rng,
T: Deserialize<'de>,
R: Deserialize<'de>,
impl<'de, T, R> Deserialize<'de> for BAensemble<T, R>where
T: Node,
R: Rng,
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> GraphIteratorsMut<T, GenericGraph<T, NodeContainer<T>>, NodeContainer<T>> for BAensemble<T, R>where
T: Node + SerdeStateConform,
R: Rng,
impl<T, R> GraphIteratorsMut<T, GenericGraph<T, NodeContainer<T>>, NodeContainer<T>> for BAensemble<T, R>where
T: Node + SerdeStateConform,
R: Rng,
sourcefn contained_iter_neighbors_mut(
&mut self,
index: usize
) -> NContainedIterMut<'_, T, NodeContainer<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, NodeContainer<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, NodeContainer<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, NodeContainer<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, NodeContainer<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, NodeContainer<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> SimpleSample for BAensemble<T, R>where
T: Node + SerdeStateConform,
R: Rng,
impl<T, R> SimpleSample for BAensemble<T, R>where
T: Node + SerdeStateConform,
R: Rng,
sourcefn randomize(&mut self)
fn randomize(&mut self)
Randomizes the Barabási-Albert (BA) graph
- this essentially deletes the BA graph and creates a new one using the initial graph
sourceimpl<T, R> WithGraph<T, GenericGraph<T, NodeContainer<T>>> for BAensemble<T, R>where
T: Node + SerdeStateConform,
R: Rng,
impl<T, R> WithGraph<T, GenericGraph<T, NodeContainer<T>>> for BAensemble<T, R>where
T: Node + SerdeStateConform,
R: Rng,
Auto Trait Implementations
impl<T, R> RefUnwindSafe for BAensemble<T, R>where
R: RefUnwindSafe,
T: RefUnwindSafe,
impl<T, R> Send for BAensemble<T, R>where
R: Send,
T: Send,
impl<T, R> Sync for BAensemble<T, R>where
R: Sync,
T: Sync,
impl<T, R> Unpin for BAensemble<T, R>where
R: Unpin,
T: Unpin,
impl<T, R> UnwindSafe for BAensemble<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