cdlib.algorithms.CPM_Bipartite

CPM_Bipartite(g_original: object, resolution_parameter_01: float, resolution_parameter_0: float = 0, resolution_parameter_1: float = 0, degree_as_node_size: bool = False, seed: int = 0) → cdlib.classes.bipartite_node_clustering.BiNodeClustering

CPM_Bipartite is the extension of CPM to bipartite graphs

Supported Graph Types

Undirected Directed Weighted Bipartite
Yes No No Yes
Parameters:
  • g_original – a networkx/igraph object
  • resolution_parameter_01 – Resolution parameter for in between two classes.
  • resolution_parameter_0 – Resolution parameter for class 0.
  • resolution_parameter_1 – Resolution parameter for class 1.
  • degree_as_node_size – If True use degree as node size instead of 1, to mimic modularity
  • seed – the random seed to be used in CPM method to keep results/partitions replicable
Returns:

BiNodeClustering object

Example:
>>> from cdlib import algorithms
>>> import networkx as nx
>>> G = nx.algorithms.bipartite.generators.random_graph(100, 20, 0.5)
>>> coms = algorithms.CPM_Bipartite(G, 0.5)
References:

Barber, M. J. (2007). Modularity and community detection in bipartite networks. Physical Review E, 76(6), 066102. 10.1103/PhysRevE.76.066102