cdlib.evaluation.z_modularity

z_modularity(graph: <Mock id='140361405511520'>, 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.

Parameters:
  • graph – a networkx/igraph object
  • communities – NodeClustering object
Returns:

FitnessResult object

Example:

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