A More Complicated Hardness Proof for Finding Densest Subgraphs in Bounded Degree Graphs
Abstract
We consider the DensestSubgraph problem, where a graph and an integer is given and we search for a subgraph on exactly vertices that induces the maximum number of edges. We prove that this problem is NPhard even when the input graph has maximum degree three.
1 Introduction
We consider the following problem.
DensestSubgraph:
Input: A graph , and a nonnegative integer .
Task: Find a vertex set of size exactly such that has maximum number of edges.
We call every vertex set with a solution for this particular instance. DensestSubgraph is clearly a fundamental problem and has received much attention in the literature [7, 6, 1, 4]. In particular, this problem has been proven NPhard in various variants. We prove that DensestSubgraph remains NPhard on graphs of degree at most three. While this result has been proven before [5], we show it in a much more complicated manner. More precisely, we first give a reduction from Clique to DensestSubgraph with maximum degree five, proving its correctness through an intricate replacement argument. Then we successively reduce the maximum degree by replacing each highdegree vertex by gadget graphs. We prove that, for some optimal solution , each gadget graph is either fully contained in or not at all. This is done using elaborate casedistinctions which are most tedious to verify. We note that the previous proof is essentially contained within two pages. Our proof needs eight pages.
Preliminaries.
We use standard graph notation as used, for example, by Diestel [2]. Where it is appropriate, we denote and .
2 NPhardness of DensestSubgraph in Graphs with Maximum Degree Three
Our proof of NPhardness is divided into three steps. We first show that DensestSubgraph is NPhard in graphs with maximum degree at most five. Then, we proceed to reduce the maximum degree in hard instances. We successively employ two gadgets that replace vertices in the input graph, giving hardness in graphs with degree at most four and then hardness in graphs with degree at most three.
Lemma 2.1.
DensestSubgraph is NPhard even on graphs with maximum degree five.
Proof.
Let be an instance of Clique and without loss of generality assume that is an odd square number. The construction is as follows. For every vertex in introduce a quadratic grid graph with vertices. In order to simplify the analysis, identify vertices with degree three on opposite boundaries, creating a grid model of a torus in which every vertex has degree exactly four. More formally, is the graph with vertex set
and edge set
Let be a bijection and let
For every edge connect the tori and by an “intertorus” edge between the vertices and . Call the graph that is constructed in this way and set the instance of DensestSubgraph ^{1}^{1}todo: 1DensestSubgraph!?to . Clearly, this construction can be carried out in polynomial time. We decide to be a yesinstance if and only if an optimal solution of contains at least edges.
For the correctness, first, observe that contains a subgraph of with edges if contains a clique with vertices: for every vertex in the clique choose every vertex of the torus . For the other direction, we prove that every optimal solution to comprises a collection of complete tori. That is, if an optimal solution contains a vertex of one of the tori , every vertex of is in the solution. Then it is clear that if the optimal solution contains edges, the vertices in that correspond to a torus in the optimal solution must induce a clique on vertices.
An optimal solution to consists of a number of possibly proper vertex subsets of the tori, altogether containing exactly vertices. For the sake of contradiction assume that at least one of these vertex subsets is proper, that is, not all of the vertices of some torus are contained in . Call the vertices in “black” and the vertices in “white”. Call edges between black and white vertices within one torus “cut”. Call tori with at most black vertices “small” and the remaining tori “large”. We prove the following.
Claim: In each small torus , there are at least twice as many cut edges as there are intertorus edges incident with black vertices of .
Before proving the claim, we note that it implies the lemma. There are at most large tori, that is, for every sufficiently large^{1}^{1}1The relation holds if and only if . Since is strictly monotone ascending for and equality holds for , we have that for all . We can assume this without loss of generality. , there are at most large tori. Consider distributing all black vertices of small tori to large tori, completing them in the process, and combining the remaining black vertices in small tori to complete tori. This procedure cannot decrease the number of edges induced by the black vertices: All intertorus edges between large tori are preserved and for every intertorus edge incident with a black vertex of a small torus, there were at least two cut edges, and thus, at least one edge is added to the solution. (Observe that after this procedure, there are no cut edges remaining.) Furthermore, after this procedure, each black vertex has at least four black neighbors within its torus, whereas before it had at most four. Thus, we may assume that there are no incomplete tori and the correctness of our construction follows.
We prove our claim using the following result by Efe and Feng [3].
Fact: In order to remove vertices from a quadratic grid with vertices, where is odd, at least edges have to be cut.
It is clear that in a torus with the same number of vertices at least as many edges have to be cut.^{2}^{2}2Consider removing a set of vertices from a quadratic grid and then removing it from a torus on the same vertices as the grid. The number of cut edges incident with each vertex differ only for vertices that are removed from the boundary of the grid. But in the torus, these vertices have higher degree than in the grid. From this statement, our claim follows directly for tori with at least and at most vertices. Assume that there is a torus with black vertices. The number of cut edges is
Since there are at most intertorus edges incident with , there are at least twice as many cut edges as there are intertorus edges. The same follows analogously for tori with black vertices.
It remains to show the claim for tori with at most black vertices. Consider such a torus and call a vertex in to reside in “row” and in “column” . We show that incident with each connected component of black vertices in there are at least twice as many cut edges as there are intertorus edges incident with black vertices in . The claim then follows, since there are no cut edges that are incident with two of ’s black connected components. First, assume that contains each vertex of some row . Since contains at most black vertices, the number of columns in with fewer than black vertices is at least and this gives a lower bound on the number of cut edges incident with . Thus, since there are at most intertorus edges incident with , for every sufficiently large , there are at least twice as many cut edges as intertorus edges incident with . Analogously we can prove this, if contains each vertex of some column. Next, assume that does not contain complete rows or columns. If there is only one intertorus edge incident with , clearly there are always more than two cut edges. If there are at least two intertorus edges incident with , consider a shortest black path between these two edges. By the placement of the intertorus edges in , this path either touches at least rows or at least as many columns. Since there are no complete columns or rows in , is then a lower bound on the number of cut edges incident with . Thus, our claim now follows for all larger than some constant and our construction is correct. ∎
Next, we reduce the maximum degree in hard instances to four, by replacing each vertex with a “solid” gadget, that is, a gadget that can be assumed to be either completely contained in a solution or to be disjoint to it. Thus, in order to maximize the number of edges induced by a solution, one has to choose gadgets correspondingly to vertices in the original graph.
Lemma 2.2.
There is a polynomialtime manyone reduction from DensestSubgraph in graphs with maximum degree six or maximum degree five to DensestSubgraph in graphs with maximum degree four.
Proof.
Let be an instance of DensestSubgraph where each vertex in has degree at most six or at most five. We replace each vertex in by the graph shown in Figure 1 (the “fence gadget”) and distribute ’s edges to the outer vertices such that each vertex in the fence gadget gets degree at most four. Call the graph constructed in this way and set the new instance of DensestSubgraph ^{2}^{2}todo: 2DensestSubgraph!?to . We argue that from any solution to we can construct another solution with at least as many edges such that each fence gadget either is completely contained in or its vertices are disjoint to . Then, from any solution to with edges (there are edges in a gadget) we can construct a solution for with at least edges and viceversa by completing every gadget and then exchanging gadgets with their corresponding vertices. Thus, since it is easy to achieve at least edges in a solution for , finding an optimal solution or any solution with a number of edges above a given threshold is equivalent in these instances. It is also not hard to see, that constructing the solution for from a solution for can be done in polynomial time, we omit the details.^{3}^{3}todo: 3MS: Dürfen wir das? Das ist: höchstens mal iterieren zum Komplettieren der Gadgets. Darin: Immer wieder den Claim herstellen (mittels iterieren über alle Gadgets und Property 1 und 2 herstellen = ), und beim Komplettieren entsprechende Austauschknoten finden = auf jeden Fall . Wäre unschön, den Text noch mehr vollzustopfen. Oder einen Extraabsatz ganz am Ende dazu?
Let be a solution for . Call the vertices in “black” and the remaining ones “white”. The blackdegree of a vertex is the number of black vertices adjacent to it. Call edges between two black vertices “black” and the remaining edges “nonblack”. We consider fence gadgets that are partially black and argue that we can move black vertices between gadgets without losing edges, ultimately completing all gadgets. To do this, we prove the following.
^{4}^{4}todo: 4MS: Ich finde es besser, erst zu zeigen, wie man den Claim anwendet und ihn dann zu beweisen. Egal wierum man es macht, man muss immer scrollen; entweder ist die Figure mit dem Gadget nicht da, oder der Claim selbst, wenn man ihn anwendet. Aber bei der Variante den Claim erst hinterher zu beweisen, verliert man imho weniger Motivation beim Beweislesen, weil man erst sieht, warum der Claim so aussieht, wie er aussieht, und nicht erst irgendeine Aussage überprüfen muss, von der man keine Ahnung hat, wie sie angewendet wird oder einen weiterbringt.Claim: Given a solution , we can modify without losing black edges and without changing the number of black vertices in any fence gadget such that the following holds.
For it holds that in each fence gadget with exactly white vertices, there are at least nonblack edges.
For it holds that in each fence gadget with at least black vertices and at least white vertices, there is a set of black vertices in the gadget that is incident with at most black edges (counting both innergadget edges and edges between gadgets).
Each fence gadget with exactly four white vertices has at least eight nonblack edges (within the gadget) and a set of four black vertices that is incident with at most eight black edges (both within and outside of the gadget).
Each fence gadget with exactly black vertices contains a black vertex with blackdegree at most two.
We first show how this claim can be used to complete all gadgets in . Assume that the claim holds. We show how we can make gadgets completely black that have some minimum number of white vertices other than . Let be the minimum number of white vertices in gadgets and let be a gadget with exactly white vertices.

