 # Independent sets in (P_4+P_4,Triangle)-free graphs

The Maximum Weight Independent Set Problem (WIS) is a well-known NP-hard problem. A popular way to study WIS is to detect graph classes for which WIS can be solved in polynomial time, with particular reference to hereditary graph classes, i.e., defined by a hereditary graph property or equivalently by forbidding one or more induced subgraphs. Given two graphs G and H, G+H denotes the disjoint union of G and H. This manuscript shows that (i) WIS can be solved for (P_4+P_4, Triangle)-free graphs in polynomial time, where a P_4 is an induced path of four vertices and a Triangle is a cycle of three vertices, and that in particular it turns out that (ii) for every (P_4+P_4, Triangle)-free graph G there is a family S of subsets of V(G) inducing (complete) bipartite subgraphs of G, which contains polynomially many members and can be computed in polynomial time, such that every maximal independent set of G is contained in some member of S. These results seem to be harmonic with respect to other polynomial results for WIS on certain [subclasses of] S_i,j,k-free graphs and to other structure results on [subclasses of] Triangle-free graphs.

## Authors

##### This week in AI

Get the week's most popular data science and artificial intelligence research sent straight to your inbox every Saturday.

## 1 Introduction

For any missing notation or reference let us refer to .

For any graph , let and denote respectively the vertex-set and the edge-set of . Let be a graph. For any subset , let denote the subgraph of induced by . For any vertex-set , let is adjacent to some be the neighborhood of U in G. In particular: if , then let us simply write instead of ; for any vertex-set , with , let us write . For any vertex-set , let us say that is the anti-neighborhood of U in G. For any vertex and for any subset (with ), let us say that: if is adjacent to some vertex of ; is to if contacts but is non-adjacent to some vertex of ; is to if is adjacent to all vertices of .

A component of is a maximal connected subgraph of . A component of is if it is a singleton, and otherwise. A component-set of is the vertex set of a component of . A component-set of is if it is a singleton, and otherwise. A of is a set of pairwise adjacent vertices of . An independent set (or a stable set) of is a subset of pairwise nonadjacent vertices of . An independent set of is maximal if it is not properly contained in another independent set of .

A graph is -free, for a given graph , if contains no induced subgraph isomorphic to ; in particular is called a forbidden induced subgraph of . A graph class is hereditary if it is defined by a hereditary graph property or equivalently by forbidding a family of induced subgraphs. Given two graphs and , denotes the disjoint union of and ; in particular denotes the disjoint union of copies of .

A graph is if admits a partition such that and are independent sets of , i.e., such that ; in particular is complete bipartite if .

The following specific graphs are mentioned later. A has vertices and edges for . A has vertices and edges for and . A is a complete graph of vertices. A has vertices , and edges . A has vertices , and edges (then a Fork contains a Claw as an induced subgraph). A is the graph obtained from a Claw by subdividing respectively its edges into , , edges (e.g., is , is Claw).

The Maximum Weight Independent Set Problem (WIS) is the following: Given a graph and a weight function on , determine an independent set of of maximum weight, where the weight of an independent set is given by the sum of for . Let denote the maximum weight of any independent set of . The WIS problem reduces to the IS problem if all vertices have the same weight .

The WIS problem is NP-hard . It remains NP-hard under various restrictions, such as e.g. Triangle-free graphs  and more generally graphs with no induced cycle of given length [29, 35], cubic graphs  and more generally -regular graphs , planar graphs . It can be solved in polynomial time for various graph classes, such as e.g. -free graphs , bipartite graphs [1, 11, 20] and more generally perfect graphs , Claw-free graphs [12, 28, 30, 31, 38] and more generally Fork-free graphs [4, 24], -free graphs  and more generally -free graphs for any constant (by combining an algorithm generating all maximal independent sets of a graph  and a polynomial upper bound on the number of maximal independent sets in -free graphs [3, 14, 36]), Claw-free graphs , -free graphs , and more generally -free graphs for any constant , and -free graphs for any constant ; then recently, after many attempts, for -free graphs  and more generally for -free graphs .

Let us report the following result due to Alekseev [2, 5].

