Class Modularity

Inheritance Relationships

Base Type

Class Documentation

class Modularity : public NetworKit::QualityMeasure

Modularity is a quality index for community detection. It assigns a quality value in [-0.5, 1.0] to a partition of a graph which is higher for more modular networks and partitions which better capture the modular structure.

Modularity is defined as:

$$mod(\zeta) := \frac{\sum_{C \in \zeta} \sum_{ e \in E(C) } \omega(e)}{\sum_{e \in E} \omega(e)} \frac{ \sum_{C \in \zeta}( \sum_{v \in C} \omega(v) )^2 }{4( \sum_{e \in E} \omega(e) )^2 }$$

Public Functions

Modularity()

Default constructor

virtual double getQuality(const Partition &zeta, const Graph &G) override

Returns the Modularity of the given clustering with respect to the graph G.

Parameters:
  • zeta – The clustering.

  • G – The graph.

Returns:

The modularity.

void setTotalEdgeWeight(double totalEdgeWeight)
Parameters:

totalEdgeWeight – Sum of all edge weights in G. If specified, it does not have to be computed.