cdlib.benchmark.PP

PP(l: int, k: int, p_in: float, p_out: float, seed: object = 42, directed: bool = False) → [<class 'object'>, <class 'object'>]

Returns the planted l-partition graph.

This model partitions a graph with n=l*k vertices in l groups with k vertices each. Vertices of the same group are linked with a probability p_in, and vertices of different groups are linked with probability p_out.

Parameters:
  • l – Number of groups
  • k – Number of vertices in each group
  • p_in – probability of connecting vertices within a group
  • p_out – probability of connected vertices between groups
  • seed – Indicator of random number generation state.
  • directed – hether to create a directed graph or not. Boolean, default False
Returns:

A networkx synthetic graph, the set of communities (NodeClustering object)

Example:
>>> from cdlib.benchmark import planted_partitions
>>> G, coms = planted_partitions(4, 3, 0.5, 0.1, seed=42)
References:

A. Condon, R.M. Karp, Algorithms for graph partitioning on the planted partition model, Random Struct. Algor. 18 (2001) 116-140. Santo Fortunato ‘Community Detection in Graphs’ Physical Reports Volume 486, Issue 3-5 p. 75-174. https://arxiv.org/abs/0906.0612