Struct net_ensembles::ConfigurationModel[][src]

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

Generate networks with a given degree distribution

  • the degree of each vertex is fixed (see self.degree_vec), while the actual edges will be drawn randomly
  • No self loops allowed

Implementations

Get reference to the degree vector of the vertices, faster than self.graph().degree_vec(), since the former has to construct the vector, while the latter just returns a reference to an existing vector

create configuration model from a constant degree
  • drawn graphs will consist of degree_vec.len() vertices, where a vertex i will have degree degree_vec[i]
  • size: number of nodes in the resulting graphs
  • returns None if resulting degree vector is invalid
create ConfigurationModel from a generic graph
create ConfigurationModel from a generic graph and clones underlying Data
  • degree_vec will be extracted from generic_graph
  • Data will be cloned from the generic_graph
  • returns ConfigurationModel model
  • model.graph() will have the same topology as generic_graph after this creation. This will of cause change, if you call randomize or do markov steps
create configuration model from a degree vector
  • drawn graphs will consist of degree_vec.len() vertices, where a vertex i will have degree degree_vec[i]
  • returns None if degree vector is invalid
create configuration model from a degree vector
  • same as from_vec, but it does not check if the degree_vec is valid - that is on you now
check if a vector (slice) is a vaild degree distribution
  • sum of degree_vec needs to be even
  • degree_vec.len() has to be greater than 1
  • no entry can request a degree larger than degree_vec.len()-2
asserts, that a vector is a vaild degree distribution
  • similar to degree_vec_is_valid, but asserts instead
  • intended for debugging: see why the degree_vec is invalid
Swaps the degree vector for a new one and draws a new network accordingly

Note new_degree_vec.len() has to be of the same length as self.degree_vec.len() will panic otherwise

  • panics if new_degree_vec is invalid
  • returns previous degree_vec
Swaps the degree_vec for a new one and draws a new network accordingly
  • same as swap_degree_vec but does not assert, that the degree vector is valid
  • panics if self.degree_vec.len() != new_degree_vec.len() (the only thing still checked for, as that check is really really cheap)
Use the degree vector of a generic graph
  • asserts, that generic_graph and self.graph() have the same number of vertices
  • similar to self.swap_degree_vec_unchecked(generic_graph.degree_vec()) but does not create new vector and as such does not return old degree vector. If you need the old degree vector, you can use self.degree_vec().clone() before calling this method

Trait Implementations

Performs the conversion.

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

  • 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 Read more

    If you need to exchange the internal rng Read more

    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 with self.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
    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.

    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

    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

    Serialize this value into the given Serde serializer. Read more

    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

    Performs the conversion.

    Performs the conversion.

    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

    🔬 This is a nightly-only experimental API. (toowned_clone_into)

    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.