###### Theorem 1

 Let be a class of graphs defined by a finite set of forbidden induced subgraphs. If contains no graph every connected component of which is for some indices , then the (W)IS problem is NP-hard in the class .

Theorem 1 implies that (unless P = NP) for any graph , if WIS can be solved for -free graphs in polynomial time, then each connected component of is for some indices . Then Lozin  conjectured that WIS can be solved in polynomial time for -graphs for any fixed indices . The above allows one to focus on possible open problems, i.e., on possible graph classes for which WIS may be solved in polynomial time.

This manuscript shows that (i) WIS can be solved for (, Triangle)-free graphs in polynomial time, and that in particular it turns out that (ii) for every (, Triangle)-free graph there is a family of subsets of inducing (complete) bipartite subgraphs of , which contains polynomially many members and can be computed in polynomial time, such that every maximal independent set of is contained in some member of .

The class of -free graphs has been considered since, according to the above mentioned polynomial results and to possibly forthcoming similar polynomial results, it may be one of the next boundary graph classes for which the complexity of WIS is an open problem.

The class of Triangle-free has been considered in the context of similar previous manuscripts on other subclasses of Triangle-free graphs, namely, on (,Triangle)-free graphs  see  for an extension of this result and more generally on (,Triangle)-free graphs .

However let us observe that Lozin’s conjecture is open also for those -graphs for any fixed indices which in addition are Triangle-free recalling that WIS remains NP-hard for Triangle-free graphs that is for restricted and more studied graph classes. Let us mention just a recent strong result due to Pilipczuk et al.  stating that graphs containing no Theta [a is a graph made of three internally vertex-disjoint chordless paths , , of length at least 2 and such that no edges exist between the paths except the three edges incident to and the three edges incident to ], no Triangle, and no as induced subgraphs for any fixed indices have bounded treewidht, which implies that a large number of NP-hard problems can be solved in polynomial time for such graphs, in particular the WIS problem.

## 2 Independent sets in (P4+p4, Triangle)-free graphs

In this section let us show that WIS can be solved for (, Triangle)-free graphs in polynomial time.

First let us introduce two general observations: they are easy to prove and are the basis of the approach in other contexts called anti-neighborhood approach which will be used later.

###### Observation 1

For any graph , ; then for any ,

###### Observation 2

For any graph and for any order of the vertices of , .

For any induced of any (, Triangle)-free , say , of vertex set and edge set , one has that admits the partition

where , , , , , , .

Then the following observations can be shown with no difficult.

###### Observation 3

Every non-trivial component of a (, Triangle)-free graph is complete bipartite.

###### Observation 4

For any induced of any (, Triangle)-free , say , one has:

• every non-trivial component of is complete bipartite;

• each vertex of does not contact both sides of any non-trivial connected component of .

Then let us recall that WIS can be solved for bipartite graphs in polynomial time [1, 11, 20]. In particular let us formalize as lemma the following fact which can be (independently) shown with no difficult.

###### Lemma 1

The WIS problem can be solved for complete bipartite graphs in polynomial time, i.e., in linear time.

Then let us introduce a lemma.

###### Lemma 2

Let be a (, Triangle)-free graph containing an induced , say , of vertex set and edge set . Then a maximum weight independent set of containing (containing , respectively, by symmetry) can be computed in polynomial time.

Proof. The proof is introduced in Subsection 2.1.

Then let us consider the following algorithm.

Algorithm Last

Input: a (, Triangle)-free graph .

Output: a maximum weight independent set of .

Step 1.

For each induced of , say , of vertex set and edge set do:

(1.1) compute [by Lemma 2] a maximum weight independent set of containing : denote it as ;

(1.2) compute [by Lemma 2] a maximum weight independent set of containing : denote it as ;

(1.3) compute [by Lemma 1] a maximum weight independent set of where is the set of those vertices in which are isolated in : denote it as ;

(1.4) select a weight independent set of over : denote it as .

Step 2.

Select a weight independent set of over is an induced of : denote it as .

Step 3.

(3.1) Remove from all the vertices of which belong to an induced of : let be the graph obtained in this way.

(3.2) Compute [by Lemma 1] a maximum weight independent set of : denote it as .

Step 4.

Select a weight independent set of over and output it.

###### Theorem 2

