generate_partial_duplication#
- graph_tool.generation.generate_partial_duplication(N, n, p, q)[git][source]#
Generate a graph with the partial duplication model.
- Parameters:
- N
int Number of vertices.
- n
int Number of vertices of the initial complete graph.
- p
float Probability of connecting to each neighbor of the duplicated vertex.
- q
float Probability of connecting to the duplicated vertex.
- N
- Returns:
- g
Graph The generated undirected graph.
- g
See also
generate_duplication_divergenceDuplication-divergence model
Notes
In the model of Bebek et al. [bebek-degree-2006], the graph starts as a complete graph with \(n\) vertices, and every new vertex duplicates a uniformly chosen vertex \(v\): it connects to each neighbor of \(v\) independently with probability \(p\), and to \(v\) with probability \(q\). The algorithm runs in time \(O(n^2 + N\langle k\rangle)\).
References
[bebek-degree-2006]Gurkan Bebek, Petra Berenbrink, Colin Cooper, Tom Friedetzky, Joseph Nadeau and S. Cenk Sahinalp, “The degree distribution of the generalized duplication model”, Theoretical Computer Science 369, 239-249 (2006), DOI: 10.1016/j.tcs.2006.08.045 [sci-hub, @tor]
Examples
>>> g = gt.generate_partial_duplication(10000, 5, 0.5, 0.5) >>> print(g.num_edges()) 62220
A smaller instance is drawn as follows:
>>> g = gt.generate_partial_duplication(100, 3, 0.3, 0.5) >>> gt.graph_draw(g, pos=gt.sfdp_layout(g), ... output="generate_partial_duplication-small.pdf") <...>
Partial duplication graph with \(N=100\), \(n=3\), \(p=0.3\), and \(q=0.5\).#