cdlib.benchmark.RPG¶
- cdlib.benchmark.RPG(sizes: list, p_in: float, p_out: float, seed: object = 42, directed: bool = False) [<class 'object'>, <class 'object'>] ¶
Returns the random partition graph with a partition of sizes.
A partition graph is a graph of communities with sizes defined by s in sizes. Nodes in the same group are connected with probability p_in and nodes of different groups are connected with probability p_out.
- Parameters:
sizes – Sizes of groups (list of ints)
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 RPG >>> G, coms = RPG([10, 10, 10], 0.25, 0.01)
- References:
Santo Fortunato ‘Community Detection in Graphs’ Physical Reports Volume 486, Issue 3-5 p. 75-174. https://arxiv.org/abs/0906.0612