generate_partial_duplication

generate_partial_duplication#

graph_tool.generation.generate_partial_duplication(N, n, p, q)[git][source]#

Generate a graph with the partial duplication model.

Parameters:
Nint

Number of vertices.

nint

Number of vertices of the initial complete graph.

pfloat

Probability of connecting to each neighbor of the duplicated vertex.

qfloat

Probability of connecting to the duplicated vertex.

Returns:
gGraph

The generated undirected graph.

See also

generate_duplication_divergence

Duplication-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")
<...>
../_images/generate_partial_duplication-small.png

Partial duplication graph with \(N=100\), \(n=3\), \(p=0.3\), and \(q=0.5\).#