VOOZH about

URL: https://www.geeksforgeeks.org/engineering-mathematics/cliques-in-graph/

⇱ Cliques in Graph - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Cliques in Graph

Last Updated : 18 Dec, 2025

A clique in an undirected graph is a set of vertices where every pair of distinct vertices is connected, forming a complete subgraph.

👁 what_is_a_clique_
Cliques in Graph

Cliques are a fundamental concept in graph theory with applications in social networks, bioinformatics, and optimization. The Maximum Clique problem, which aims to find the largest clique in a graph, is NP-complete, making it computationally challenging.

Analysis

The Max-Clique problem analysis is a non-deterministic algorithm. In this approach, we first try to find a collection of k different vertices, and then we see if these vertices form a complete graph. This issue cannot be solved using a polynomial-time deterministic method. This is an NP-Complete issue.

To discover a maximum clique, one can scan all subsets methodically, but this brute-force search is extremely time-consuming for large graphs.

A maximal clique of a graph G is a clique that cannot be enlarged. The clique number ω(G) is the number of vertices in the graph's greatest clique. A k-clique is a clique of size k, where 0-cliques represent the empty set, 1-cliques represent vertices, 2-cliques represent edges, and 3-cliques represent 3-cycles.

A graph G's clique polynomial is defined as

where is the number of cliques of size k, with equal to the vertex count of G, equal to the edge count of G, etc.


Example 1 (Clique):
All vertices A,B,C,D are directly connected to each other, so the graph forms a complete graph, which is a clique.

Example 2 (Not a Clique):
Vertices A,B,C form a clique, but adding D breaks completeness since D is not connected to all others, so the entire graph is not a clique.

Example 3 (Graph with Two Cliques):
{A,B,C,D} is one clique and {X,Y,Z} is another clique; they are connected by a single edge but remain separate cliques.

Theorems Concerning Clique

  • Turan's theorem constrains the size of a clique in dense networks. A huge clique must exist if a graph has a sufficient number of edges. For example, every network with n vertices and more than edges must have a three-vertex clique.
  • According to Ramsey's theorem, any graph or its complement graph has a clique with at least a logarithmic number of vertices.
  • Moon and Moser (1965) discovered that a network with 3n vertices can only contain 3n maximum cliques. The Moon-Moser graphs are those that meet this constraint.

Cliques can be used to identify graph classes:

  • A cluster graph is a graph with cliques as its linked components.
  • A block graph is a graph with cliques as biconnected components.
  • A chordal graph is one in which the vertices may be arranged into a perfect elimination ordering, in which the neighbors of each vertex v that occur later than v in the ordering form a clique.
  • A cograph is a graph in which all of its induced subgraphs intersect any maximum clique in a single vertex.
  • An interval graph is one in which the maximum cliques may be arranged in such a manner that the cliques containing v are successive in the ordering for each vertex v.
  • A line graph is one with edges that may be covered by edge-disjoint cliques so that each vertex belongs to exactly two of the cliques in the cover.
  • A perfect graph is one in which the clique number in each induced subgraph equals the chromatic number.
  • A split graph is one in which at least one endpoint of each edge is contained within a clique.
  • A triangle-free graph is one with no cliques besides its vertices and edges.

Clique Problem

The clique problem involves locating cliques in a graph. Common formulations include:

  • Finding a maximum clique
  • Finding a maximum weight clique
  • Listing all maximal cliques
  • Checking if a clique of size k exists

Most variants are computationally difficult. The decision version is NP-complete, and listing all maximal cliques may take exponential time.

Identifying a single maximum clique

A simple greedy method starts with a vertex and grows the clique by adding vertices that are adjacent to all current clique members. For each vertex v examined by this loop, add v to the clique if it is near to every vertex currently in the clique, else dismiss v. This algorithm is linear in time and finds a maximal clique, not necessarily a maximum clique.

Fixed-size cliques

Using a brute force technique, one can test whether a graph G contains a k-vertex clique by examining all subgraphs with k vertices. There are O(nk) such subgraphs, and each requires checking O(k2) edges, resulting in O(nk k2) time complexity. When k is fixed, the problem is solvable in polynomial time. If k varies with the input, the time complexity becomes exponential.

Applications of Cliques

In graph theory, a clique is a subset of vertices where every two vertices are directly connected. Cliques have several important applications:

Social Network Analysis: Cliques help identify close-knit groups in social networks, such as circles of friends or professional connections. They are used for community detection and influence analysis.

Bioinformatics: In protein-protein interaction networks, cliques represent protein complexes. In gene expression networks, they help identify groups of genes that are co-expressed, indicating potential functional relationships.

Computer Vision: Cliques are used in object recognition by analyzing feature-matching graphs. They also assist in image segmentation by grouping similar pixels or regions together.

Data Mining: In market basket analysis, cliques help find sets of items frequently purchased together. They are also used in fraud detection, where tightly connected fraudulent activities can be identified.

Solved Problems on Cliques

Question 1: How does one locate a clique in a graph?

Answer:

To locate a G clique:
Let's say G has n vertices.
Find the minimum feasible degree vertex v in G.
If v has a degree of n 1, stop; G is a clique, and the greatest clique in G has a size of n.
Otherwise, delete v as well as all of its edges from G. In the smaller graph, find the greatest clique.

Question 2: What is the number of cliques in a graph?
Answer:

A full graph is commonly referred to as a clique. The clique number of G is the size of the largest clique that can be formed from G's edges and vertices. The penultimate assertion preceding these definitions may consequently be written as follows: a graph's coloring number is at least its clique number.

Question 3: Is it possible for a graph to have several cliques?
Answer:

If the complement is bipartite, the graph may be partitioned into two sets U and V, with no edge linking vertices from the same set. This indicates that these sets U and V are totally related in the original graph. As a result, the original graph may be partitioned into two Cliques.

Question 4: How many 2-cliques (edges) are there in a graph with edges AB, AC, AD, BC?

Answer:

The graph has 4 edges, which each represent a 2-clique. Thus, there are 4 2-cliques.

Related Articles:

Comment