ArticleslgStudy

computer science

Clustering coefficient

Clustering coefficient is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Clustering coefficient rather than just read about it. In short: In graph theory, a clustering coefficient is a measure of the degree to which nodes in a graph tend to cluster together. Evidence suggests that in most real-world networks, and in particular social networks, nodes tend to create tightly knit groups characterised by a relatively high density of ties; this likelihood tends to be greater than the average probability of a tie randomly established between two nodes (Holl…

Clustering coefficient — main illustration
Clustering coefficient — illustration

Key takeaways

  • Clustering coefficient belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Clustering coefficient to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Clustering coefficient from memory before moving on to harder problems.

Reference excerpt

In graph theory, a clustering coefficient is a measure of the degree to which nodes in a graph tend to cluster together. Evidence suggests that in most real-world networks, and in particular social networks, nodes tend to create tightly knit groups characterised by a relatively high density of ties; this likelihood tends to be greater than the average probability of a tie randomly established between two nodes (Holland and Leinhardt, 1971; Watts and Strogatz, 1998). Two versions of this measure exist: the global and the local. The global version was designed to give an overall indication of the clustering in the network, whereas the local gives an indication of the extent of "clustering" of a single node.

Local clustering coefficient The local clustering coefficient of a vertex (node) in a graph quantifies how close its neighbours are to being a clique (complete graph). Duncan J. Watts and Steven Strogatz introduced the measure in 1998 to determine whether a graph is a small-world network. A graph G=(V,E) formally consists of a set of vertices V and a set of edges E between them. An edge eij connects vertex vi with vertex vj. The neighborhood Ni for a vertex vi is defined as its immediately connected neighbours as follows:

Ni={vj:eij∈E∨eji∈E}. We define ki as |Ni|, the number of vertices in Ni, the neighbourhood of vertex vi. The local clustering coefficient Ci for a vertex vi is then given by a proportion of the number of links between the vertices within its neighbourhood divided by the number of links that could possibly exist between them. For a directed graph, eij is distinct from eji, and therefore for each neighbourhood Ni there are ki(ki−1) links that could exist among the vertices within the neighbourhood (ki is the number of neighbours of a vertex). Thus, the local clustering coefficient for directed graphs is given as

Ci=|{ejk:vj,vk∈Ni,ejk∈E}|ki(ki−1). An undirected graph has the property that eij and eji are considered identical. Therefore, if a vertex vi has ki neighbours, ki(ki−1)2 edges could exist among the vertices within the neighbourhood. Thus, the local clustering coefficient for undirected graphs can be defined as

Ci=2|{ejk:vj,vk∈Ni,ejk∈E}|ki(ki−1). Let λG(v) be the number of triangles on v∈V(G) for undirected graph G. That is, λG(v) is the number of subgraphs of G with 3 edges and 3 vertices, one of which is v. Let τG(v) be the number of triples on v∈G. That is, τG(v) is the number of subgraphs (not necessarily induced) with 2 edges and 3 vertices, one of which is v and such that v is incident to both edges. Then we can also define the clustering coefficient as

Ci=λG(v)τG(v). It is simple to show that the two preceding definitions are the same, since

τG(v)=C(ki,2)=12ki(ki−1). These measures are 1 if every neighbour connected to vi is also connected to every other vertex within the neighbourhood, and 0 if no vertex that is connected to vi connects to any other vertex that is connected to vi. Since any graph is fully specified by its adjacency matrix A, the local clustering coefficient for a simple undirected graph can be expressed in terms of A as:

Ci=1ki(ki−1)∑j,kAijAjkAki where:

ki=∑jAij and Ci=0 when ki is zero or one. In the above expression, the numerator counts twice the number of complete triangles that vertex i is involved in. In the denominator, ki2 counts the number of edge pairs that vertex i is involved in plus the number of single edges traversed twice. ki is the number of edges connected to vertex i, and subtracting ki then removes the latter, leaving only a set of edge pairs that could conceivably be connected into triangles. For every such edge pair, there will be another edge pair which could form the same triangle, so the denominator counts twice the number of conceivable triangles that vertex i could be involved in.

Global clustering coefficient The global clustering coefficient is based on triplets of nodes. A triplet is three nodes that are connected by either two (open triplet) or three (closed triplet) undirected ties. A triangle graph therefore includes three closed triplets, one centred on each of the nodes (n.b. this means the three triplets in a triangle come from overlapping selections of nodes). The global clustering coefficient is the number of closed triplets (or 3 x triangles) over the total number of triplets (both open and closed). The first attempt to measure it was made by Luce and Perry (1949). This measure gives an indication of the clustering in the whole network (global), and can be applied to both undirected and directed networks (often called transitivity, see Wasserman and Faust, 1994, page 243). The global clustering coefficient is defined as:

C=number of closed tripletsnumber of all triplets (open and closed). The number of closed triplets has also been referred to as 3 × triangles in the literature, so:

C=3×number of trianglesnumber of all triplets. A generalisation to weighted networks was proposed by Opsahl and Panzarasa (2009), and a redefinition to two-mode networks (both binary and weighted) by Opsahl (2009). Since any simple graph is fully specified by its adjacency matrix A, the global clustering coefficient for an undirected graph can be expressed in terms of A as:

C=∑i,j,kAijAjkAki12∑iki(ki−1) where:

ki=∑jAij and C=0 when the denominator is zero.

Network average clustering coefficient As an alternative to the global clustering coefficient, the overall level of clustering in a network is measured by Watts and Strogatz as the average of the local clustering coefficients of all the vertices n :

C¯=1n∑i=1nCi. This metric places more weight on the low degree nodes, while the transitivity ratio places more weight on the high degree nodes. A generalisation to weighted networks was proposed by Barrat et al. (2004), and a redefinition to bipartite graphs (also called two-mode networks) by Latapy et al. (2008) and Opsahl (2009). Alternative generalisations to weighted and directed graphs have been provided by Fagiolo (2007) and Clemente and Grassi (2018). This formula is not, by default, defined for graphs with isolated vertices; see Kaiser (2008) and Barmpoutis et al. The networks with the largest possible average clustering coefficient are found to have a modular structure, and at the same time, they have the smallest possible average distance among the different nodes.

… excerpt ends here. Continue reading the full article.

Worked examples

Example 1 — a first encounter with Clustering coefficient

Start with the simplest possible case. Write down what Clustering coefficient claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Clustering coefficient before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Clustering coefficient ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Clustering coefficient

In research
Clustering coefficient appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Clustering coefficient in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Clustering coefficient is common in secondary-school and first-year university syllabi. It links to neighbouring topics Algebraic graph theory, Graph invariants, Network analysis, so understanding it makes those chapters shorter.
In everyday life
Look for Clustering coefficient outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Clustering coefficient” →

How to study Clustering coefficient in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Clustering coefficient means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Clustering coefficient out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Clustering coefficient in simple terms?

In graph theory, a clustering coefficient is a measure of the degree to which nodes in a graph tend to cluster together. Evidence suggests that in most real-world networks, and in particular social networks, nodes tend to create tightly knit groups characterised by a relatively high density of ties…

Why does Clustering coefficient matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Clustering coefficient?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Clustering coefficient.

Tags

  • Algebraic graph theory
  • Graph invariants
  • Network analysis
  • Network theory

Keep exploring