probinet.synthetic.base#

Base classes for synthetic network generation.

Functions

affinity_matrix([structure, N, K, ...])

Compute the KxK affinity matrix w with probabilities between and within groups.

Classes

BaseSyntheticNetwork([N, L, K, seed, eta, ...])

A base abstract class for generation and management of synthetic networks.

GraphProcessingMixin()

Mixin class for graph processing and evaluation methods.

StandardMMSBM(**kwargs)

Create a synthetic, directed, and weighted network (possibly multilayer) by a standard mixed-membership stochastic block-models.

Structure(value[, names, module, qualname, ...])

class probinet.synthetic.base.BaseSyntheticNetwork(N: int = 1000, L: int = 1, K: int = 2, seed: int = 10, eta: float = 50, out_folder: PathLike | None = None, output_parameters: bool = False, output_adj: bool = False, outfile_adj: str | None = None, end_file: str | None = None, show_details: bool = True, show_plots: bool = False, **kwargs)[source]#

A base abstract class for generation and management of synthetic networks.

Suitable for representing any type of synthetic network.

class probinet.synthetic.base.GraphProcessingMixin[source]#

Mixin class for graph processing and evaluation methods.

output_adjacency(G: MultiDiGraph, outfile: str | None = None) None[source]#

Output the adjacency matrix. Default format is space-separated .csv with 3 columns: node1 node2 weight

Parameters:
  • G (MultiDiGraph) – MultiDiGraph NetworkX object.

  • outfile (str, optional) – Name of the adjacency matrix.

class probinet.synthetic.base.StandardMMSBM(**kwargs)[source]#

Create a synthetic, directed, and weighted network (possibly multilayer) by a standard mixed-membership stochastic block-models.

  • It models marginals (iid assumption) with Poisson distributions

build_Y(parameters: tuple[ndarray, ndarray, ndarray] | None = None) None[source]#

Generate network layers G using the latent variables, with the generative models A_ij ~ P(A_ij|u,v,w)

Parameters:

parameters (Tuple[np.ndarray, np.ndarray, np.ndarray], optional)

init_mmsbm_params(**kwargs) None[source]#

Check MMSBM-specific parameters

class probinet.synthetic.base.Structure(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]#
ASSORTATIVE = 'assortative'#
CORE_PERIPHERY = 'core-periphery'#
DIRECTED_BIASED = 'directed-biased'#
DISASSORTATIVE = 'disassortative'#
probinet.synthetic.base.affinity_matrix(structure: Structure | str = 'assortative', N: int = 100, K: int = 2, avg_degree: float = 4.0, a: float = 0.1, b: float = 0.3) ndarray[source]#

Compute the KxK affinity matrix w with probabilities between and within groups.

Parameters:
  • structure (Structure, optional) – Structure of the network (default is Structure.ASSORTATIVE).

  • N (int, optional) – Number of nodes (default is 100).

  • K (int, optional) – Number of communities (default is 2).

  • avg_degree (float, optional) – Average degree of the network (default is 4.0).

  • a (float, optional) – Parameter for secondary probabilities (default is 0.1).

  • b (float, optional) – Parameter for secondary probabilities in ‘core-periphery’ and ‘directed-biased’ structures (default is 0.3).

Returns:

KxK affinity matrix. Element (k,h) gives the density of edges going from the nodes of group k to nodes of group h.

Return type:

np.ndarray