mossspider.dgm.uniform_network¶
- uniform_network(n, degree, pr_w=0.35, seed=None)¶
Generates a uniform random graph for a set number of nodes (n) and specified max and min degree (degree). Additionally, assigns a binary baseline covariate, W, to each observation.
- Parameters
n (int) – Number of nodes in the generated network
degree (list, set, array) – An array of two elements. The first element is the minimum degree and the second element is the maximum degree.
pr_w (float, optional) – Probability of W=1. W is a binary baseline covariate assigned to each unit.
seed (int, None, optional) – Random seed to use. Default is None.
- Returns
- Return type
networkx.Graph
Examples
Loading the necessary functions
>>> from mossspider.dgm import uniform_network
Generating the uniform network
>>> G = uniform_network(n=500, degree=[0, 2])