- Introduced by
- Newman, M. E. J.
- Year
- 2004
- Type
- Community structure optimization on weighted graphs
- Family
- Network science
What does it do?
Weighted modularity analysis extends the classical Newman-Girvan modularity measure to networks whose edges carry numeric strengths, such as frequencies, intensities or flow volumes.
It replaces binary adjacency with tie weights and compares each within-community weight against a null model that preserves node strengths. The result is a partition of nodes into communities that reflects how strongly, not only whether, nodes are tied.
The intuition behind the method
Ordinary modularity asks only whether two nodes are connected; weighted modularity asks how strongly they are connected relative to what each node's total tie strength would predict. Consider a collaboration network in which one pair of researchers co-authors ten papers and another pair co-authors once. An unweighted analysis treats both pairs as the same kind of tie, while weighted modularity treats the prolific pair as a much stronger bond. Because the expected weight is computed from node strengths, a node with many heavy ties does not automatically pull all of its neighbours into one community. Each tie is judged against the product of its endpoints' total strengths, so a hub's many ties are weighed relative to its own total tie strength. The resulting partition therefore tracks interaction intensity wherever edge weight carries substantive meaning.
History
The weighted method extends the classical Newman-Girvan modularity measure, which is the quality function on which it is built. Newman (2004, Physical Review E) analysed weighted networks by mapping them to unweighted multigraphs, which allowed standard techniques to be applied, and gave an algorithm for community structure in weighted networks. Newman (2006, PNAS) showed that modularity can be expressed through the eigenvectors of a modularity matrix, yielding a spectral community-detection algorithm. Louvain and Leiden are later heuristic optimizers that are now widely used to maximise modularity on large networks.
When to use it
Use weighted modularity when edges carry meaningful numeric weights, such as survey tie strengths, co-occurrence counts, flow volumes or correlation magnitudes, and when the question concerns communities defined by interaction intensity. It is the weighted extension of standard modularity for valued networks. Edge weights must be non-negative, because the method treats weights as counts of ties in a multigraph and builds its expected-weight term from node strengths. Signed measures such as raw correlations do not meet this requirement. Taking absolute values is possible but changes the meaning of the ties, so check that the partition still reflects the intended interaction intensity, or use a method designed for signed networks. Do not use weighted modularity when edge weights are arbitrary placeholders, because the null model then encodes meaningless strengths. Avoid it for very small networks, where few partitions are possible and communities tend to be trivial. Be cautious when the resolution limit matters for your question, for example in large networks with many small groups, where resolution-adjusted variants may be needed. If you need inferential uncertainty about membership or a formal test of community structure, a stochastic block model is the more suitable choice.
Limitations and considerations
- Inherits the modularity resolution limit: small communities embedded in large networks may be merged into larger ones rather than detected.
- Maximising Q_w is a hard optimization problem, so heuristic runs can return different partitions and results need stability checks.
- The expected-weight term depends directly on node strengths; a few nodes with very large total weight can dominate it, so scaling and normalisation of the weights affect the partition.
- Returns a point partition without uncertainty estimates, so it does not by itself indicate how confident one can be in any individual node's membership.
- The 0.3 benchmark for Q_w is a rule of thumb; a value above it does not establish that the communities are statistically significant.
Source conditions do not replace independent scientific review or validation by an analysis engine.
Strengths
- The null model uses node strengths, so a tie is judged against what its endpoints' total tie strength predicts rather than against a uniform baseline.
- When all edge weights are set to 1, the objective reduces to standard modularity, so unweighted and weighted partitions of the same network can be compared directly.
- The objective is a modification of standard modularity, so the same heuristic optimizers (Louvain, Leiden, spectral methods) can be applied with little change.
- Q_w is a single scalar, so alternative partitions of the same weighted network can be ranked on one scale.
Applications
- Detecting communities in collaboration networks where co-authorship frequency serves as edge weight.
- Identifying functional modules in biological networks with weighted co-expression or protein-interaction data.
- Segmenting trade or migration networks where flow volume is the tie strength.
- Finding topic clusters in weighted co-citation or bibliographic coupling networks.
- Grouping actors in communication networks by message frequency or volume.
- Partitioning weighted transportation or infrastructure networks into operational zones.
How it works
How it works
Construct a weighted adjacency matrix W, where entry w_ij is the numeric strength of the tie between nodes i and j. Each node's strength s_i is the sum of its edge weights. The total edge weight m is half the sum of all strengths, so that 2m equals the total weight in the network.
Formula
W = [w_{ij}], \; s_i = \sum_j w_{ij}Q_w sums, over node pairs in the same community, the difference between the observed weight w_ij and the weight s_i s_j / 2m expected when strengths are preserved and ties are placed at random, then scales the result by 1/2m. A high Q_w means that same-community ties are much stronger than this null model predicts. When all edges are binary, the formula reduces to the standard unweighted modularity.
Formula
Q_w = \frac{1}{2m} \sum_{ij}\left(w_{ij} - \frac{s_i s_j}{2m}\right)\delta(c_i,c_j)Run an optimizer such as Louvain, Leiden, spectral decomposition or simulated annealing to find the community assignment that maximises Q_w. Maximising modularity is computationally hard in general, so these are heuristics. Louvain is among the most commonly used because it scales to large networks. Leiden is a refinement intended to avoid communities that are internally poorly connected.
Inspect the final Q_w value. A commonly quoted rule of thumb treats values above about 0.3 as indicating meaningful community structure, while values near zero suggest little clustering relative to the null model. This is a conventional heuristic rather than a significance test or a cut-off validated for weighted networks. Compare Q_w across alternative partitions, check the number and size of the communities for substantive plausibility, and confirm that the partition is stable across optimizer runs.
Formula
Q_w \in (-0.5, 1); \; Q_w > 0.3 \text{ indicates meaningful structure}Test partition stability by running the optimizer with multiple random seeds and checking whether the same communities recur. For small or sparse networks, consider bootstrap resampling of edges to see how much community membership changes under perturbation.
Common pitfalls
- Ignoring the resolution limit and assuming that all small clusters are detected correctly in very large networks.
- Reporting Q_w alone without checking partition stability across repeated optimizer runs with different random seeds.
- Using raw counts as weights without normalisation. Normalising by node activity changes each node's strength and therefore the expected-weight term, so the partition can change substantially.
- Treating the detected communities as ground truth rather than as one partition consistent with the data.
- Skipping the comparison with the unweighted partition, which is needed to see whether the weights actually change the grouping.
Frequently asked questions
How is weighted modularity different from standard modularity?
Standard modularity uses binary edges and compares actual link counts to a degree-preserving null model. Weighted modularity replaces link counts with tie strengths and uses a strength-preserving null model, so communities reflect intensity of interaction rather than mere presence of ties.
Which optimizer should I use for weighted modularity?
The Louvain algorithm is the most common choice and is a practical default for most network sizes. The Leiden algorithm is a refinement of Louvain designed to avoid communities that are internally poorly connected, which can make the result more reliable. Check your library's documentation for the options it supports.
What is a good Q_w value?
There is no universal threshold. Values above about 0.3 are often treated as a rough sign of meaningful community structure, but this is a rule of thumb rather than a validated cut-off. Comparing Q_w across alternative partitions or networks is more informative than the absolute value, and Q_w should be reported alongside a stability check across repeated optimizer runs.
Can I use weighted modularity on directed networks?
Yes in principle, but the formula must be adapted for directed ties, because outgoing and incoming tie strengths are no longer interchangeable. The sources used for this page do not give the directed form, so confirm that your software implements directed weighted modularity and use its documented definition before relying on the result.
When should I use a stochastic block model instead?
Use a stochastic block model when you need inferential uncertainty quantification around community membership, when you want to test whether detected communities are statistically significant rather than optimizing a heuristic score, or when the resolution limit of modularity is a concern.
Related methods
Sources
Newman, M. E. J. (2004). Analysis of weighted networks. Physical Review E, 70(5), 056131.
Open DOI referenceNewman, M. E. J. (2006). Modularity and community structure in networks. Proceedings of the National Academy of Sciences, 103(23), 8577–8582.
Open DOI reference