A Bit of History
Michelle Girvan and Mark Newman introduced the method in their 2002 paper “Community Structure in Social and Biological Networks.” Their shift in viewpoint was elegant: instead of assembling communities from similar vertices, repeatedly cut the connections that appear to carry the most traffic between regions of the network.
The result is a divisive hierarchy, not just one flat answer. The graph begins as a few large connected pieces and is progressively split into smaller ones; a separate quality score can select the most useful level.
What Does “Community” Mean?
Informally, a community has many connections inside itself and comparatively few connections to other groups. That definition describes a pattern, not a unique object: the same network may have teams, departments, and divisions at different scales. Girvan–Newman therefore produces a sequence of candidate partitions rather than requiring the number of communities in advance.
Strong interiors
Vertices within a plausible group have multiple alternate routes between them.
Weak interfaces
Only a small number of edges connect one dense region to another.
Multiple scales
Removing bridges reveals coarse groups first and finer subdivisions later.
Edge Betweenness: Counting Shortest-Path Traffic
For an undirected edge $e$, edge betweenness centrality is
$$C_B(e)=\sum_{s<t}\frac{\sigma_{st}(e)}{\sigma_{st}},$$
where $\sigma_{st}$ is the number of shortest paths between $s$ and $t$, and $\sigma_{st}(e)$ counts those using $e$. When several equally short paths exist, the pair contributes fractionally instead of giving every route a full vote.
Betweenness is global traffic measured on a local object: one edge scores highly because shortest paths between many distant pairs depend on it.
The Divisive Pipeline
- Measure. Compute every current edge's betweenness with Brandes' dependency-accumulation method.
- Remove. Delete one maximum-betweenness edge. A deterministic endpoint order makes ties reproducible; another valid policy removes all tied maxima as one batch.
- Inspect. Recompute connected components. When their count increases, record the new partition as another level in the hierarchy.
- Score. Evaluate that partition—commonly with modularity measured against the original, intact graph—and remember the best level encountered.
- Repeat. Recalculate betweenness on the modified graph before choosing the next edge. Stop at the desired number of groups or when no edges remain.
A Bridge Between Two Dense Groups
The graph below contains two four-vertex cliques joined only by edge $DE$. Each of the $4\times4=16$ cross-group vertex pairs must use $DE$, so that edge alone receives 16 units of betweenness from those pairs. Inside either clique, traffic can spread across many alternatives.
Why Must Betweenness Be Recomputed?
Removing an edge changes the set of shortest paths. Some routes disappear, tied routes may become unique, and traffic can be redirected onto edges that previously looked ordinary. Reusing the first betweenness ranking would describe the old graph, not the current one.
Recomputation Is the Algorithm
If two communities have several inter-community links, the first removal may push all cross-group traffic onto the survivors. Their betweenness then rises sharply, allowing the method to peel away an interface one edge at a time.
Selecting a Level with Modularity
Edge removal creates a hierarchy, but it does not say which level is best. For a partition into communities $C$, unweighted modularity can be written
$$Q=\sum_C\left[\frac{m_C}{m}-\left(\frac{K_C}{2m}\right)^2\right],$$
where $m$ is the number of edges in the original graph, $m_C$ is the number of original edges internal to $C$, and $K_C$ is the sum of original degrees in $C$. The first term rewards internal edges; the second subtracts what a degree-preserving random baseline would predict.
For the two-clique example, $m=13$. Each side contains six internal edges and has degree sum 13, giving $Q=2[6/13-(13/26)^2]\approx0.423$ after removing the bridge.
What Does the Heuristic Actually Guarantee?
Brandes' calculation gives the exact edge-betweenness values for the current graph, and the chosen tie policy gives a reproducible removal hierarchy. What is not guaranteed is recovery of a unique ground-truth community structure or the globally maximum-modularity partition.
The bridge intuition is strongest when groups are internally well connected and have few links between them. A high-betweenness edge can instead be an internal bottleneck, and modularity itself has known scale limitations. Treat the output as an interpretable structural hypothesis to examine, not an oracle.
Complexity Analysis
| Work | Unweighted graph | Explanation |
|---|---|---|
| One Brandes pass | $O(VE)$ | A BFS and dependency back-propagation from each vertex. |
| Up to $E$ removals | $O(VE^2)$ | Worst case when betweenness is recomputed after every single edge. |
| Working memory | $O(V+E)$ | Adjacency, predecessor lists, path counts, dependencies, and scores. |
| Stored hierarchy | up to $O(VE)$ | If every partition snapshot is retained explicitly; storing only the best uses less. |
For positively weighted graphs, the Brandes stage replaces BFS with Dijkstra, increasing each full centrality computation. Removing tied edges in batches, stopping after a target number of communities, or recomputing only affected regions can reduce practical work, but the classic algorithm remains best suited to small and medium exploratory networks.
Implementation
The Python reference below completes the whole workflow: exact unweighted edge betweenness, deterministic one-edge removals, hierarchy snapshots, and modularity against the original graph. The C++ and Java panels implement the same Brandes kernel used inside each iteration.
How It Compares with Other Community Methods
| Method | Strategy | Output shape | Strength | Main tradeoff |
|---|---|---|---|---|
| Girvan–Newman | Remove high-betweenness edges | Divisive hierarchy | Interpretable bridge narrative | Repeated global recomputation is expensive |
| Louvain | Greedily optimize modularity | Multi-level partition | Scales well to large sparse graphs | Order dependence and modularity limitations |
| Label propagation | Adopt neighboring labels | Flat partition per run | Very fast and simple | Results can be unstable |
| Spectral clustering | Partition graph embeddings | Usually a requested $k$ | Strong geometric foundation | Eigenvector computation and choosing $k$ |
Where the Method Is Useful
Small Social Networks
Explain which relationships connect otherwise cohesive friendship or collaboration groups.
Organizational Maps
Generate hypotheses about informal team boundaries and cross-team liaison links.
Biological Networks
Explore modules in compact interaction networks where structural bridges are scientifically interpretable.
Teaching
Connect shortest paths, centrality, connected components, hierarchies, and modularity in one algorithm.
Exploratory Analysis
Inspect several hierarchy levels instead of committing immediately to one community count.
Bottleneck Audits
Surface edges whose loss would redirect a large amount of shortest-path traffic.
Pitfalls and Edge Cases
| Mistake | Consequence | Robust treatment |
|---|---|---|
| Computing betweenness only once | Later removals follow stale shortest paths. | Recompute after every removal or declared tie batch. |
| Ignoring equal shortest paths | One arbitrary route receives too much credit. | Count all shortest paths and distribute dependency fractionally. |
| Scoring modularity on the damaged graph | Candidate levels are compared against changing baselines. | Use the original edges and degrees for every partition score. |
| Leaving tie behavior unspecified | The hierarchy varies between runs or implementations. | Document deterministic one-at-a-time or tied-batch removal. |
| Assuming the input is connected | The starting level and split counts are misinterpreted. | Record the initial connected components before removing edges. |
| Using vertex betweenness | The algorithm ranks vertices rather than removable links. | Accumulate dependency contributions onto edges. |
| Treating highest modularity as ground truth | Resolution effects or noise are overlooked. | Inspect nearby levels and validate with domain evidence. |
Scale Is the Main Limitation
The same recomputation that makes the hierarchy easy to interpret also makes the classic algorithm costly. For very large networks, use a scalable method first and reserve Girvan–Newman for smaller induced subgraphs or explanatory audits.
Exercises
Reason About Traffic and Partitions
- Count. Prove that bridge $DE$ in the two-clique example receives exactly 16 units from cross-group pairs.
- Share. Construct a diamond with two equal shortest paths and show how a pair contributes $1/2$ to each alternative edge.
- Recompute. Add a second bridge between the cliques. Remove the first maximum edge and explain which remaining edge's score rises.
- Score. Derive $Q\approx0.423$ for the two four-node communities using the original 13 edges.
- Ties. Compare one-at-a-time lexicographic removal with removing all maximum-tied edges as a batch.
- Validate. Check that every recorded level is a partition: communities are disjoint and their union is all vertices.
Brandes hint: first count shortest paths outward from a source, then push dependency credit backward in reverse BFS order.