generate_duplication_divergence#
- graph_tool.generation.generate_duplication_divergence(N, p)[git][source]#
Generate a graph with the duplication-divergence model.
- Parameters:
- N
int Number of vertices.
- p
float Probability of retaining an edge of the duplicated vertex.
- N
- Returns:
- g
Graph The generated undirected graph.
- g
See also
generate_partial_duplicationPartial duplication model
Notes
In the model of Ispolatov, Krapivsky, and Yuryev [ispolatov-duplication-2005], the graph starts with a single edge, and in every step a uniformly chosen vertex is duplicated: the copy keeps each of the edges of the original independently with probability \(p\), and copies that keep no edge are discarded. The algorithm runs in time \(O(E/p)\).
References
[ispolatov-duplication-2005]I. Ispolatov, P. L. Krapivsky and A. Yuryev, “Duplication-divergence model of protein interaction network”, Physical Review E 71, 061911 (2005), DOI: 10.1103/PhysRevE.71.061911 [sci-hub, @tor], arXiv: q-bio/0411052
Examples
>>> g = gt.generate_duplication_divergence(10000, 0.4) >>> print(g.num_edges()) 35124
A smaller instance is drawn as follows:
>>> g = gt.generate_duplication_divergence(200, 0.4) >>> gt.graph_draw(g, pos=gt.sfdp_layout(g), ... output="generate_duplication_divergence-small.pdf") <...>
Duplication–divergence graph with \(N=200\) and \(p=0.4\).#