Random Generators
Random Number Generator
- class trecs.random.generators.Generator(seed=None, bit_generator=None)[source]
Wrapper around
numpy.random.Generator
. Please see the Numpy documentation for more details.- Parameters
seed (int, optional) –
bit_generator (
numpy.random.BitGenerator
, optional) –numpy.random.BitGenerator
. Please see Numpy’s BitGenerator documentation for more details.
Social Graph Generator
Thin wrapper around the Networkx random graph generators. We use this static class to generate random network adjacency matrices.
By default, it generates a binomial graph, but it can generate any other random graph included in the Networkx API. Please refer to the Networkx documentation.
Note: to change type of graph, please include the graph_type parameter.
num (int) – Number of nodes in the graph. This is equivalent to the number of users in the system.
Adjacency matrix – Size |U|x|U|.
numpy.ndarray
ValueError – If num is not an integer.
Examples
A minimal use case:
Changing random graph generator (e.g., with the random_regular_graph):