Skip to main content
`Ctrl`+`K`

# duplication_divergence_graph

duplication_divergence_graph(n, p, seed=None, *, create_using=None)

  Returns an undirected graph using the duplication-divergence model.

  A graph of `n` nodes is created by duplicating the initial nodes and retaining edges incident to the original nodes with a retention probability `p`.

  Parameters:
    n int

      The desired number of nodes in the graph.

    p float

      The probability for retaining the edge of the replicated node.

    seed integer, random_state, or None (default)

      Indicator of random number generation state. See Randomness.

    create_using Graph constructor, optional (default=nx.Graph)

      Graph type to create. If graph instance, then cleared before populated. Multigraph and directed types are not supported and raise a `NetworkXError`.

  Returns:
    G Graph
  Raises:
    NetworkXError

      If `p` is not a valid probability. If `n` is less than 2.

  Notes

  This algorithm appears in [1].

  This implementation disallows the possibility of generating disconnected graphs.

  References

  [1]

  I. Ispolatov, P. L. Krapivsky, A. Yuryev, “Duplication-divergence model of protein interaction network”, Phys. Rev. E, 71, 061911, 2005.