The WIS problem can be solved for -free graphs in polynomial time via Algorithm Last.

Proof. First let us show that Algorithm Last can be executed in polynomial time.

As a preliminary let us observe that any (input) graph contains induced ’s. Concerning Step 1: steps (1.1)-(1.2) can be executed in polynomial time by Lemma 2; step (1.3) can be executed in polynomial time since every connected component of is complete bipartite: that follows since by construction is an isolated independent set of and since by Observation 4 each non-trivial component of is complete bipartite; step (1.4) can be executed in constant time; then, by the preliminary observation, Step 1 can be executed in polynomial time. Concerning Step 2: it can be executed in polynomial time by the preliminary observation and since Step 1 can be executed in polynomial time. Concerning Step 3: it can be executed in polynomial time, by the preliminary observation, and since every connected component of is complete bipartite by Observation 3. Concerning Step 4: it can be executed in constant time.

Then let us show that Algorithm Last is correct.

Let be any maximum (weight) independent set of : then let us show that Algorithm Last computes or an optimal solution.

Case 1 for some induced say of .

Let and . Then one has . Then let us consider the following exhaustive subcases.

Case 1.1 .

Then a maximum weight independent set of is computed in steps (1.1)-(1.2) with respect to .

Case 1.2 .

This case can be treated similarly to Case 1.1 by symmetry.

Case 1.3 .

Then a maximum weight independent set of is a maximum weight independent set of . Note that, since is Triangle-free, and are independent sets. Then admits a partition, say , where is the set of those vertices of which are isolated in [as defined above] and . Now: (i) either , in which case a maximum weight independent set of is contained in , so that it is computed in step (1.3) with respect to ; (ii) or , namely there is a vertex say with a neighbor say , so that vertices induce a say of , and then a maximum weight independent set of is computed in step (1.3) with respect to ; (iii) or , namely there is a vertex say with a neighbor say , so that vertices induce a say of , and then a maximum weight independent set of is computed in step (1.3) with respect to .

Case 1.4 .

Note that every maximum weight (thus maximal) independent set of not containing vertices of has to contain some vertex of , namely there is a vertex say , so that vertices induce a say of , and then a maximum weight independent set of is computed in step (1.3) with respect to .

Case 1.5 .

Note that every maximum weight (thus maximal) independent set of not containing vertices of has to contain some vertex of , namely there is a vertex say , so that vertices induce a say of , and then a maximum weight independent set of is computed in step (1.3) with respect to .

Case 1.6 .

This case can be treated similarly to Case 1.5 by symmetry.

Case 1.7 .

This case can be treated similarly to Case 1.4 by symmetry.

Case 2 for any induced say of .

Then a maximum weight independent set of is computed in Step 3.

This completes the proof of the theorem.

### 2.1 Proof of Lemma 1

In this subsection let us introduce the proof of Lemma 1.

Let be a (, Triangle)-free graph, with vertex weight function , containing an induced say of vertex set and edge set .

Let us show that a maximum weight independent set of containing (containing , respectively, by symmetry) can be computed in polynomial time.

A maximum weight independent set of containing can be computed by solving WIS for . Then, since vertices of are isolated in such a graph, the problem can be reduced to graph .

Then let us show that WIS can be solved for in polynomial time.

The proof consists of solving a sequence of cases which are more and more difficult/general, each of which is solved by a reduction to the previous solved case, where the basic case is that of complete bipartite graphs. In this sense the proof is not a massive case distinction.

In what follows two main macro-cases are solved, namely, CASE A as the facilitated case and CASE B as the general case.

#### 2.1.1 CASE A: the facilitated case

CASE A is the following: graph is such that admits a partition , where is an independent set and induces a -free graph, so that by Observation 4 every non-trivial connected component of is complete bipartite.

Then let us show that WIS can be solved for in polynomial time.

Let and let be a non-trivial component-set of . Let us say that: is bi-partial to if is partial to one of the sides of ; is bi-universal to if is universal to one of the two sides of . Then by Observation 4, if contacts , then is either bi-partial to or bi-universal to .

Let denote the family of non-trivial component-sets of : then, as recalled above, every member of induces a complete bipartite graph. For any , let be the family of members of contacted by .

