pub struct ErEnsembleC<T, R>where
    T: Node,
{ /* private fields */ }
Expand description

Implements Erdős-Rényi graph ensemble

  • variable number of edges
  • targets a connectivity

Sampling

Other

Implementations

Initialize

create new ErEnsembleC with:

  • n vertices
  • target connectivity c_target
  • rng is consumed and used as random number generator in the following
  • internally uses Graph<T>::new(n)
  • generates random edges according to ER model
Experimental! Connect the connected components
  • adds edges, to connect the connected components
  • panics if no vertices are in the graph
  • intended as starting point for a markov chain, if you require connected graphs
  • do not use this to independently (simple-) sample connected networks, as this will skew the statistics
  • This is still experimental, this member might change the internal functionallity resulting in different connected networks, without prior notice
  • This member might be removed in braking releases

returns target connectivity

Explanation

The target connectivity c_target is used to calculate the probability p, that any two vertices i and j (where i != j) are connected.

p = c_target / (N - 1) where N is the number of vertices in the graph

  • set new value for target connectivity
Note
  • will only set the value (and probability), which will be used from now on
  • if you also want to create a new sample, call randomize afterwards

Trait Implementations

Converts this type into a shared reference of the (usually inferred) input type.
Immutably borrows from an owned value. Read more
Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Returns a reference to the element stored in the specified node or None if out of Bounds
Returns a mutable reference to the element stored in the specified node or None if out of Bounds
For a save alternative see get_contained Read more
Returns a mutable reference to the element stored in the specified node Read more
Formats the value using the given formatter. Read more
Deserialize this value from the given Serde deserializer. Read more
  • use function f to create labels depending on the index
  • for valid dot_options use dot_options! macro and take a look at module dot_constants
  • Read more
  • create dot file with empty labels
  • default implementation uses dot_from_indices
  • Read more
  • same as self.dot(), but returns a String instead
  • same as self.dot_from_indices but returns String instead
  • same as self.dot_with_indices but returns String instead
  • use index as labels for the nodes
  • default implementation uses dot_from_indices
  • Read more
  • iterate over mutable additional information of neighbors of vertex index
  • iterator returns &mut T
  • sort_adj will affect the order
  • panics if index out of bounds
  • Read more
  • iterate over mutable additional information of neighbors of vertex index
  • iterator returns (index_neighbor: usize, neighbor: &mut T)
  • sort_adj will affect the order
  • panics if index out of bounds
  • Read more
  • get iterator over mutable additional information stored at each vertex in order of the indices
  • iterator returns a Node (for example EmptyNode or whatever you used)
  • Read more
    Access RNG

    If, for some reason, you want access to the internal random number generator: Here you go

    Swap random number generator
    • returns old internal rng
    Markov step
    • use this to perform a markov step, e.g., to create a markov chain
    • result ErStepC can be used to undo the step with self.undo_step(result)
    Undo a markcov step
    • adds removed edge, or removes added edge, or does nothing
    • if it returns an Err value, you probably used the function wrong
    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 markov step
    • adds removed edge, or removes added edge, or does nothing
    • if it returns an Err value, you probably used the function wrong
    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 Read more
    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
    Undo markov steps Read more
    Function called whenever the steps are accepted. Read more
    Function called whenever the steps are rejected. Read more
    Serialize this value into the given Serde serializer. Read more
    Randomizes the edges according to Er probabilities
    • this is used by ErEnsembleC::new to create the initial topology
    • you can use this for sampling the ensemble
    • runs in O(vertices * vertices)
    do the following times times: Read more
    do the following times times: Read more
    Sort adjecency lists

    If you depend on the order of the adjecency lists, you can sort them

    Performance
    • internally uses pattern-defeating quicksort as long as that is the standard
    • sorts an adjecency list with length d in worst-case: O(d log(d))
    • is called for each adjecency list, i.e., self.vertex_count() times
  • access additional information at index
  • mutable access to additional information at index
  • returns reference to the underlying topology aka, the GenericGraph
  • use this to call functions regarding the topology
  • Read more

    Auto Trait Implementations

    Blanket Implementations

    Gets the TypeId of self. Read more
    Immutably borrows from an owned value. Read more
    Mutably borrows from an owned value. Read more
    Cast from Self to T
    Try converting from Self to T
    Cast to integer, truncating Read more
    Cast to the nearest integer Read more
    Cast the floor to an integer Read more
    Cast the ceiling to an integer Read more
    Try converting to integer with truncation Read more
    Try converting to the nearest integer Read more
    Try converting the floor to an integer Read more
    Try convert the ceiling to an integer Read more
    Convert from T to Self
    Try converting from T to Self

    Returns the argument unchanged.

    Calls U::from(self).

    That is, this conversion is whatever the implementation of From<T> for U chooses to do.

    The alignment of pointer.
    The type for initializers.
    Initializes a with the given initializer. Read more
    Dereferences the given pointer. Read more
    Mutably dereferences the given pointer. Read more
    Drops the object pointed to by the given pointer. Read more
    The resulting type after obtaining ownership.
    Creates owned data from borrowed data, usually by cloning. Read more
    Uses borrowed data to replace owned data, usually by cloning. Read more
    The type returned in the event of a conversion error.
    Performs the conversion.
    The type returned in the event of a conversion error.
    Performs the conversion.