# Dense subgraph

In graph theory and computer science, a dense subgraph is a subgraph with many edges per vertex. This is formalized as follows: let G = (V, E) be an undirected graph and let S = (V$_S$, E$_S$) be a subgraph of G. Then the density of S is defined to be:
    $d(S)={|E_{S}| \over |V_{S}|}$
The density of the maximally dense subgraph of a graph is sometimes referred to as its subgraph density. A subgraph with maximal density can also be seen as a subgraph with maximal average degree in the graph.
Subgraph density is asymptotic to the related notion of arboricity and to graph degeneracy.

## Densest subgraph

The densest subgraph problem is that of finding a subgraph of maximum density. In 1984, Andrew V. Goldberg developed a polynomial time algorithm to find the maximum density subgraph using a max flow technique. This has been improved by Gallo, Grigoriadis and Tarjan in 1989 to run in O(nm log(n$^2$/m)) time. A simple LP for finding the optimal solution was given by Charikar in 2000.
Many of the exact algorithms for solving the densest subgraph problem are impractical on real-world data, which has led to the study of approximation algorithms for the densest subgraph problem. A simple 1/2 {\textstyle {\frac {1}{2}}} approximation for finding the densest subgraph was given by Charikar in 2000, based on a peeling procedure which was first proposed by Asahiro, Iwama, Tamaki, and Tokuyama in 1996 as an approximation algorithm for the densest $k$ subgraph problem. In this algorithm, the vertex with the lowest degree is repeatedly removed, creating an ordering of vertices $v_{1},v_{2},\dots ,v_{n}$, where $v_{i}$ is the $i$th vertex in the graph to be removed. The subgraph returned by the algorithm is the graph induced by the set $S_{i}=\{v_{i},v_{i+1},\dots ,v_{n}\}$ with the highest density. By using the dual of the LP for the exact algorithm he provided, Charikar proved that this procedure runs in linear time and yields a subgraph with at least 50% of the optimal density. Though 50% is a tight bound, in practice, this greedy peeling procedure yields about 80% of the optimal density on real-world graphs.
In 2020, Boob et al. gave an iterative peeling algorithm that aims to get closer to the optimal subgraph by repeated the peeling procedure multiple times. Instead of removing the vertices based on their current degree, a load is assigned to each vertex based on data from previous iterations, and vertices are peeled based on their loads. In 2022, Chekuri, Quanrud, and Torres proved that this procedure converges to a $(1-\epsilon )$ approximation for the densest subgraph problem after O(Δlog⁡n/λ$^∗$ϵ$^2$){\textstyle O({\frac {\Delta \log n}{\lambda ^{*}\epsilon ^{2}}})} iterations of the algorithm, where λ$^∗${\textstyle \lambda ^{*}} is the optimal density and $\Delta$ is the maximum degree in the graph. They also showed that a similar algorithm could be used to find densest hypergraphs.

## Densest k subgraph

There are many variations on the densest subgraph problem. One of them is the densest k subgraph problem, where the objective is to find the maximum density subgraph on exactly k vertices. This problem generalizes the clique problem and is thus NP-hard in general graphs. There exists a polynomial algorithm approximating the densest k subgraph within a ratio of $n^{1/4\,+\,\epsilon }$ for every $\epsilon >0$, while it does not admit an $n^{1/\!\operatorname {polyloglog} n}$-approximation in polynomial time unless the exponential time hypothesis is false. Under a weaker assumption that ${\mathsf {NP}}\nsubseteq \bigcap _{\epsilon >0}{\mathsf {BPTIME}}(2^{n^{\epsilon }})$, no PTAS exists for the problem.
The problem remains NP-hard in bipartite graphs and chordal graphs but is polynomial for trees and split graphs. It is open whether the problem is NP-hard or polynomial in (proper) interval graphs and planar graphs; however, a variation of the problem in which the subgraph is required to be connected is NP-hard in planar graphs.

## Densest at most k subgraph

The objective of the densest at most $k$ problem is to find the maximum density subgraph on at most $k$ vertices. Andersen and Chellapilla showed that if there exists an $\alpha$-approximation for this problem then that will lead to an $\Theta (\alpha ^{2})$-approximation for the densest $k$ subgraph problem. Later, this was improved by Khuller and Saha who showed that an $\alpha$-approximation for densest at most $k$ subgraph implies a $4\alpha$-approximation for the densest $k$ subgraph problem.

## Densest at least k subgraph

The densest at least $k$ problem is defined similarly to the densest at most $k$ subgraph problem. The problem is NP-complete, but admits 2-approximation in polynomial time. Moreover, there is some evidence that this approximation algorithm is essentially the best possible: assuming the small set expansion hypothesis (a computational complexity assumption closely related to the unique games conjecture), then it is NP-hard to approximate the problem to within $(2-\epsilon )$ factor for every constant $\epsilon >0$.

## K-clique densest subgraph

Charalampos Tsourakakis introduced the $k$-clique densest subgraph problem. This variation of the densest subgraph problem aims to maximize the average number of induced $k$ cliques $d_{k}(S)={|C_{k}(S)| \over |V_{S}|}$, where $C_{k}(S)$ is the set of $k$-cliques induced by $S$. Notice that the densest subgraph problem is obtained as a special case for $k=2$. This generalization provides an empirically successful poly-time approach for extracting large near-cliques from large-scale real-world networks.

## Locally top-k densest subgraph

Qin et al. introduced the problem of top-k locally densest subgraphs discovery in a graph, each of which achieves the highest density in its local region in the graph: it is neither contained in any supergraph with the same or larger density, nor it contains subgraphs with density being loosely connected with the rest of the local densest subgraph. Note that the densest subgraph problem is obtained as a special case for $k=1$. The set of locally densest subgraphs in a graph can be computed in polynomial time.