TOPICS
Search

Graph Modularity


Graph modularity is a score used in community detection to measure how strongly a graph can be divided into communities. A graph community is a group of vertices that are more strongly connected to one another than expected under a specified comparison model. Let G be a graph with m>0 edges, and let A be a set partition of its vertex set. For a part A, let e(A) be the number of edges with both endpoints in A, and let vol(A) be the sum of the vertex degrees in A. The modularity score of A and the modularity of G are

q_A(G)=sum_(A in A)((e(A))/m-(vol(A)^2)/(4m^2))
(1)
q^*(G)=max_(A)q_A(G).
(2)

The first term rewards edges lying within parts, while the second subtracts a degree-based null-model expectation (Newman and Girvan 2004). For every nonempty graph, 0<=q^*(G)<1; by convention, an empty graph has modularity zero.

Every complete graph and every complete multipartite graph has modularity zero. McDiarmid and Skerman (2026) proved that, for n>=4, the fewest edges that can be deleted from K_n to obtain positive modularity is ^n/2\+1. They also found a transition for very dense random graphs near the point where the average degree of the complementary graph is 1.


See also

Community Detection, Complete Graph, Complete Multipartite Graph, Graph Community, Graph Complement, Random Graph, Set Partition, Vertex Degree

Explore with Wolfram|Alpha

References

McDiarmid, C. and Skerman, F. "On Graphs with Modularity Zero or Near-Zero." Elec. J. Combin. 33, No. 3, P3.51, 1-45, 2026. https://doi.org/10.37236/12644.Newman, M. E. J. and Girvan, M. "Finding and Evaluating Community Structure in Networks." Phys. Rev. E 69, 026113, 2004. https://doi.org/10.1103/PhysRevE.69.026113.

Cite this as:

Weisstein, Eric W. "Graph Modularity." From MathWorld--A Wolfram Resource. https://mathworld.wolfram.com/GraphModularity.html

Subject classifications