CASE A.1 No vertex of is bi-partial to any member of .

Then, according to the above, to our aim each member of , say of sides and , can be assumed to be [contracted into] one edge say by defining the weight of and of as follows: and .

CASE A.1.1 Each vertex of contacts at most one member of .

Then since is -free, there exists at most one member of , i.e., one edge say of , such that both and have neighbors in : if such an edge of does not exist, then every connected component of is complete bipartite, and then WIS can be solved for in polynomial time; if such an edge of does exist, then every connected component of both and is complete bipartite, and then WIS can be solved for in polynomial time.

CASE A.1.2 Some vertex of contacts more than one member of .

Let be such that for all . Let denote the family of non-trivial component-sets of . Note that each vertex of contacts at most one member of : in fact, if a vertex should contact two members of , then by construction and by Observation 4 vertex would contact two member of , and then by definition of there would exist two members of which are contacted by and non-contacted by , and then by Observation 4 an induced would arise. Then WIS can be solved for in polynomial time as follows: for one can refer to CASE A.1.1; for one can iterate the above argument until the graph is reduced to ; for one can solve WIS in polynomial time since every connected component of is complete bipartite.

CASE A.2 Some vertex of is bi-partial to some member of .

CASE A.2.1 Each vertex of is bi-partial to at most one member of .

Let be bi-partial to one member of and be such that for all which are bi-partial to one member of : in particular let be the member of such that is bi-partial to .

Then let be the family of non-trivial component-sets of such that there is a vertex of bi-partial to .

Claim 1. has at most one member.

Proof. By contradiction assume that has two members, say and . By definition of , let be respectively bi-partial to (actually may coincide to ; however both are different to ).

Let us observe that: if coincides to , then such a vertex contacts both and ; if does not coincide to , then to avoid a , either contacts or contacts . Then, without loss of generality by symmetry, let us assume that contacts [both and] .

Then by construction and by Observation 4, there exist two members of , say , such that and . By definition of , one has that does not contact : in fact, if should contact either or , then by construction would be bi-partial to it (a contradiction to the assumption of CASE A.2.1, since is bi-partial to ). Then, by definition of , one has that contacts at least two members of which are not contacted by : then, from one hand the subgraph induced by and by such two members contains an induced , and from the other hand the subgraph induced by and by contains an induced , i.e., an induced arises (contradiction).

Claim 2. WIS can be solved for in polynomial time.

Proof. By Claim 1, has at most one member. Let us consider only the case in which such a member does exist, say , since the other case can be treated similarly. Then be the member of such that . Note that and are the only (two) non-trivial component-sets of to which any vertex of may be bi-partial. Furthermore by Observation 4, for any (for any , respectively), is universal to one side of ( is universal to one side of , respectively).

For any maximum (weight) independent set of one of the following cases occurs: (i) and , (ii) and , (iii) and , (iv) and .

Then WIS can be solved for as follows.

In case (i): by solving WIS for , which enjoys CASE A.1 by the above. In case (ii): by solving WIS for , for all , which enjoys CASE A.1 by the above. In case (iii): by solving WIS for , for all , which enjoys CASE A.1 by the above. In case (iv): by solving WIS for , for all , which enjoys CASE A.1 by the above.

Then WIS can be solved for in polynomial time by referring to CASE A.1.

Then WIS can be solved for in polynomial time as follows: for one can refer to Claim 2, that is, finally to CASE A.1; for one can iterate the above argument until the graph is reduced to ; for one can solve WIS in polynomial time since every connected component of is complete bipartite.

CASE A.2.2 Some vertex of is bi-partial to more than one member of .

Let us define an order on : let us say that, for any , if is bi-partial to two non-trivial component-sets of .

Claim 3. The ordered set () admits a maximal element, i.e., there exists such that no vertex of is bi-partial to two non-trivial component-sets of . In particular, WIS can be solved for in polynomial time.

Proof. As a preliminary let us introduce the following observation. Let and assume , that is, be bi-partial to two non-trivial component-sets, say , of : then by construction and by Observation 4 there exist two members of , say , such that and .

Then let us prove the following facts.

Fact 1. Let and assume , that is, be bi-partial to two non-trivial component-sets, say , of ; then let be the two members of such that and . Then: if contacts (contacts , respectively), then (then , respectively).

