probinet.synthetic.dynamic#
Class definition of the reciprocity generative models with the member functions required.
Functions
| 
 | Compute the value of a function used to find the value of the sparsity parameter 'c'. | 
| 
 | Compute the NxK membership vectors u, v using a Dirichlet or a Gamma distribution. | 
Classes
| 
 | A class to generate a synthetic network using the DynCRep models. | 
- class probinet.synthetic.dynamic.SyntheticDynCRep(N: int, K: int, T: int = 1, eta: float = 0.0, L: int = 1, avg_degree: float = 5.0, verbose: int = 0, beta: float = 0.2, ag: float = 1.0, bg: float = 0.5, eta_dir: float = 0.5, L1: bool = True, corr: float = 1.0, over: float = 0.0, label: str | None = None, end_file: str = '.dat', folder: Path = PosixPath('outputs'), structure: str = 'assortative', output_parameters: bool = False, output_adj: bool = False, outfile_adj: str | None = None, figsize: Tuple[int, int] = (7, 7), fontsize: int = 15, ExpM: ndarray | None = None, rng: Generator | None = None)[source]#
- A class to generate a synthetic network using the DynCRep models. - Exp_ija_matrix(u, v, w)[source]#
- Compute the expected adjacency matrix for the DynCRep models. - Parameters:
- u (np.ndarray) – Outgoing membership matrix. 
- v (np.ndarray) – Incoming membership matrix. 
- w (np.ndarray) – Affinity tensor. 
 
- Returns:
- Exp_ija – Expected adjacency matrix. 
- Return type:
- np.ndarray 
 
 - check_reciprocity_tm1(A: List[coo_matrix]) None[source]#
- Check the reciprocity of the adjacency matrices at time t and t-1. - Parameters:
- A (List[scipy.sparse.coo_matrix]) – List of adjacency matrices for each time step. 
 
 - generate_net(parameters=None)[source]#
- Generate a directed, possibly weighted network by using DynCRep. - Steps:
- Generate a network A[0]. 
- Extract A[t] entries (network edges) using transition probabilities. 
 
 - Parameters:
- parameters (dict) – Latent variables eta, beta, u, v and w. 
- Returns:
- G – NetworkX DiGraph object. Self-loops allowed. 
- Return type:
- networkx.classes.digraph.DiGraph 
 
 
- probinet.synthetic.dynamic.eq_c(c: float, M: ndarray, N: int, E: int, rho_a: float, mu: float) float[source]#
- Compute the value of a function used to find the value of the sparsity parameter ‘c’. - Parameters:
- c (float) – The sparsity parameter. 
- M (np.ndarray) – The matrix representing the expected number of edges between each pair of nodes. 
- N (int) – The number of nodes in the network. 
- E (int) – The expected total number of edges in the network. 
- rho_a (float) – The expected proportion of reciprocal edges in the network. 
- mu (float) – The proportion of reciprocal edges in the Erdos-Renyi network. 
 
- Returns:
- The value of the function for the given parameters. 
- Return type:
- float 
 
- probinet.synthetic.dynamic.membership_vectors(rng: Generator, L1: bool = False, eta: float = 0.5, alpha: float = 0.6, beta: float = 1, K: int = 2, N: int = 100, corr: float = 0.0, over: float = 0.0) Tuple[ndarray, ndarray][source]#
- Compute the NxK membership vectors u, v using a Dirichlet or a Gamma distribution. - Parameters:
- rng (np.random.Generator) – Random number generator container. 
- L1 (bool) – Flag for parameter generation method. True for Dirichlet, False for Gamma. 
- eta (float) – Parameter for Dirichlet. 
- alpha (float) – Parameter (alpha) for Gamma. 
- beta (float) – Parameter (beta) for Gamma. 
- K (int) – Number of communities. 
- N (int) – Number of nodes. 
- corr (float) – Correlation between u and v synthetically generated. 
- over (float) – Fraction of nodes with mixed membership. 
 
- Returns:
- uNumpy array
- Matrix NxK of out-going membership vectors, positive element-wise. Possibly None if in pure SpringRank or pure Multitensor. With unitary L1 norm computed row-wise. 
- vNumpy array
- Matrix NxK of in-coming membership vectors, positive element-wise. Possibly None if in pure SpringRank or pure Multitensor. With unitary L1 norm computed row-wise. 
 
- Return type:
- Tuple[np.ndarray, np.ndarray] 
 
