Calculate global or local clustering coefficient for a simple, undirected, unweighted graph from triangles, connected triplets, node degree, neighbor links, or a degree sequence.

For a simple, undirected, unweighted graph.

Count each center with a pair of neighbors, including closed triplets.

Clustering Coefficient Formula

Local clustering coefficient for a node with degree k and e links among its neighbors:

Cᵢ = 2e / (k × (k - 1))

Global clustering coefficient (transitivity) for the whole network:

C = 3 × (number of triangles) / (number of connected triplets)

Connected triplets from a degree sequence:

Triplets = Σ kᵢ × (kᵢ - 1) / 2
  • k — degree of the node (number of neighbors)
  • e — actual edges between that node’s neighbors
  • k(k − 1)/2 — maximum possible edges among k neighbors
  • Triangle — three nodes all connected to each other
  • Connected triplet — any node with two distinct neighbors (open or closed)

Each triangle contains three closed triplets, which is why the global formula multiplies triangles by three. The local formula requires k ≥ 2, since a node with one or zero neighbors has no possible neighbor pairs. Both coefficients return values between 0 and 1 when the denominator is positive. Degree sequences are checked for graphical validity, but aggregate checks do not prove that a supplied triangle count is realizable. Global transitivity is not the average of local coefficients.

Reference Values

Network type alone does not determine a universal clustering range:

Network Type Clustering context
Random graph (Erdős–Rényi)≈ p (edge probability)
Social networksDepends on graph and definition
Collaboration networksDepends on graph and definition
Web / hyperlink graphsDirected hyperlink graphs require a specified directed definition
Biological (protein interaction)Depends on graph and definition
Lattice / regular graphDepends on the lattice and neighborhood

The numeric ranges below describe fractions, not universal quality categories:

Value Interpretation
C = 0No supplied triplets are closed; locally, no neighbor links exist
0 < C < 0.3More than 0% and less than 30%
0.3 ≤ C < 0.6At least 30% and less than 60%
C ≥ 0.6At least 60% of the relevant denominator
C = 1Locally, every neighbor pair is linked; globally, every connected triplet is closed

Worked Examples

Example 1 — Local coefficient. A node has 4 neighbors and 3 links among those neighbors.

  • Possible neighbor links = 4 × 3 / 2 = 6
  • C_i = 3 / 6 = 0.5000

Example 2 — Global coefficient. A graph has 12 triangles and 90 connected triplets.

  • Closed triplets = 3 × 12 = 36
  • C = 36 / 90 = 0.4000

Example 3 — From a degree sequence. Degrees [2, 3, 3, 1, 1] with 1 triangle.

  • Triplets = 1 + 3 + 3 + 0 + 0 = 7
  • C = 3 / 7 ≈ 0.4286

FAQ

What is the difference between local and global clustering? Local C measures one node’s neighborhood. Global C (transitivity) summarizes the whole network in a single number.

Why does my node need degree ≥ 2? A node with one neighbor has no neighbor pairs, so the denominator k(k − 1)/2 is zero and the coefficient is undefined.

Triangles or closed triplets — which should I enter? Either works. The calculator multiplies triangles by 3 internally to get closed triplets. Use whichever count you already have. A whole-graph closed-triplet count must be a multiple of three.

Can the coefficient exceed 1? No. If you get a value above 1, your closed-triplet or triangle count is inconsistent with your triplet count.