Open In App

Cliques in Graph

Last Updated : 20 Jul, 2022
Improve
Improve
Like Article
Like
Save
Share
Report

A clique is a collection of vertices in an undirected graph G such that every two different vertices in the clique are nearby, implying that the induced subgraph is complete. Cliques are a fundamental topic in graph theory and are employed in many other mathematical problems and graph creations. Despite the fact that the goal of determining if a clique of a certain size exists in a network (the clique issue) is NP-complete, various methods for detecting cliques have been researched. A maximum clique is one that cannot be enlarged by adding one more neighboring vertex, i.e. one that does not reside only within the vertex set of a bigger clique.

A clique in an undirected graph is a complete subgraph of the given graph. A complete sub-graph is one in which all of its vertices are linked to all of its other vertices. The Max-Clique issue is the computational challenge of locating the graph’s maximum clique. Many real-world issues make use of the Max clique. Consider a social networking program in which the vertices in a graph reflect people’s profiles and the edges represent mutual acquaintance. A clique in this graph indicates a group of people who all know each other.

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 type of brute-force search is extremely time-consuming for networks with more than a few hundred vertices.

A maximal clique of a graph, G, is a clique in which no clique has more vertices. Furthermore, the clique number ω(G) of a graph G is the number of vertices in the graph’s greatest clique. Cliques appear in a variety of fields of graph theory and combinatorics, including graph coloring and error-correcting coding theory. A k-clique is a clique of size k. (though this term is also sometimes used to mean a maximal set of vertices that are at a distance no greater than k from each other). 0-cliques represent the empty set (sets of 0 vertices), 1-cliques represent vertices, 2-cliques represent edges, and 3-cliques represent 3-cycles.

A graph G’s clique polynomial is defined as

C_{G} (x)= \sum_{k=0}^{w(G)} c_{k} x^{k}

where ck is the number of cliques of size k, with c0=1, c1=|G| equal to the vertex count of G, c2=m(G) equal to the edge count of G, etc.

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 \frac {n}{2}. \frac{n}{2} 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.

What is the Clique Problem?

The clique issue is a computer challenge that involves locating cliques in a graph. It has multiple formulations based on which cliques should be located and what information about the cliques should be obtained.
Finding a maximum clique, finding a maximum weight clique in a weighted graph, listing all maximal cliques, and solving the decision issue of checking if a graph has a clique greater than a particular size are all common formulations of the clique problem.

The majority of clique issue variants are difficult. The clique choice issue (one of Karp’s 21 NP-complete problems) is NP-complete. Finding the greatest clique is both fixed-parameter intractable and difficult to estimate. Furthermore, listing all maximal cliques may take exponential time since there are graphs with exponentially many maximal cliques.

Identifying a single maximum clique

A basic greedy method can find a single largest clique. Growing the current clique one vertex at a time by looping over the graph’s remaining vertices, starting with an arbitrary clique (for example, any single vertex or even the entire set). 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. Because of the simplicity with which maximal cliques may be found, as well as their possible modest size, more attention has been paid to the far more difficult algorithmic challenge of finding a maximum or otherwise big clique than to the difficulty of finding a single maximal clique.

Fixed-size cliques

Using a brute force technique, one may test if a graph G has a k-vertex clique and locate any such clique that it does. This method inspects each subgraph with k vertices to see if it constitutes a clique. It takes O(nkk2) time, as represented in large O notation. This is due to the fact that there are O(nk) subgraphs to examine, each with O(k2) edges whose presence in G must be verified. As a result, when k is a fixed constant, the issue can be solved in polynomial time. When k does not have a set value and instead might fluctuate as part of the problem’s input, the time is exponential.

What are Clique’s applications?

Consider a social network in which the vertices represent persons and the edges indicate mutual acquaintance. Then a clique represents a subset of people who all know each other, and clique-finding algorithms may be used to locate these groupings of common friends.

In bioinformatics, the clique problem has several applications. For example, Ben-Dorr, Shamir, and Yakima (1999) characterize the issue of grouping gene expression data as a search for the smallest number of modifications required to turn a graph describing the data into a graph formed by the disjoint union of cliques.

