average_internal_degree(graph: <Mock id='139911973856720'>, community: object, summary: bool = True) → object

The average internal degree of the community set.

\[ \begin{align}\begin{aligned}f(S) = \frac{2m_S}{n_S}\\where :math:`m_S` is the number of community internal edges and :math:`n_S` is the number of community nodes.\end{aligned}\end{align} \]
  • graph – a networkx/igraph object
  • community – NodeClustering object
  • summary – boolean. If True it is returned an aggregated score for the partition is returned, otherwise individual-community ones. Default True.

If summary==True a FitnessResult object, otherwise a list of floats.


>>> from cdlib.algorithms import louvain
>>> from cdlib import evaluation
>>> g = nx.karate_club_graph()
>>> communities = louvain(g)
>>> mod = evaluation.average_internal_degree(g,communities)
  1. Radicchi, F., Castellano, C., Cecconi, F., Loreto, V., & Parisi, D. (2004). Defining and identifying communities in networks. Proceedings of the National Academy of Sciences, 101(9), 2658-2663.