Assume that . It follows that contains a white vertex that has at least three black neighbors and Part 2 of our claim tells us that we can color a vertex in another gadget white and color black without losing black edges.

Assume that . Then, either there are two gadgets with exactly one black vertex or there is a gadget with at least two black vertices and at least two white vertices. In the first case, we can color both black vertices of and white, losing at most two black edges in the process, and complete , gaining at least five black edges (Part 1 of the claim). In the second case, we use Part 2 to color two black vertices of white, losing at most five black edges and complete , gaining at least five black edges.

Assume that . Then, either we can use Part 2 or Part 4 of the claim to find three black vertices such that, if we color them white, we lose at most seven black edges. We color the found vertices white and complete the gadget without losing black edges by Part 1.

Assume that . Then, either we can find another gadget with exactly four white vertices and use Part 3 of our claim to color its vertices white and complete without losing black edges, or, if there is no other gadget with exactly four white vertices, by Part 4 of our claim, we can successively find four vertices each with blackdegree at most two, color them white and, after that, we can complete . We lose at most eight black edges, but gain at least eight by Part 3 of the claim.

Assume that . Observe that in a gadget with exactly three black vertices, the number of nonblack edges is at least ten. Thus, we can again apply Part 4 of our claim.

The case that is analogous to and the case is trivial.
To make each gadget either completely black or completely white, we first ensure that each part of the claim holds, then apply a modification as described above to complete the gadget and iterate. The modifications that are necessary for each part of the claim to hold do not change the number of black vertices in any gadget, and in each of the above cases, we modify such that the number of completely black gadgets increases. Thus, after at most steps, each gadget is either completely black or completely white, and the correctness of our construction follows if the claim holds.
Next, we prove the claim. We first prove that we can make two assumptions about the solution without loss of generality. We modify without losing edges and without changing the number of black vertices in any fence gadget such that the following holds.
Property 1: In every gadget, there is no white inner vertex that has at most one outer white neighbor and no white inner neighbor.
Assume that there is such a white inner vertex . If does not have a white outer neighbor, we may simply color one of its black outer neighbors white, losing at most three black edges and then color black, gaining at least three black edges. If has a white outer neighbor, then it has a black outer neighbor with blackdegree at most two. Thus, we can make white, losing at most two black edges, and make black, gaining at least two black edges.
Property 2: In every gadget with at most four white vertices, the white vertices induce a connected graph.
Consider a fence gadget with at least two white vertices. If there is a singleton white vertex , we color it black and color white a black neighbor of one of the other white vertices. In the exchange, if and are not neighbors, at most three black edges incident with are lost and at least three black edges incident with are gained. If and are neighbors, at most two black edges are lost and at least two black edges are gained. In the following, assume that there are no singleton white vertices. If there are exactly three white vertices that do not induce a connected graph, then there is at least one singleton white vertex. Hence, we may assume that there are at least four white vertices. We remove each maximal connected component with at most two white vertices: Observe that if both inner vertices are white, the white vertices always induce a connected graph. Thus, we may assume that there is only one inner white vertex and, by Property 1, has no inner vertices. We now know that if the white vertices do not induce a connected graph, there are at least four of them, the minimum size of a white connected component is two, each white connected component of size exactly two contains no inner vertices, and there is at most one white inner vertex. Without loss of generality, there are only two possible configurations left. Either the vertices or the vertices are white. In case one, we can make black and white, losing at most two black edges and gaining at least two black edges. In case two, we can color black and white. Property 2 now follows.
Notice that ensuring either property does not change the number of black vertices in the gadget. Furthermore, since ensuring Property 1 does not destroy Property 2, and since Property 1 does not depend on Property 2, we can modify the solution such that both statements hold simultaneously.
To prove Part 1 through 4 of the claim, we iterate through the the number of white vertices in a gadget, and show that each of the relevant statements hold; no further modifications are necessary. Let be a gadget with exactly white vertices.

