Skip to content
Part IA Lent Term

Diameter and the Giant Component

Diameter

Definition: the maximum shortest-path distance between any pair of nodes in a graph — the longest of all shortest paths.

Diameter=maxs,tV  d(s,t)\text{Diameter} = \max_{s, t \in V} \; d(s, t)

where d(s,t)d(s, t) is the length (number of edges) of the shortest path from ss to tt.

Interpretation: the “size” of the network measured in hops. A small diameter means the network is compact: you can reach any node from any other in few steps. A large diameter means the network is elongated or has bottlenecks.

Computing the Diameter

Run BFS from every node. For each source ss, record the maximum distance to any other node. Take the maximum of these maxima:

Diameter=maxs(maxtd(s,t))\text{Diameter} = \max_s \left( \max_{t} d(s, t) \right)

For NN nodes in a connected graph, this takes O(N(N+E))O(N \cdot (N + E)) using BFS. For large networks, this is expensive; in practice, heuristics (sampling sources, or using the network’s known structure) are used.

Worked Example: 2025 Q8 Graph

Graph: A–B, A–E, B–C, B–F, C–D, C–F, D–F, D–H, F–G, G–H.

Longest shortest path: from E (a leaf at one extreme) to H (near the other extreme).

Path: E → A → B → C → D → H = 5 steps.

Verification:

  • E → A: 1 step
  • A → B: 2 steps
  • B → C: 3 steps
  • C → D: 4 steps
  • D → H: 5 steps

Could there be a shorter path? No — E must reach A first (only neighbour). From A, the shortest path to H must go via B, then C, then D (or via F, G: A → B → F → G → H, which is also 5 steps).

Alternate check: E → A → B → F → G → H = 5 steps. Same length.

Diameter=5\text{Diameter} = 5

Other long paths: A–G is 4 (A → B → F → G); A–H is 4 (A → B → C → D → H or A → B → F → G → H). E is the most peripheral node.

Giant Component

Definition: in a large random graph, above a certain edge-density threshold, a single connected component emerges containing a significant fraction (a constant proportion) of all nodes. This is the giant component.

Properties:

  • Below the percolation threshold: only small, fragmented components exist (size O(logN)O(\log N)).
  • At the threshold: a phase transition occurs — the largest component suddenly jumps from O(logN)O(\log N) to O(N)O(N).
  • Above the threshold: the giant component grows to include most nodes; the remaining nodes form small, disconnected clusters.

In Erdős-Rényi graphs: the percolation threshold is at k=1\langle k \rangle = 1 (average degree = 1). Below this, no giant component; above it, a giant component emerges and grows.

Relevance to Real Networks

Most real-world networks contain a giant component:

  • Facebook’s friend graph: the largest connected component includes the vast majority of active users.
  • The Web’s bow-tie structure: the strongly connected core (SCC) is the giant component of the directed Web graph.
  • Citation networks: most papers belong to one giant citation component spanning all of science; isolated papers exist in niche fields.

Networks without a giant component are unusual and typically indicate fragmentation (e.g., separate language communities on Twitter that never interact).

Relationship to Network Robustness

The existence and size of the giant component is the key robustness metric:

  • Robust network: the giant component survives despite random node removal.
  • Fragile network: removing a few critical nodes destroys the giant component, splitting the network into many small fragments.

Power-law networks: removing the top 5% highest-degree hubs eliminates the giant component, because hubs are the glue holding the sparse low-degree nodes together.

Random (Erdős-Rényi) networks: require removing a much larger fraction of nodes (~50–80%) to destroy the giant component, because there are no extreme hubs. The damage is more evenly distributed.

Newman-Girvan and the Giant Component

The Newman-Girvan algorithm deliberately breaks the giant component into smaller, densely-connected clusters by removing the edges with highest betweenness. The algorithm stops when the desired number of connected components (clusters) is reached, each of which is ideally smaller and more cohesive than the original giant component.

Summary

ConceptDefinitionExample
Diametermaxs,td(s,t)\max_{s,t} d(s,t)5 (E → A → B → C → D → H)
Giant componentLargest connected component, containing fraction 0\gg 0 of nodesFacebook’s main friend graph
Percolation thresholdEdge density at which giant component first appearsk=1\langle k \rangle = 1 in Erdős-Rényi
Robustness metricDoes giant component survive node removal?Power-law: fragile to hub attack
Newman-GirvanDeliberately breaks giant component into clustersCommunity detection

Past paper questions: y2020p3q9, y2025p3q8