corneto.graph.duplication_divergence_network#

corneto.graph.duplication_divergence_network(n, p_retain=0.3, interactions=None, probs=None, seed=None)#

Generate a random network using the duplication-divergence model.

Parameters:
  • n (int) – Total number of nodes in the network (n must be at least 2).

  • p_retain (float, optional) – Probability to retain each edge during duplication (default is 0.3).

  • interactions (list or None, optional) – List of possible interaction types for edges (e.g., [1, -1]). If None, no interaction types will be assigned to edges.

  • probs (list or None, optional) – List of probabilities for each interaction type in the ‘interactions’ list. Must sum to 1 and have the same length as ‘interactions’. If None and interactions is provided, uniform probabilities will be used.

  • seed (int or None, optional) – Random seed for reproducibility (default is None).

  • Returns

    list of tuples

    If interactions is None, each edge is represented as (source, target) where source and target are vertex labels like “v1”, “v2”, … Otherwise, each edge is represented as (source, interaction, target) where interaction is one of the values from the interactions list.