Sample Question

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.



Similar Reads

Find all cliques of size K in an undirected graph
Given an undirected graph with N nodes and E edges and a value K, the task is to print all set of nodes which form a K size clique. A clique is a complete subgraph of a graph.Examples: Input: N = 5, edges[] = { {1, 2}, {2, 3}, {3, 1}, {4, 3}, {4, 5}, {5, 3} }, K = 3 Output: 1 2 3, 3 4 5 Explanation: Clearly from the image, 1->2->3 and 3->4
11 min read
Count the number of Prime Cliques in an undirected graph
Given a graph with N nodes and E edges, the task is to count the number of clique having their size as a prime number or prime number of nodes in the given graph. A clique is a complete subgraph of a given graph. Examples: Input: N = 5, edges[] = { {1, 2}, {2, 3}, {3, 1}, {4, 3}, {4, 5}, {5, 3} } Output: 8 Explanation: In the given undirected graph
13 min read
Find the Number of Cliques in a Graph
In graph theory, a clique is a subset of vertices of an undirected graph such that every two distinct vertices in the clique are adjacent, that is, they are connected by an edge of the graph. The number of cliques in a graph is the total number of cliques that can be found in the graph. The Mathematics behind cliques in a graph involves the concept
15 min read
Two Clique Problem (Check if Graph can be divided in two Cliques)
A Clique is a subgraph of graph such that all vertices in subgraph are completely connected with each other. Given a Graph, find if it can be divided into two Cliques. Examples: Input : G[][] = {{0, 1, 1, 0, 0}, {1, 0, 1, 1, 0}, {1, 1, 0, 0, 0}, {0, 1, 0, 0, 1}, {0, 0, 0, 1, 0}}; Output : Yes This problem looks tricky at first, but has a simple and
13 min read
Detect cycle in the graph using degrees of nodes of graph
Given a graph, the task is to detect a cycle in the graph using degrees of the nodes in the graph and print all the nodes that are involved in any of the cycles. If there is no cycle in the graph then print -1. Examples: Input: Output: 0 1 2 Approach: Recursively remove all vertices of degree 1. This can be done efficiently by storing a map of vert
11 min read
Convert the undirected graph into directed graph such that there is no path of length greater than 1
Given an undirected graph with N vertices and M edges and no self loops or multiple edges. The task is to convert the given undirected graph into a directed graph such that there is no path of length greater than 1. If it is possible to make such a graph then print two space-separated integers u and v in M lines where u, v denotes source and destin
10 min read
Maximum number of edges that N-vertex graph can have such that graph is Triangle free | Mantel's Theorem
Given a number N which is the number of nodes in a graph, the task is to find the maximum number of edges that N-vertex graph can have such that graph is triangle-free (which means there should not be any three edges A, B, C in the graph such that A is connected to B, B is connected to C and C is connected to A). The graph cannot contain a self-loo
4 min read
Convert undirected connected graph to strongly connected directed graph
Given an undirected graph of N vertices and M edges, the task is to assign directions to the given M Edges such that the graph becomes Strongly Connected Components. If a graph cannot be converted into Strongly Connected Components then print "-1". Examples: Input: N = 5, Edges[][] = { { 0, 1 }, { 0, 2 }, { 1, 2 }, { 1, 4 }, { 2, 3 }, { 3, 4 } } Ou
14 min read
Java Program to Find Independent Sets in a Graph using Graph Coloring
Independent sets are set of vertices or edges in which the pair of any two vertices or edges are not adjacent to each other. Assuming that Independent sets mean Independent sets of vertices, we have to find a set of such vertices in which any two pairs of the vertex are not adjacent to each other. Using graph coloring we can solve this problem. We
13 min read
Connect a graph by M edges such that the graph does not contain any cycle and Bitwise AND of connected vertices is maximum
Given an array arr[] consisting of values of N vertices of an initially unconnected Graph and an integer M, the task is to connect some vertices of the graph with exactly M edges, forming only one connected component, such that no cycle can be formed and Bitwise AND of the connected vertices is maximum possible. Examples: Input: arr[] = {1, 2, 3, 4
9 min read
Practice Tags :