cdlib.algorithms.greedy_modularity¶
-
greedy_modularity
(g_original: object, weight: list = None) → cdlib.classes.node_clustering.NodeClustering¶ The CNM algorithm uses the modularity to find the communities strcutures. At every step of the algorithm two communities that contribute maximum positive value to global modularity are merged.
Supported Graph Types
Undirected Directed Weighted Yes No No Parameters: - g_original – a networkx/igraph object
- weight – list of double, or edge attribute Weights of edges. Can be either an iterable or an edge attribute. Deafault None
Returns: NodeClustering object
Example: >>> from cdlib import algorithms >>> import networkx as nx >>> G = nx.karate_club_graph() >>> coms = algorithms.greedy_modularity(G)
References: Clauset, A., Newman, M. E., & Moore, C. Finding community structure in very large networks. Physical Review E 70(6), 2004