The claim is trivial for .

Assume that . Both white vertices of have at least three incident nonblack edges. The neighborhood of the white vertices overlaps in at most one vertex, and, thus, we have at least nonblack edges, matching the given bound of Part 1 of the claim. Part 2 of the claim follows by choosing two black vertices in the neighborhood of the white vertices such that are neighbors. It is easily seen that such black vertices must exist.

Assume that .

If both inner vertices of are white, these two vertices alone have seven incident nonblack edges and Part 1 of the claim follows. For Part 2 and , we choose three consecutive black vertices on the cycle formed by the outer vertices. Each of these vertices has at most three incident black edges and the neighborhoods overlap in at most one vertex for neighboring vertices. Thus, these three vertices have at most incident black edges. If we are to choose only two black vertices, that is, , we elect the neighbors of the outer white vertex. Both these black vertices have blackdegree at most two. The case is trivial and Part 2 of the claim follows.

If exactly one inner vertex is white, then, by Property 1, it has two white outer neighbors. Without loss of generality, let the white vertices be . These three vertices have at least seven incident nonblack edges and the first part of the claim follows. Choosing the black vertices , , and yields at most , , and incident black edges, respectively. Thus, Part 2 of the claim follows.

Now, if all three white vertices are outer vertices, by Property 2, they form a connected component. Without loss of generality, there are only two possible configurations: , and , each yielding at least seven nonblack edges, fulfilling the first part of the claim. For Part 2, we choose , , and , yielding at most , , and incident black edges in the first configuration. For the second configuration, we choose , , and , yielding at most , , and incident black edges and, thus, Part 2 of the claim holds.


