z_modularity(graph: <Mock id='140619399400912'>, communities: object, **kwargs) → object

Z-modularity is another variant of the standard modularity proposed to avoid the resolution limit. The concept of this version is based on an observation that the difference between the fraction of edges inside communities and the expected number of such edges in a null model should not be considered as the only contribution to the final quality of community structure.

  • graph – a networkx/igraph object
  • communities – NodeClustering object

FitnessResult object


>>> from cdlib.algorithms import louvain
>>> from cdlib import evaluation
>>> g = nx.karate_club_graph()
>>> communities = louvain(g)
>>> mod = evaluation.z_modularity(g,communities)
  1. Miyauchi, Atsushi, and Yasushi Kawase. Z-score-based modularity for community detection in networks. PloS one 11.1 (2016): e0147805.