NEW
A network quality measure comparing within-community edge density against between-community edge density to quantify community structure.
DESCRIPTION
Modularity assesses how well a graph divides into communities with dense internal connections and sparse external links. High modularity indicates strong community structure beyond random expectation. It underpins popular community detection algorithms like Louvain and Leiden that optimize modularity. However, modularity maximization has a known resolution limit and may miss small communities. It is widely used in social networks, biology, and information graphs to evaluate partitions. Complementary measures like conductance or normalized cuts can address limitations and offer alternative perspectives.
ALTERNATIVE DEFINITIONS
Wikipedia
Modularity is a measure of the structure of networks or graphs. It measures the strength of division of a network into modules (also called groups, clusters or communities).
Captures both the purpose and intuitive meaning of the metric.
PNAS (Newman, 2006)
Modularity is a benefit function that measures the fraction of edges that fall within communities minus the expected fraction if edges were placed at random.
Provides the canonical interpretation relative to a random null model.
NetworkX
The modularity of a partition is the sum over communities of the difference between the fraction of edges within the community and the expected fraction in a random graph with the same degree sequence.
Implementation-oriented description aligned with the standard definition.
RELATED TERMS
Community Detection Louvain Method Leiden Algorithm Normalized Cuts Graph Clustering Graph Partitioning Assortativity Stochastic Block Model Graph Embedding
COMPETING TERMS
Conductance Infomap
KNOWLEDGE AREAS
TARGET AUDIENCE
Data Scientist AI Engineer Data Analyst MLOps Engineer
EXTERNAL SOURCES
- Wikipedia - Modularity (networks)
- NetworkX - Python community detection and modularity
- Leidenalg - Leiden community detection algorithm docs
- arXiv - Fortunato review on community detection
TOP QUESTIONS
What does Modularity measure in a graph?
It measures how strongly a network divides into communities by comparing internal versus external edge densities relative to a random baseline.
Category: Definition
Why is Modularity useful for community detection?
Maximizing modularity often yields meaningful communities. It provides a unified objective optimized by algorithms like Louvain and Leiden.
Category: Relevancy
What is the resolution limit of Modularity?
Modularity can miss small communities because the objective favors larger partitions at certain scales. Complementary metrics can mitigate this issue.
Category: Risk
How does Modularity compare to Conductance?
Conductance evaluates boundary edges relative to internal volume, while modularity compares to a random null model. Each emphasizes different aspects of community quality.
Category: Alternatives
What algorithms optimize Modularity?
Heuristics like Louvain and Leiden optimize modularity efficiently on large networks, balancing speed and quality.
Category: Example
When is Modularity not appropriate?
In graphs with overlapping communities or varying scales, modularity may be misleading. Methods tailored to overlap or multi-resolution may be preferable.
Category: Mistakes
How is Modularity computed for weighted graphs?
Weighted modularity replaces edge counts with summed weights, keeping the same random baseline concept.
Category: Requirements
Is higher Modularity always better?
Not necessarily. Overfitting to modularity may produce artificial partitions; validation with domain knowledge is essential.
Category: Opinion
Can Modularity be negative?
Yes, if within-community connectivity is lower than expected at random, modularity can be negative.
Category: Example