Now assume that .

If both inner vertices are white, they yield at least seven nonblack vertices plus at least two from one of the outer white vertices, satisfying the lower bound of Part 3 of the claim. For the upper bound on the number of black edges incident with some black vertices in Part 3, observe that there is a black vertex with blackdegree at most two (incident with one of the outer white vertices) and deleting it makes its black neighbor (if there is any) have blackdegree at most two. For the upper bound from Part 2 of our claim, analogously to , we choose three consecutive black vertices or, if this is not possible, neighbors of the white outer vertices. It is easy to check that Part 2 of the claim holds in this case.

Now assume that exactly one inner vertex is white. Then, by Property 1, it has at least two white outer neighbors. Without loss of generality, the only possible configurations are and . Each configuration yields at least eight nonblack edges. Since there are exactly edges in the gadget and at most three black vertices with edges, the upper bound of Part 3 of our claim follows. For the upper bound of Part 2, we choose , , and in configuration one, yielding at most , , and black edges, and , , and , yielding at most , , and edges.

Assume that every white vertex is an outer vertex. Then, by Property 2, they induce a connected graph. Thus, without loss of generality, the only possible configurations are through and through . The lower bound on the number of nonblack edges in Part 3 follows, since the vertices are incident with seven edges in the gadget and both and contribute at least one further nonblack edge. The upper bound on black edges from Part 3 follows, since there are at most black edges within the gadget and at most two black edges not within the gadget incident to and or , respectively. For Part 2 we may choose the vertices , , and , yielding at most , , and incident black edges in both configurations.


