pycombo(g_original: object, weight: str = 'weight', max_communities: int = None, modularity_resolution: float = 1.0, num_split_attempts: int = 0, start_separate: bool = False, treat_as_modularity: bool = False, random_seed: int = 42) → cdlib.classes.node_clustering.NodeClustering¶
This is an implementation (for Modularity maximization) of the community detection algorithm called “Combo”.
Supported Graph Types
Undirected Directed Weighted Yes No Yes Parameters:
- g_original – a networkx/igraph object
- weight – Optional, defaults to weight. Graph edges property to use as weights. If None, graph assumed to be unweighted. Ignored if graph is passed as string (path to the file), or such property does not exist.
- max_communities – Optional, defaults to None. Maximum number of communities. If <= 0 or None, assume to be infinite.
- modularity_resolution – float, defaults to 1.0. Modularity resolution parameter.
- num_split_attempts – int, defaults to 0. Number of split attempts. If 0, autoadjust this number automatically.
- start_separate – bool, default False. Indicates if Combo should start from assigning each node into its own separate community. This could help to achieve higher modularity, but it makes execution much slower.
- treat_as_modularity – bool, default False. Indicates if edge weights should be treated as modularity scores. If True, the algorithm solves clique partitioning problem over the given graph, treated as modularity graph (matrix). For example, this allows users to provide their own custom ‘modularity’ matrix. modularity_resolution is ignored in this case.
- random_seed – int, defaults to 42. Random seed to use.
>>> from cdlib import algorithms >>> import networkx as nx >>> G = nx.karate_club_graph() >>> coms = algorithms.pycombo(G)
Sobolevsky, S., Campari, R., Belyi, A. and Ratti, C., 2014. General optimization technique for high-quality community detection in complex networks. Physical Review E, 90(1), p.012811.
Reference implementation: https://github.com/Casyfill/pyCombo