Proof of Fact 1. By contradiction assume that contacts and that (i.e., is adjacent to a vertex of non-adjacent to ). Then, by Observation 4 and since is bi-partial to , one has that (considering that may contact either in the same side as or in the other side): from one hand the subgraph induced by and contains an induced not contacted by , and from the other hand the subgraph induced by and by contains an induced , i.e., an induced arises (contradiction). The same holds for instead of by symmetry.

Fact 2. Let and assume . Then .

Proof of Fact 2. By assumption let be bi-partial to two non-trivial component-sets, say , of . Then let be the two members of such that and . By contradiction assume that . Then let be bi-partial to two non-trivial component-sets, say , of . Then let be the two members of such that and .

Then by Fact 1 one that and that . Then, from one hand the subgraph induced by and contains an induced , and from the other hand the subgraph induced by and contains an induced , i.e., an induced arises (contradiction).

Now let , for some natural , and assume . Then is bi-partial to two non-trivial component-sets, say , of for . Then let be the two members of such that and for .

Fact 3. contacts .

Proof of Fact 3. First let us show that contacts . Let us show that contacts . If either or , say (without loss of generality by symmetry), then by construction , that is , that is contacts . If , then contacts , since otherwise a arises (one is contained in the subgraph induced by and , one is contained in the subgraph induced by , , ). Then contacts . The same holds for by symmetry.

Then let us show that for , if contacts , then contacts . Let us show that if contacts , then contacts . If either or , say (without loss of generality by symmetry), then by construction , that is , that is contacts . If , then contacts , since otherwise a arises (one is contained in the subgraph induced by and , one is contained in the subgraph induced by , , ). Then contacts . The same holds for by symmetry.

Then Fact 3 is proved.

Fact 4. .

Proof of Fact 4. By contradiction assume . Then is bi-partial to two non-trivial component-sets, say , of . Then let be the two members of such that and . Let us recall that contacts by Fact 3. If either or , say (without loss of generality by symmetry), then by construction , that is , that is contacts (contradiction). If , then contacts (contradiction), since otherwise a arises (one is contained in the subgraph induced by and , one is contained in the subgraph induced by , , ).

Let us conclude the proof of Claim 3. By Facts 2 and 4, there are no vertices (for ) such that , i.e., there is no cycle in the ordered set . Then () admits a maximal element, i.e., there exists such that no vertex of is bi-partial to two non-trivial component-sets of .

The above fact can be seen (more formally) by defining a directed graph, namely , such that for any there is directed edge if and only if ; then by the above is acyclic; then it is well-known [and not difficult to check] that contains at least one vertex with zero out-degree.

In particular, WIS can be solved for in polynomial time, since enjoys CASE A.2.1.

Then WIS can be solved for in polynomial time as follows: compute a maximal element of (), say , and solve WIS for by Claim 3, that is, by finally referring to CASE A.2.1; iterate this procedure for until the graph is reduced to ; solve WIS for in polynomial time since every connected component of is complete bipartite.

This completes the solution for CASE A.

### 2.2 CASE B: the general case.

Let us show that WIS can be solved for in polynomial time. Let us recall that and are independent sets and that every non-trivial component of is complete bipartite.

For brevity let us write .

Let and let be a non-trivial component-set of . Let us say that: is bi-partial to if is partial to one of the sides of ; is bi-universal to if is universal to one of the two sides of . Then by Observation 4, if contact , then is either bi-partial to or bi-universal to .

For any maximum (weight) independent set of one of the following cases occurs: (i) and , (ii) and , (iii) and , (iv) or and .

Then WIS can be solved for as follows.

In case (i): by solving WIS for , in polynomial time, since it enjoys CASE A. In case (ii): by solving WIS for , in polynomial time, since it enjoys CASE A. In case (iii): by solving WIS for , in polynomial time, since it enjoys CASE A. In case (iv): by solving WIS for for all non-adjacent pair of vertices .

Then to show that WIS can be solved for in polynomial time it remains to show that WIS can be solved for in polynomial time for all non-adjacent pair of vertices .

Then let us write for any fixed .

Then let us write for , and : then