It remains to prove Part 2 and Part 4 of our claim for . The only nontrivial case is , that is, there are exactly three black vertices. Both Part 2 and Part 4 trivially follow, if the black vertices are not connected. If they are connected, they either form a triangle or a path. In the first case, at most two black vertices are incident with nongadget edges, and, thus, the remaining vertex has blackdegree at most two and the black vertices have at most five incident black edges. In the second case, there are two black vertices with blackdegree at most two and the black vertices have incident at most five black edges.
Thus, our claim follows, and our construction is correct. ∎
We now use the same strategy, albeit with a much simpler proof, replacing the vertices by a further gadget to further reduce the maximum degree in the input graph.
Lemma 2.3.
There is a polynomialtime manyone reduction from DensestSubgraph in graphs with maximum degree four to DensestSubgraph in graphs with maximum degree three.
Proof.
Let be an instance of DensestSubgraph where each vertex in has degree at most four. We replace each vertex in the graph by a fourvertex cycle (the “cycle gadget”), and distribute ’s edges to the vertices of the cycle such that each vertex in the cycle gets degree at most three. Call the graph constructed in this way . We set the new instance of DensestSubgraph to . We show ^{5}^{5}todo: 5MS: Was spricht gegen argue?that this construction is correct by showing that from any solution to we can construct a solution with at least as many edges such that the vertices of each cycle gadget are either completely contained in the solution or are disjoint. Thus, from any solution to with edges, we can construct a solution for with at least edges and viceversa. It is clear, that solutions for with at least edges are achievable in polynomial time, and it will also not be hard to check that we construct the solution for from a solution for in polynomial time. Thus, finding an optimal solution or any solution with a number of edges above some given threshold is polynomialtime equivalent in these instances.
Consider a solution to . We move vertices between gadgets that are not fully contained in , and ultimately achieve that each gadget is either completely contained in or disjoint to it. Furthermore, in the process the number of edges induced by does not decrease. We proceed stepwise, completing at least one gadget in each step. Observe first, that in each step, we may assume that incomplete gadgets contain at least two vertices from . Otherwise, we may simply move the vertices of from one gadget to another without losing edges induced by . Now, consider a cycle gadget containing exactly three vertices of , if there is any. Every incomplete cycle gadget has at least one vertex with degree at most two in . Thus, since there is at least one further incomplete cycle gadget, we may simply move such a low degree vertex to without losing edges. If there are no cycle gadgets with exactly three vertices, there remain only cycle gadgets with exactly two vertices in . However, since the vertices of these gadgets are incident with at most three edges in , we can move two vertices from one gadget to another without losing edges. This completes the description of one step. In each step, at least one gadget is completed, and after at most steps of moving vertices of between gadgets, we obtain a solution such that every cycle gadget is either completely contained in is disjoint to it. ∎
Combining the three lemmas of this section, the following is now easily obtained.
Theorem 2.1.
DensestSubgraph is NPhard even on graphs with maximum degree three.
3 Conclusion and Outlook
We have demonstrated that stubbornness not only may lead to the proof of a desired result. It also can be used to obtain much more complicated proofs of previously known ones. We leave it as an open question as to which elegant proofs can be reproved more elaborately and in a nontrivial way.
Acknowledgement.
I thank Christian Komusiewicz for insightful discussions about the matter of the paper and for proofreading.
References
 [1] B. Balasundaram, S. Butenko, and I. V. Hicks. Clique relaxations in social network analysis: The maximum plex problem. Oper. Res., 59(1):133–142, 2011.
 [2] R. Diestel. Graph Theory, volume 173 of Graduate Texts in Mathematics. Springer Verlag, New York, 4th edition, 2010.
 [3] K. Efe and G.L. Feng. A proof for bisection width of grids. International Journal of Mathematical and Computer Sciences, 4(3), 2008.
 [4] U. Feige, D. Peleg, and G. Kortsarz. The dense ksubgraph problem. Algorithmica, 29(3):410–421, 2001.
 [5] U. Feige and M. Seltser. On the densest subgraph problem. Technical report, The Weizmann Institute, Department of Applied Math and Computer Science, 1997.
 [6] H. Ito and K. Iwama. Enumeration of isolated cliques and pseudocliques. ACM Transactions on Algorithms, 5(4), 2009.
 [7] S. Kosub. Local density. In Network Analysis, volume 3418 of LNCS, pages 112–142. Springer, 2004.