the computational complexity of graph …gwoegi/papers/contract2.pdfthe computational complexity of...

25
The Computational Complexity of Graph Contractions II: Two Tough Polynomially Solvable Cases Asaf Levin Department of Statistics, The Hebrew University, Jerusalem 91905, Israel Daniel Paulusma Department of Computer Science, Durham University, Science Laboratories, South Road, Durham DH1 3LE, England Gerhard J. Woeginger Department of Mathematics and Computer Science, Eindhoven University of Technology, 5600 MB Eindhoven, The Netherlands For a fixed pattern graph H , let H -CONTRACTIBILITY denote the problem of deciding whether a given input graph is contractible to H . This article is part II of our study on the computational complexity of the H -CONTRACTIBILITY prob- lem. In the first article we pinpointed the complexity for all pattern graphs with five vertices except for two pattern graphs H . Here, we present polynomial time algorithms for these two remaining pattern graphs. Interestingly, in all connected cases that are known to be polynomially solvable, the pattern graph H has a dominating vertex, whereas in all cases that are known to be NP-complete, the pattern graph H does not have a dominating vertex. © 2008 Wiley Periodicals, Inc. NETWORKS, Vol. 52(1), 32–56 2008 Keywords: graph; edge contraction; dominating vertex; wheel; computational complexity 1. INTRODUCTION All graphs in this paper are undirected, finite, and sim- ple, i.e., without loops and multiple edges. If no confusion is possible, we write V = V G and E = E G for a graph G = (V G , E G ). Let G = (V , E) be a graph, and let e =[u, v]∈ E be an arbitrary edge with end-vertices u and v. (We also say that end-vertices u and v are adjacent.) The edge contraction of edge e in G removes the two end-vertices u and v from G, and replaces them by a new vertex that is adjacent to precisely those vertices to which u or v were adjacent. We denote the Received March 2006; accepted January 2008 Correspondence to: D. Paulusma; e-mail: [email protected] DOI 10.1002/net.20249 Published online 9 April 2008 in Wiley InterScience (www.interscience. wiley.com). © 2008 Wiley Periodicals, Inc. resulting graph by G\e. A graph G is contractible to a graph H (graph G is H-contractible) if the graph H can be obtained from G by a sequence of edge contractions. This leads to the following decision problem. H -Contractibility Instance: A graph G = (V , E). Question: Is G contractible to H ? A graph G is called connected if for every pair of dis- tinct vertices u and v, there exists a path connecting u and v, i.e., a sequence of distinct vertices starting at u and end- ing at v where each pair of consecutive vertices forms an edge of G.A cycle C on n vertices is a graph whose vertices can be ordered into a sequence v 1 , v 2 , ... , v n such that E C = {[v 1 , v 2 ], ... , [v n1 , v n ], [v n , v 1 ]}. A graph C n denotes a cycle on n vertices. A graph that does not contain a C 3 as a subgraph is said to be triangle-free.A dominating vertex is a vertex that is adjacent to all other vertices. In [2] Brouwer & Veld- man determine the complexity of the H -Contractibility problem for the following pattern graphs H . Theorem 1 ([2]). Let H be a connected triangle-free graph or a connected graph on at most four vertices. If H has a dominating vertex, then the H-Contractibility problem is polynomially solvable. If H does not have a dominating vertex, then the H-Contractibility problem is NP-complete. There are fifteen connected graphs H on five vertices that are not covered by Theorem 1; these are exactly the connected graphs on five vertices that do contain a triangle. See Figures 1 and 2 for pictures of all these graphs. In [3] the authors claimed the following result. NETWORKS—2008—DOI 10.1002/net

Upload: others

Post on 31-May-2020

8 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: The Computational Complexity of Graph …gwoegi/papers/contract2.pdfThe Computational Complexity of Graph Contractions II: Two Tough Polynomially Solvable Cases Asaf Levin Department

The Computational Complexity of Graph Contractions II:Two Tough Polynomially Solvable Cases

Asaf LevinDepartment of Statistics, The Hebrew University, Jerusalem 91905, Israel

Daniel PaulusmaDepartment of Computer Science, Durham University, Science Laboratories, South Road,Durham DH1 3LE, England

Gerhard J. WoegingerDepartment of Mathematics and Computer Science, Eindhoven University of Technology,5600 MB Eindhoven, The Netherlands

For a fixed pattern graph H , let H -CONTRACTIBILITY denotethe problem of deciding whether a given input graph iscontractible to H . This article is part II of our study on thecomputational complexity of the H -CONTRACTIBILITY prob-lem. In the first article we pinpointed the complexity forall pattern graphs with five vertices except for two patterngraphs H . Here, we present polynomial time algorithmsfor these two remaining pattern graphs. Interestingly, inall connected cases that are known to be polynomiallysolvable, the pattern graph H has a dominating vertex,whereas in all cases that are known to be NP-complete,the pattern graph H does not have a dominating vertex.© 2008 Wiley Periodicals, Inc. NETWORKS, Vol. 52(1), 32–56 2008

Keywords: graph; edge contraction; dominating vertex; wheel;computational complexity

1. INTRODUCTION

All graphs in this paper are undirected, finite, and sim-ple, i.e., without loops and multiple edges. If no confusionis possible, we write V = VG and E = EG for a graphG = (VG, EG).

Let G = (V , E) be a graph, and let e = [u, v] ∈ E be anarbitrary edge with end-vertices u and v. (We also say thatend-vertices u and v are adjacent.) The edge contraction ofedge e in G removes the two end-vertices u and v from G, andreplaces them by a new vertex that is adjacent to preciselythose vertices to which u or v were adjacent. We denote the

Received March 2006; accepted January 2008Correspondence to: D. Paulusma; e-mail: [email protected] 10.1002/net.20249Published online 9 April 2008 in Wiley InterScience (www.interscience.wiley.com).© 2008 Wiley Periodicals, Inc.

resulting graph by G\e. A graph G is contractible to a graphH (graph G is H-contractible) if the graph H can be obtainedfrom G by a sequence of edge contractions. This leads to thefollowing decision problem.

H-ContractibilityInstance: A graph G = (V , E).Question: Is G contractible to H?

A graph G is called connected if for every pair of dis-tinct vertices u and v, there exists a path connecting u andv, i.e., a sequence of distinct vertices starting at u and end-ing at v where each pair of consecutive vertices forms anedge of G. A cycle C on n vertices is a graph whose verticescan be ordered into a sequence v1, v2, . . . , vn such that EC ={[v1, v2], . . . , [vn−1, vn], [vn, v1]}. A graph Cn denotes a cycleon n vertices. A graph that does not contain a C3 as a subgraphis said to be triangle-free. A dominating vertex is a vertexthat is adjacent to all other vertices. In [2] Brouwer & Veld-man determine the complexity of the H-Contractibilityproblem for the following pattern graphs H.

Theorem 1 ([2]). Let H be a connected triangle-freegraph or a connected graph on at most four vertices. IfH has a dominating vertex, then the H-Contractibilityproblem is polynomially solvable. If H does not have adominating vertex, then the H-Contractibility problem isNP-complete.

There are fifteen connected graphs H on five vertices thatare not covered by Theorem 1; these are exactly the connectedgraphs on five vertices that do contain a triangle. See Figures1 and 2 for pictures of all these graphs. In [3] the authorsclaimed the following result.

NETWORKS—2008—DOI 10.1002/net

Page 2: The Computational Complexity of Graph …gwoegi/papers/contract2.pdfThe Computational Complexity of Graph Contractions II: Two Tough Polynomially Solvable Cases Asaf Levin Department

FIG. 1. The graphs H1, H2, . . . , H10.

Theorem 2 ([3]). Let H be a connected graph on atmost five vertices. If H has a dominating vertex, thenthe H-Contractibility problem is polynomially solvable.If H does not have a dominating vertex, then the H-Contractibility problem is NP-complete.

Because of the length of the proofs for the polynomialtime algorithms for the two five-vertex graphs H9 and H10,as shown in Figure 1, we did not include these proofs in [3].To prove the complete theorem we show the correctness ofthese polynomial time algorithms in this article. In Section3 we present the algorithm for the H9-Contractibilityproblem, and in Section 4 we present the algorithm for theH10-Contractibility problem.

2. PRELIMINARIES

For graph terminology not defined below (or in the intro-duction) we refer to [1]. A graph G is a subgraph of a graphH , denoted by G ⊆ H, if VG ⊆ VH and EG ⊆ EH . For asubset U ⊆ VG we denote by G[U] the induced subgraph ofG over U; hence G[U] = (U, EG ∩ (U × U)).

Each maximal connected subgraph of a graph G is calleda component of G. A graph G = (V , E) is called k-connectedif G[V\U] is connected for any set U ⊆ V of at most k − 1vertices. A graph G that is not connected is called discon-nected. A k-vertex cut is a subset S ⊆ V of size k such thatG[V\S] is disconnected. The vertex in a 1-vertex cut of agraph G is called a cutvertex. A vertex of a graph G that isnot a cutvertex of G is called a non-cutvertex of G. Each max-imal 2-connected subgraph of a graph G is called a block ofG. Note that by their maximality any two blocks of G haveat most one vertex (which is a cutvertex of G) in common.

For a vertex u in a graph G = (V , E) we denote itsneighborhood, i.e., the set of adjacent vertices, by N(u) ={v|[u, v] ∈ E}. The degree of a vertex u in G is the number ofedges incident with it, or equivalently the size of its neighbor-hood. The neighborhood N(U) of a subset U ⊆ V is definedas

⋃u∈U N(u)\U, and we call the vertices in N(U) neighbors

FIG. 2. The graphs H11, H12, . . . , H15.

of U. If v ∈ N(U) for some subset U ⊆ V we say that v isadjacent to U. Two subsets U, U ′ ⊂ V with U ∩ U ′ = ∅are adjacent if there exist vertices u ∈ U and u′ ∈ U ′ with[u, u′] ∈ E.

A complete graph is a graph with an edge between everypair of distinct vertices. The complete graph on n vertices isdenoted by Kn. A tree T is a connected graph that does notcontain any cycles. A vertex u of degree one in a tree T iscalled a leaf of T .

If not stated otherwise, a graph Pn denotes a path on nvertices. Let P = v1v2 . . . vp be a path from v1 to vp. Thenvi−1 is the predecessor of vi on P and vi+1 is the succes-sor of vi on P. The vertices v2, . . . , vp−1 are called the innervertices of P. The segment vivi+1 . . . vj is also denoted by

vi−→P vj. The reverse segment vjvj−1 . . . vi is denoted by vj

←−P vi.

Let C = v0v1 . . . vpv0 be a cycle with a fixed orientation. Thenvi−1 is the predecessor of vi on C and vi+1 is the successor

of vi on C. The segment vivi+1 . . . vj is denoted by vi−→C vj

where the subscripts are always to be taken modulo |C|. Thereverse segment vjvj−1 . . . vi is denoted by vj

←−C vi. If a graph

G contains an induced cycle C, i.e., G[VC] = C, then we saythat C is a chordless cycle of G.

Consider a graph G = (VG, EG) that is contractible to agraph H = (VH , EH). An equivalent (and for our purposesmore convenient) way of stating this fact is that

• for every vertex h in VH , there is a corresponding subsetW(h) ⊆ V of vertices in G such that G[W(h)] is connected,and W = {W(h)|h ∈ VH} is a partition of VG; we call aset W(h) an H-witness set of G for h and W an H-witnessstructure of G;

• for every edge e = [h1, h2] ∈ EH , there is at least one edge inG that connects the vertex set W(h1) to the vertex set W(h2);

• for every two vertices h1, h2 in H that are not connected by anedge in EH , there are no edges between W(h1) and W(h2).

If for every h ∈ VH , we contract the vertices in W(h) to asingle vertex, then we end up with the graph H. Note thatin general, these witness sets W(h) are not uniquely defined(since there may be many different sequences of contractionsthat lead from G to H). See Figure 3 for an example.

FIG. 3. A graph H and an H-contractible graph G.

NETWORKS—2008—DOI 10.1002/net 33

Page 3: The Computational Complexity of Graph …gwoegi/papers/contract2.pdfThe Computational Complexity of Graph Contractions II: Two Tough Polynomially Solvable Cases Asaf Levin Department

The following lemma is useful (and easy to verify).

Lemma 2.1 ([2]). A graph G is contractible to a 2-connected graph H if and only if G is connected and someblock of G is contractible to H.

3. A TOUGH POLYNOMIALLY SOLVABLE CASE

In this section we provide a polynomial time algorithm forthe pattern graph H9 (cf. Fig. 1). Given an input graph G ouralgorithm either concludes that G is not H9-contractible, orfinds an H9-witness structure of G.

In H9 we denote the vertex of degree one by x, its singleneighbor by y and the other vertices by z1, z2, z3. If a graphG = (V , E) is H9-contractible with witness sets W(x), W(y1)

and W(z1), W(z2), W(z3), then we denote X := W(x), Y :=W(y), and Zi := W(zi) for i = 1, 2, 3.

3.1. Outline of the Algorithm

We will proceed as follows.

Step 1. Increase the connectivity as much as possible.We first try to restrict ourselves to p-connected input graphsG = (V , E) with p as high as possible. The intuitive rea-son behind this is that H9-contractible graphs with a higherconnectivity are expected to have witness structures that areeasier to analyze than those with lower connectivity. So, ifwe can efficiently decompose loosely connected input graphsinto components with a higher connectivity, we might speedup the algorithm. We did not succeed in showing p ≥ 4 butwe could show that we may choose p = 3.

First we show that p ≥ 2 in Lemma 3.1: if our inputgraph G is 1-connected then our algorithm only has to checkwhether G is K4-contractible (which can be done in poly-nomial time). So from now on we can assume that G is2-connected. In Lemma 3.2 we then give a set of five con-ditions that together are necessary and sufficient for G to beH9-contractible. In Corollary 4 we research each of these fiveconditions as follows. For three conditions it is immediatelyclear that they can be checked in polynomial time, due to aresult from [3] on contracting a graph to a complete graph,where each witness set must contain certain prespecified ver-tices. Our algorithm checks each of these three conditions.If one of the conditions is true, then we have a ‘yes’-answer.With a bit more effort we can prove that one of the two remain-ing conditions can also be checked in polynomial time. Ouralgorithm also checks this condition. If it is satisfied, thenagain we have a ‘yes’-answer. Otherwise we are left withexactly one condition. We show that in that case our algo-rithm may break G into a polynomial number of smaller3-connected parts that can be processed one by one.

Step 2. Decrease the search space of possible H9-witnessstructures. As explained in Step 1, we now may assumethat G is 3-connected. This has the following advantage: if

FIG. 4. An example graph G with an H9-contraction pair (C, v).

G contains a chordless cycle C on at least three vertices anda vertex v /∈ VC such that all neighbors of v in G not onlybelong to V\VC but also belong to the same component inG[V\(VC ∪{v})], then G is H9-contractible. This can be seenas follows. Let K be the component of G[V\(VC ∪ {v})] thatcontains N(v). Since G is 3-connected, there exist at leastthree vertices u1, u2, u3 on C that have a neighbor in K . Thismeans we can define H9-witness sets X = {v}, Y = VK andZ1, Z2, Z3 such that ui ∈ Zi for i = 1, 2, 3 and Z1 ∪ Z2 ∪ Z3 =V\(VK ∪ {v}). This is why we call (C, v) an H9-contractionpair of G (see Fig. 4 for an illustration of such a contractionpair). In Lemma 3.3 we show that having a H9-contractionpair is not only sufficient but also necessary for a 3-connectedgraph to be H9-contractible. This structural result restricts thesearch space of possible witness structures.

Step 3. Exclude small H9-contraction pairs. Asexplained in the previous step, our algorithm now searchesfor an H9-contraction pair of G. In Lemma 3.4, our algorithmuses brute force to determine whether G contains a “small”H9-contraction pair, i.e., an H9-contraction pair (C, v) with|VC | ≤ p for some fixed integer p. We set p := 14 (but anyother value of p ≥ 14 would be fine as well). If our algorithmfinds an H9-contraction pair (C, v) with |VC | ≤ 14, then weare done. If G does not have such an H9-contraction pair,then the algorithm uses this information in the next step, aswe will explain below.

Step 4. Relax the definition of an H9-contraction pair. Inthis stage, we only know that G does not have a small H9-contraction pair. In order to proceed we relax the conditionthat N(v) must be in the same component of G[V\(VC ∪{v})]for an H9-contraction pair (C, v). By allowing the neighborsof v to be in different components of G[V\(VC ∪{v})] we hopeto find a good starting pair (C, v). Our algorithm then tries totransform this starting pair into an H9-contraction pair. Wecall a pair (C, v), where C is a chordless cycle on at leastthree vertices and v /∈ VC is a vertex with N(v) ∩ VC = ∅, a

34 NETWORKS—2008—DOI 10.1002/net

Page 4: The Computational Complexity of Graph …gwoegi/papers/contract2.pdfThe Computational Complexity of Graph Contractions II: Two Tough Polynomially Solvable Cases Asaf Levin Department

FIG. 5. An example graph G with a pseudo-pair (C, v).

pseudo-pair of G (see Fig. 5 for an illustration). In Lemma3.5 we show that our algorithm can find a sufficiently largepseudo-pair of G, i.e., with a cycle on at least 15 vertices, inpolynomial time, or else concludes that G does not have anH9-contraction pair and hence is not H9-contractible.

We would like to mention that the length of the cycle in apseudo-pair of G must be sufficiently large (and a length of15 turns out to be large enough) due to the nature of a numberof operations that our algorithm performs on the pseudo-pair(in an attempt to change it into an H9-contraction pair). Wewill explain these operations in the next step.

Step 5. Transform a pseudo-pair into an H9-contractionpair. In this stage, G has a pseudo-pair (C, v) with |VC | ≥15. Our algorithm first performs a number of checks thatrequire polynomial time. Our goal is to either find an H9-contraction pair of G, or else to find a well-structuredpseudo-pair of G, namely a pseudo-pair (C′, v′) that satisfiesthe following two conditions:

(i) every vertex in V\(VC′ ∪ {v′}) is adjacent to v′, so N(v′) =V\(VC′ ∪ {v′});

(ii) every vertex in V\(VC′ ∪ {v′}) is adjacent to all vertices on C′.

We call a pseudo-pair that satisfies conditions (i) and (ii)above a complete pseudo-pair of G (see Fig. 6). The advan-tage of finding a complete pseudo-pair will be made clearin the next step. We first briefly explain the checks we needto perform on pseudo-pair (C, v). If (C, v) passes a checkthen our algorithm finds an H9-contraction pair. Each time(C, v) fails a check, we find that (C, v) is more similar to acomplete pseudo-pair, and we proceed with the next check.If (C, v) fails the last check, then (C, v) must be a completepseudo-pair. There are five checks.

Check 1. In Lemma 3.6 we show how our algorithm findsan H9-contraction pair of G if G[V\VC] is not connected.

Check 2. Assume that G[V\VC] is connected. Denote theset of components in G[V\(VC ∪ {v})] by K. Lemma 3.7shows how our algorithm finds an H9-contraction pair of Gif C contains a vertex not adjacent to the vertex set of somecomponent K ∈ K.

Check 3. Assume that all vertices on C have a neighbor inevery component of K. Using Lemma 3.8, Lemma 3.9 showshow our algorithm finds an H9-contraction pair of G if thereexists a component K ∈ K with no vertex adjacent to at leasttwo vertices of C.

Check 4. Assume that all components in K contain a ver-tex that has at least two neighbors on C. Using Lemma3.10, Lemma 3.11 shows how our algorithm finds an H9-contraction pair of G if there exists a component K ∈ K thatcontains a vertex adjacent to at least two vertices on C butnot to all of them.

Check 5. Assume that all components in K contain a vertexthat is adjacent to all vertices on C. Lemma 3.12 shows howour algorithm finds an H9-contraction pair of G if there existsa component in K that contains a vertex that is not adjacentto all vertices on C or that is not adjacent to v.

If (C, v) fails Check 5 then (C, v) must be a completepseudo-pair of (C, v).

Step 6. Transform a complete pseudo-pair into an H9-contraction pair. As explained in the previous step, wenow have a complete pseudo-pair (C, v) of G. In Lemma3.13 we show that G has an H9-contraction cycle if and onlyif G[N(v)] contains a cycle on at most |N(v)| − 2 vertices.This final condition is easy to check, and in Theorem 5 weprove the correctness of the whole algorithm and show thatit runs in polynomial time.

3.2. The Algorithm Itself

As explained in the previous section, our polynomialtime algorithm for solving the H9-Contractibility problemperforms six steps. Here we describe them in more detail.

Step 1. Increase the connectivity as much as possible.We start with the following lemma. It shows that we mayrestrict ourselves to 2-connected input graphs.

FIG. 6. An example graph G with a complete pseudo-pair (C, v) that is notan H9-contraction pair.

NETWORKS—2008—DOI 10.1002/net 35

Page 5: The Computational Complexity of Graph …gwoegi/papers/contract2.pdfThe Computational Complexity of Graph Contractions II: Two Tough Polynomially Solvable Cases Asaf Levin Department

Lemma 3.1. Let u be a cutvertex of a connected graphG = (V , E). Then G is H9-contractible if and only if G isK4-contractible.

Proof. Let C denote the set of all components inG[V\{u}]. Suppose G is contractible to H9. Obviously, Gis contractible to K4.

Suppose G is contractible to K4. Since u is a cutvertex ofG, the vertices of the K4-witness sets of G not containing uall belong to one component F in C. Let F ′ �= F be anothercomponent in C. Let A be the K4-witness set of G that con-tains u. Then F ′ is a subset of A. We choose X = VF ′ andY = A\VF ′ . All other witness sets stay the same. This waywe have obtained H9-witness sets for G. ■

To further increase the connectivity of our input graphswe need among others the following lemma. In this lemmawe use the following notation. For an induced subgraph Fof a graph G = (V , E) and two vertices u, v ∈ V\VF , wedenote G[VF ∪ {u, v}] by F + {u, v} and we write F + [u, v]to denote the graph obtained from F +{u, v} after adding theedge [u, v]. Note that F + [u, v] = F + {u, v} if and only if[u, v] is an edge in G. The graph obtained from F + [u, v]after contracting [u, v] is denoted by F + uv.

Lemma 3.2. Let {u, v} be a 2-vertex cut of a 2-connectedgraph G = (V , E). Let C be the set of components ofG[V\{u, v}]. Then G is H9-contractible if and only if at leastone of the following cases is true:

(i) there exists a component F ∈ C such that F + [u, v] is H9-contractible;

(ii) there exists a component F ∈ C such that F + {u, v} isK4-contractible with u, v in the same K4-witness set;

(iii) there exist components F, F ′ ∈ C (F �= F ′) such that F + uvis K4-contractible, and F ′ + {u, v} is P2-contractible with u, vin the same P2-witness set;

(iv) |C| ≥ 3 and there exists a component F ∈ C such that F + uvis K4-contractible;

(v) there exist components F, F ′ ∈ C (F �= F ′) such that F+[u, v]is K4-contractible with u, v in two different K4-witness setsand F ′ + {u, v} is P3-contractible with u, v in two differentP3-witness sets.

Proof. Suppose G is H9-contractible. We show that atleast one of the cases (i) − (v) is true. Let u be in witnessset W(i) and let v be in witness set W(j). We first show thefollowing: If i �= j, then i and j must be adjacent vertices inH . Suppose otherwise, i.e., that i = x and j = zk for some1 ≤ k ≤ 3, say j = z1. Since y, z2, z3 are adjacent to eachother, all vertices in W(y) ∪ W(z2) ∪ W(z3) belong to thesame component F1 ∈ C. Suppose some of the vertices inW(z1)\{v} belong to some component F2 ∈ C. Then v is acutvertex of G. This is not possible, since G is 2-connected.Hence W(z1) ⊆ VF1 ∪ {v}. Suppose some of the vertices inW(x)\{u} belong to some component F3 ∈ C. Then u wouldbe a cutvertex of G. Hence W(x) ⊆ VF1 ∪ {u}. This impliesthat V = VF1 ∪{u, v}. But then {u, v} would not be a 2-vertexcut.

Because of the above, we need to distinguish three cases.

Case 1. {x} ⊆ {i, j} ⊆ {x, y} or {i, j} ⊂ {z1, z2, z3}. Since{u, v} is a 2-vertex cut, the vertices in the other witness setsmust all belong to the same component F of C. We remove allvertices in W(i)∪W(j) not in VF ∪{u, v}. If i = j, the resultingwitness set W ′(i) might be disconnected. If i �= j, there mightnot be an edge between the resulting witness sets W ′(i) andW ′(j). However, in both cases, after adding the edge [u, v] weobtain an H9-contractible graph. So (i) is valid.

Case 2. i = j = y. Since {u, v} is a 2-vertex cut, the verticesin the witness sets Z1, Z2, Z3 must all belong to the samecomponent F of C. What about the vertices in X?

Suppose X ⊂ VF . Then we remove all vertices in Y notin VF ∪ {u, v}. Then the resulting set Y ′ might be discon-nected. However, after adding the edge [u, v] we obtain anH9-contractible graph. So (i) is valid.

Suppose X ⊆ VF ′ for some component F ′ ∈ C withF ′ �= F. Suppose G[Y ] contains a path from u to v only usingvertices from VF ∪ {u, v}. Then F + {u, v} is K4-contractiblewith u, v in the same K4-witness set. So (ii) is valid. SupposeG[Y ] contains a path from u to v only using vertices fromVF ′ ∪ {u, v}. Then F ′ + {u, v} is P2-contractible with u, v inthe same P2-witness set where X is contracted to one P2-witness set and Y ∩ (VF ′ ∪ {u, v}) is contracted to the otherP2-witness set. Furthermore, F + uv is K4-contractible. So(iii) is valid. In the remaining case G[Y ] contains a path fromu to v only using vertices from VF ′′ ∪ {u, v} for some com-ponent F ′′ ∈ C\{F, F ′}. Then F + uv is K4-contractible. So(iv) is valid.

Case 3. {i, j} = {y, zh} for some 1 ≤ h ≤ 3. We assumewithout loss of generality that i = y and j = z1. Since {u, v}is a 2-vertex cut, the vertices in the witness sets Z2, Z3 mustall belong to the same component F of C. What about thevertices in X?

Suppose X ⊂ VF . Then we remove all vertices in Y ∪ Z1

not in VF ∪ {u, v}. Then there might not be an edge betweenthe resulting witness sets Y ′ and Z ′

1. However, after addingthe edge [u, v] we obtain an H9-contractible graph. So (i) isvalid.

Suppose X ⊆ VF ′ for some component F ′ ∈ C with F ′ �=F. Then G[Y ∪ Z1] contains a path from u to v only usingvertices from VF ′ ∪ {u, v}. Otherwise u would be a cutvertexof G contradicting our assumption that G is 2-connected.Hence F ′ + {u, v} is P3-contractible with u, v in two differentP3-witness sets, where X is contracted to one P3-witness set,Y ∩ (VF ′ ∪ {u}) is contracted to the middle P3-witness set,and Z1 ∩ (VF ′ ∪ {v}) is contracted to the last P3-witness set.Furthermore, F + [u, v] is K4-contractible with u, v in twodifferent K4-witness sets. So (v) is valid.

It is easy to see that G is H9-contractible if at least one ofthe cases (i)–(v) hold. ■

36 NETWORKS—2008—DOI 10.1002/net

Page 6: The Computational Complexity of Graph …gwoegi/papers/contract2.pdfThe Computational Complexity of Graph Contractions II: Two Tough Polynomially Solvable Cases Asaf Levin Department

In order to prove that we may restrict ourselves to the classof 3-connected graphs we also need a result on the followingdecision problem.

Kp-Fixed ContractibilityInstance: A graph G = (V , E) and subsets Z1, . . . , Zt ⊆ Vsuch that

∑ti=1 |Zi| ≤ p.

Question: Can G be contracted to Kp with Kp-witness setsU1, . . . , Up such that Zi ⊆ Ui for 1 ≤ i ≤ t?

Proposition 3 ([3]). The Kp-Fixed Contractibility prob-lem is solvable in polynomial time.

We note that for every ‘yes’-instance of the Kp-Fixed Con-tractibility problem appropriate Kp-witness sets can befound in polynomial time as well. Both Proposition 3 andthis stronger result are a direct consequence of the polynomialtime algorithm in [4] on the so-called Disjoint ConnectedSubgraphs(k) problem. See [3, 4] for more details.

Corollary 4. If the H9-Contractibility problem issolvable in polynomial time for the class of 3-connectedgraphs, then the H9-Contractibility problem is solvablein polynomial time.

Proof. Let G be a connected graph. If G contains acutvertex, then we only need to check whether G is K4-contractible due to Lemma 3.1. By Theorem 1 this can bedone in polynomial time.

So we may assume that G is 2-connected. Suppose G is not3-connected. Then we can find a 2-vertex cut {u, v} with setC of components in G[V\{u, v}] in polynomial time. We firstcheck whether one of the cases (ii)-(v) of Lemma 3.2 is valid.In polynomial time we can either find appropriate witness setsor else conclude that cases (ii)-(v) do not hold. We can do thisas follows. We can check cases (ii)-(iv) in polynomial timedue to Proposition 3. We can check case (v) in polynomialtime as follows. For each F ∈ C we can check in polynomialtime if F + [u, v] is K4-contractible with u, v in two differentK4-witness sets due to Proposition 3. If so, then we considereach component F ′ ∈ C\{F}. We show that F ′ + {u, v} isP3-contractible with u, v in two different P3-witness sets ifand only if one of the following conditions holds (both can bechecked in polynomial time): there exists a vertex w1 ∈ VF ′

that is not adjacent to u such that G[VF ′ \{w1}] is connected,or there exists a vertex w2 ∈ VF ′ that is not adjacent to v suchthat G[VF ′ \{w2}] is connected.

Suppose F ′+{u, v} is P3-contractible with u in P3-witnessset A, and v in P3-witness set B with A �= B. Just as in theproof of Lemma 3.2, we know that A and B are adjacent. LetP = p1p2p3. Then without loss of generality we assume thatA = W(p1) and B = W(p2). Since we can move vertices fromW(p3) to W(p2) if necessary, we may assume that W(p3) ={w} for some w ∈ VF ′ . In the same way, since u is not acutvertex of F + {u, v}, we may assume that W(p1) = {u}.The reverse implication is trivial.

Suppose none of the cases (ii)-(v) hold. We then checkwhether case (i) is valid. If a graph F+[u, v] for some compo-nent F ∈ C is not 3-connected, then it is at least 2-connected.

Otherwise, i.e., if F + [u, v] contains a cutvertex a, then awould be a cutvertex in G. We just repeat the procedure above.Any vertex that does not belong to some 2-vertex cut in Gis in exactly one 3-connected graph obtained this way. Fur-thermore, any such 3-connected graph contains at least onevertex that is not in any 2-vertex cut in G. Hence we thenfind a total set of O(|V |) 3-connected graphs. Each of thesegraphs has at most |V | vertices. We check each of them. ■

Step 2. Decrease the search space of possible H9-witnessstructures. Due to Corollary 4 from now on we willonly consider 3-connected input graphs. Recall that an H9-contraction pair is a pair (C, v), where C is a chordless cycleon at least three vertices and v is a vertex not on C such thatall neighbors of v in G belong to the same component ofG[V\(VC ∪ {v})]. In the next lemma we show that having anH9-contraction pair is a sufficient and a necessary conditionfor a 3-connected graph G to be H9-contractible.

Lemma 3.3. A 3-connected graph G is H9-contractible ifand only if G has an H9-contraction pair (C, v).

Proof. Let G = (V , E) be a 3-connected graph. Firstsuppose G contains an H9-contraction pair (C, v). Let K bethe component of G[V\(VC ∪ {v})] that contains N(v). SinceG is 3-connected, there exist at least three vertices u1, u2, u3

on C that have a neighbor in K . This means we can defineH9-witness sets X = {v}, Y = VK and Z1, Z2, Z3 such thatui ∈ Zi for i = 1, 2, 3 and Z1 ∪ Z2 ∪ Z3 = V\(VK ∪ {v}).

To show the other direction of the claim, suppose G isH9-contractible with H9-witness sets X, Y and Z1, Z2, Z3. Weshow that G[Z1 ∪ Z2 ∪ Z3] contains a chordless cycle C withVC ∩ Zi �= ∅ for i = 1, 2, 3. Then we can take an arbitraryvertex v ∈ X , and we have an H9-contraction pair (C, v)of G. Since Z1, Z2, Z3 are H9-witness sets corresponding toW(z1), W(z2), W(z3), we can determine C as follows. Letz′

3 ∈ Z3 be adjacent to z1 ∈ Z1. Let P1 be a path in G[Z1]from z1 to the first vertex z′

1 that is adjacent to a vertex z2 ∈ Z2

(so z1 = z′1 is possible). Let P2 be a path in G[Z2] from z2 to

the first vertex z′2 of Z2 that is adjacent to a vertex z3 ∈ Z3 (so

z2 = z′2 is possible). We let P3 be a shortest path in G[Z3] from

z3 to z′3. Now consider C′ = z1

−→P1z′

1z2−→P2z′

2z3−→P3z′

3z1. If C′ ischordless we choose C = C′. Suppose C′ is not chordless.By construction, there are no vertices of P1 adjacent to P2

except z′1. Similarly, there are no vertices of P2 adjacent to

P3 except z′2. By construction, all paths P1, P2, P3 are induced

paths in G. Hence, there exists at least one edge between P1

and P3 not equal to [z1, z′3]. Starting at z3 let z∗

3 be the firstvertex on P3 adjacent to a vertex z∗

1 on P1. Then we choose

C = z∗1−→P1z′

1z2−→P2z′

2z3−→P3z∗

3z∗1. ■

Step 3. Exclude small H9-contraction pairs. Becauseof Lemma 3.3, our goal is to construct a polynomial timealgorithm that either finds an H9-contraction pair for a 3-connected graph G, or else concludes that G does not havesuch a pair. The following lemma holds for any fixed integer

NETWORKS—2008—DOI 10.1002/net 37

Page 7: The Computational Complexity of Graph …gwoegi/papers/contract2.pdfThe Computational Complexity of Graph Contractions II: Two Tough Polynomially Solvable Cases Asaf Levin Department

p, but in the correctness proof of our algorithm a value ofp = 14 turns out to be sufficiently large.

Lemma 3.4. Let G = (V , E) be a 3-connected graph. It ispossible in polynomial time either to find an H9-contractionpair of G with |VC | ≤ 14, or else to conclude that G does nothave an H9-contraction pair (C, v) with |VC | ≤ 14.

Proof. For each subset U ⊆ V of at most 14 verticesand vertex v /∈ U we can check in polynomial time whether(G[U], v) is an H9-contraction pair of G. The number of suchpairs (U, v) is bounded by O(|V |15). ■

Step 4. Relax the definition of an H9-contraction pairRecall that a pseudo-pair in a 3-connected graph G is a pair(C, v), where C is a chordless cycle on at least three ver-tices and v is a vertex of V\VC with N(v) ∩ VC = ∅. Soan H9-contraction pair (C, v) can be seen as a special kindof pseudo-pair, namely with N(v) in the same component ofG[V\(VC∪{v})]. In case we do not find an H9-contraction pair(C, v) with |VC | ≤ 14, we try to find a pseudo-pair (C′, v′)of G with |VC′ | ≥ 15.

Lemma 3.5. Let G be a 3-connected graph that does nothave an H9-contraction pair (C, v) with |VC | ≤ 14. Then itis possible in polynomial time either to find a pseudo-pair(C′, v′) of G with |VC′ | ≥ 15, or else to conclude that G doesnot have an H9-contraction pair.

Proof. Let G = (V , E) be a 3-connected graph thatdoes not have an H9-contraction pair (C, v) with |VC | ≤14. In that case we proceed as follows. For each set offifteen vertices v, u1, . . . , u14 of G with u1, . . . , u14 induc-ing a path P = u1u2 . . . u14 in G and {u1, . . . , u14} ∩N(v) = ∅, we remove v, u2, . . . , u13, together with N(v)and N({u2, . . . , u13})\{u1, u14}. Then we compute (in poly-nomial time) a shortest path P′ from u14 to u1 in the resultinggraph G′. Note that [u14, u1] is not an edge in G. Hence,if such an induced path P′ of G′ indeed exists, then C =u1

−→P u14

−→P′ u1 is a chordless cycle on at least fifteen vertices

in G[V\({v} ∪ N(v))]. Hence, (C, v) is the desired pseudo-pair. Otherwise we will guess another set of fifteen verticesof G and so on.

Obviously, G does not contain a pseudo-pair (C, v) with|VC | ≥ 15 if we have not found such a pair after consideringall O(|V |15) possible combinations. In that case, since anyH9-contraction pair is a pseudo-pair as well, graph G doesnot have an H9-contraction pair. ■

Step 5. Transform a pseudo-pair into an H9-contractionpair. Recall that a pseudo-pair (C, v) is a complete pseudo-pair of G = (V , E) if every vertex in V\(VC ∪{v}) is adjacentto all vertices in VC ∪ {v}. That is, if the following twoconditions hold:

(i) every vertex in V\(VC ∪ {v}) is adjacent to v, so N(v) =V\(VC ∪ {v});

(ii) every vertex in V\(VC ∪ {v}) is adjacent to all vertices on C.

By a sequence of lemmas we prove that we may restrict our-selves to complete pseudo-pairs, i.e., if a pseudo-pair of a3-connected graph G is not complete, then we can identifyan H9-contraction pair of G in polynomial time. Before westart to prove this we make the following remark.

Remark 1. Let C be a (not necessarily chordless) cycleon at least three vertices of a 3-connected graph G. Let v bea vertex in V\VC such that all neighbors of v in G belongto the same component K of G[V\(VC ∪ {v})]. If C is notchordless, then formally (C, v) is not an H9-contraction pair.However, it is easy to see that we can use (C, v) to find an H9-witness structure in polynomial time: since G is 3-connected,there exist at least three vertices u1, u2, u3 on C that have aneighbor in K , and we can define H9-witness sets X = {v},Y = VK and Z1, Z2, Z3 such that ui ∈ Zi for i = 1, 2, 3 andZ1 ∪ Z2 ∪ Z3 = V\(VK ∪ {v}). This is why we call such apair (C, v) an H9-contraction pair as well. As a matter of fact,we can show that C contains a cycle C′ such that (C′, v) isa “real” H9-contraction pair of G by using exactly the samearguments as in the proof of Lemma 3.3.

As we explained in Section 3.1, the first check we performon a pseudo-pair (C, v) of a 3-connected graph G is whetherG[V\VC] is connected.

Lemma 3.6. Let (C, v) be a pseudo-pair of a 3-connectedgraph G = (V , E) with C = u1u2 . . . upu1 for some p ≥ 15.If G[V\VC] is not connected, then it is possible to find anH9-contraction pair of G in polynomial time.

Proof. Let K1 denote the set of components ofG[V\(VC∪{v})] that contain a neighbor of v. If |K1| = 1, then(C, v) is an H9-contraction pair and we are done. So assume|K1| ≥ 2. Let K2 denote the set of all other components ofG[V\(VC ∪{v})], and let K = K1 ∪K2. Suppose G[V\VC] isnot connected. This is equivalent to saying |K2| ≥ 1. Belowwe show how we can identify an H9-contraction pair of G. Itis easy to check that this can be done in polynomial time.

First we make an observation. Since G is 3-connected, thevertex set of every component in K1 is adjacent to at least twodifferent vertices on C, and the vertex set of every componentin K2 is adjacent to at least three different vertices on C.

Let L be a component of K2. As we observed above, thevertex set VL has at least three neighbors ui, uj, uk on C with

i < j < k. Let P1 = ui−→C uj, P2 = uj

−→C uk , and P3 = uk

−→C ui.

Suppose there exists an index 1 ≤ h ≤ 3 such that everycomponent K ∈ K1 has a neighbor in VC\VPh . We assumewithout loss of generality that h = 1. Let x ∈ VL be a neighborof ui, and let y ∈ VL be a neighbor of uj. Let P be a path from

x to y in L. Then we construct the cycle C′ = x−→P yuj

←−C uix.

With an eye on Remark 1, we claim that (C′, v) is an H9-contraction pair of G. By definition of C′, we note that N(v)∩VC′ = ∅. We show that every vertex in N(v) is in the samecomponent of G[V\(VC′ ∪ {v})]. Let z, z′ be two neighbors

38 NETWORKS—2008—DOI 10.1002/net

Page 8: The Computational Complexity of Graph …gwoegi/papers/contract2.pdfThe Computational Complexity of Graph Contractions II: Two Tough Polynomially Solvable Cases Asaf Levin Department

of v. Assume that z ∈ VK and z′ ∈ VK ′ for some K , K ′ ∈ K1.Then z and z′ are connected to each other via a path usingonly vertices from K , K ′ and VC\VP1 . Hence, z and z′ are inthe same component of G[V\(VC′ ∪ {v})].

If an index h as above does not exist, then K1 must containthree components K1, K2, K3 such that N(VKi)∩VC ⊆ VPi fori = 1, 2, 3. Recall that VKi is adjacent to at least two verticesof Pi for i = 1, 2, 3.

Case 1. There exists an index 1 ≤ i ≤ 3 such that VKi isadjacent to some inner vertex of Pi.

We assume without loss of generality that i = 1. ThenG[VK1∪VP1 ] contains a cycle C′ that does not use both verticesui, uj. We assume without loss of generality that vertex uj isnot on C′.

Let w be a non-cutvertex of K2. We claim that (C′, w)

is an H9-contraction pair of G. By definition of C′ and K2,we note that N(w) ∩ VC′ = ∅. We show that N(w) is in thecomponent F of G[V\(VC′ ∪ {w})] to which uj belongs. Lett be a neighbor of w.

Clearly, P2 is a subgraph of F. If t is on C then t is on P2

and hence t is in F. Suppose t is in K2. Since G is 3-connected,component K2 contains at least two vertices w′, w′′ that areadjacent to P2 ⊆ F. At least one of these vertices, say w′, isnot equal to w. Since vertex w is a non-cutvertex in K2, thereexists a path from t to w′ in K2 that does not use w. Hence,also in this case, t is in F. Suppose t = v. Since K3 ∈ K1,vertex v is adjacent to a vertex t′ in K3. Recall that K3 isadjacent to at least two vertices ur , us on P3. At least one ofthose vertices, say ur , is not equal to ui. Then it is clear that vis connected to uj in G[V\(VC′ ∪ {w})] via a path using onlyvertices of VK3 ∪ (VP3\{ui}) ∪ VP2 . This means that v is in F.Hence, we conclude that N(w) is in F.

Case 2. N(VK1) ∩ VC = {ui, uj}, N(VK2) ∩ VC = {uj, uk},N(VK3) ∩ VC = {uk , ui} and (N(VL) ∩ VC) \ {ui, uj, uk} �= ∅.

Suppose u� ∈ VC\{ui, uj, uk} is adjacent to VL. Weassume without loss generality that k < �. We defineP′

1 = P1 = ui−→C uj, P′

2 = P2 = uj−→C uk , P′

3 = uk−→C u�,

and P′4 = u�

−→C ui. Then we may assume that K1 contains

components K ′1, . . . , K ′

4 such that N(VK ′i) ∩ VC ⊆ VPi for

i = 1, . . . , 4. Otherwise we can construct an H9-contractionpair of G in the same way as before. Then all neighbors thatVK ′

3has on C are on P′

3 ⊂ P3. Since there are at least twosuch neighbors, VK ′

3is adjacent to some inner vertex of P3.

This brings us back to Case 1.

Case 3. N(VK1) ∩ VC = {ui, uj}, N(VK2) ∩ VC = {uj, uk},N(VK3) ∩ VC = {uk , ui} and N(VL) ∩ VC = {ui, uj, uk}.

Since |VC | ≥ 15, we may without loss of generalityassume that VP1 contains at least five vertices. Then we canchoose ur ∈ VP1 such that ur−1 �= ui and ur+1 �= uj. We needto consider four subcases.

Case 3a. Vertex ur is not adjacent to any components in K1,or ur is adjacent to the vertex set of exactly one componentK ∈ K1 and this component K has N(VK ) ∩ VC �⊆ {ur , uk}.

Let x2 ∈ VK2 be a neighbor of uk and let y2 ∈ VK2 be aneighbor of v. We note that x2 = y2 is possible. Let Q2 be ashortest path from x2 to y2 in K2. Let x3 ∈ VK3 be a neighborof uk and let y3 ∈ VK3 be a neighbor of v. We note that x3 = y3

is possible. Let Q3 be a shortest path from x3 to y3 in K3.We define the (chordless) cycle C′ = x2

−→Q2y2vy3

←−Q3x3ukx2,

and we claim that (C′, ur) is an H9-contraction pair of G. Bydefinition of C′, C and our assumptions on K2, K3, we findthat N(ur)∩VC′ = ∅. We show that N(ur) is in the componentF of G[V\(VC′ ∪ {ur})] to which ur−1 belongs.

Since C is chordless, vertices ur−1 and ur+1 are the onlyneighbors of ur on C. Consider ur+1. By definition of K1, thesubgraph G[V\(VC′ ∪ {ur})] contains a path that starts withthe subpath ur+1

−→C uj, then uses one or more vertices in K1,

and ends with the subpath ui−→C ur−1. Hence, vertex ur+1 is in

F.Let w be a neighbor of ur not on C. Suppose w is in

some component K ′ ∈ K2. Since G is 3-connected, we findthat VK ′ is adjacent to at least three vertices on C. One ofthese vertices is not in {ur , uk}. We denote this vertex by uq.Then G[VC\{uk , ur}] ⊂ G[V\(VC′ ∪ {ur})] either contains apath from uq to ur−1, or else a path from uq to ur+1. Since{ur−1, ur+1} ⊂ VF , we find, in both cases, that uq, and hencew, is in F.

Suppose w is in some component in K1. Due to the subcaseassumption, vertex w is in a component K ∈ K1 with N(VK )∩VC �⊆ {ur , uk}. Since VK is adjacent to at least two vertices onC, vertex set VK is adjacent to some vertex us ∈ VC\{ur , uk}.Then subgraph G[VC\{uk , ur}] ⊂ G[V\(VC′ ∪ {ur})] eithercontains a path from us to ur−1, or else a path from us to ur+1.Since {ur−1, ur+1} ⊂ VF we find, in both cases, that uq, andhence w, is in F. We conclude that N(ur) is in F.

Case 3b. Vertex ur is adjacent to the vertex set of exactlyone component K ∈ K1 and K has N(VK ) ∩ VC ⊆ {ur , uk},and furthermore, ur+1 is not adjacent to a component K ′ ∈ Kwith a neighbor set N(VK ′) that contains a vertex on ur+2−→C uj.

We first note that K /∈ {K1, K2, K3}. Furthermore, sinceany component in K1 has at least two neighbors in C, we findthat N(VK ) ∩ VC = {ur , uk}.

Let x1 ∈ VK1 be a neighbor of uj and let y1 ∈ VK1 be aneighbor of v. We note that x1 = y1 is possible. Let Q1 be ashortest path from x1 to y1 in K1. Let x2 ∈ VK2 be a neighborof uj and let y2 ∈ VK2 be a neighbor of v. We note that x2 = y2

is possible. Let Q2 be a shortest path from x2 to y2 in K2.We define the (chordless) cycle C′ = x1

−→Q1y1vy2

←−Q2x2ujx1,

and we claim that (C′, ur) is an H9-contraction pair of G. Bydefinition of C′, C and our assumptions on K1, K2, we notethat N(ur)∩VC′ = ∅. We show that N(ur) is in the componentF of G[V\(VC′ ∪ {ur})] to which ur−1 belongs.

Since C is chordless, vertices ur−1 and ur+1 are the onlyneighbors of ur on C. Consider ur+1. Since G is 3-connected,vertex ur+1 has a neighbor in some component K∗ ∈ K.We observe that K∗ /∈ {K , K1, K2, K3}. The vertex set of K∗is adjacent to at least two vertices of VC . Let vertex z∗ ∈

NETWORKS—2008—DOI 10.1002/net 39

Page 9: The Computational Complexity of Graph …gwoegi/papers/contract2.pdfThe Computational Complexity of Graph Contractions II: Two Tough Polynomially Solvable Cases Asaf Levin Department

VK∗ have a neighbor us �= ur+1 on C. Due to our subcaseassumption, we find that us is on the path uj+1

−→C ur−1, which

is a path in G[V\(VC′ ∪ {ur})]. Hence, ur+1 is in F.Let w be a neighbor of ur not on C. There are two cases:

either w is in some component in K1, and then w must be inK , or w is in some component L′ ∈ K2.

Suppose w is in K . Recall that N(VK ) ∩ VC = {ur , uk}.Then component K contains a vertex w′ that is adjacent touk . We note that w′ = w is possible. Let P′ be a path inK from w to w′. Then G[V\(VC′ ∪ {ur})] contains the path

w−→P′ w′uk

−→C ur−1. This means that w is in F.

Suppose w is in some component L′ ∈ K2. We observethat L′ �= L. Recall that VL′ must be adjacent to at least threevertices on C. One of these vertices is not in {ur , uj}. Wedenote this vertex by us. Then G[VC\{uj, ur}] ⊂ G[V\(VC′ ∪{ur})] either contains a path from us to ur−1, or else a pathfrom us to ur+1. Since {ur−1, ur+1} ⊂ VF we find in bothcases that us is in F. Since L′ is adjacent to us, we then findthat w is in F.

From the above, we conclude that N(ur) is in F. So (C′, ur)

is indeed an H9-contraction pair of G.

Case 3c. Vertex ur+1 is adjacent to some componentK ′ ∈ K with a neighbor set N(VK ′) that contains a vertexon ur+2

−→C uj.

Let z1 ∈ VK ′ be a neighbor of ur+1 and let z2 ∈ VK ′ beadjacent to a vertex uq on ur+2

−→C uj. We note that z1 = z2 is

possible. We also note that K ′ �= K1 and K ′ �= K3. We letP be a path from z1 to z2 in K ′. We define the cycle C′ =z2

←−P z1ur+1

−→C uqz2.

Let w be a non-cutvertex of K3. We claim that (C′, w)

is an H9-contraction pair of G. By definition of C′ and ourassumption on K3, we find that N(w)∩VC′ = ∅. We show thatN(w) is in the component F of G[V\(VC′ ∪ {w})] to whichui belongs.

Clearly, P3 is a subgraph of F. Let t be a neighbor of w.If t is on C, then t is on P3 and hence t is on F. Suppose t isin K3. Since G is 3-connected and |VK3 | ≥ 2, component K3

contains at least two different vertices w′, w∗ that are adjacentto P3 ⊂ F. At least one of these vertices, say w′, is not equalto w. Since vertex w is a non-cutvertex in K3, there exists apath from t to w′ in K3 that does not use w. Hence, also inthis case, t is in F. Suppose t = v. Since K1 ∈ K1, vertex vis adjacent to a vertex t′ in K1. Recall that K1 is adjacent toui. Then we find that v is in F. Hence, we conclude that N(w)

is in F.

Case 3d. Vertex ur is adjacent to at least two componentsK , K ′ ∈ K1.

Then G[VK ∪VK ′ ∪{ur , v}] contains a cycle C′ (which usesboth ur and v). Let w be a non-cutvertex in L. With an eye onRemark 1, we claim that (C′, w) is an H9-contraction pair ofG. By definition of C′ and L, we find that N(w)∩VC′ = ∅. Weshow that N(w) is in the component F of G[V\(VC′ ∪ {w})]to which ui belongs.

Let t be a neighbor of w. Suppose t is on C. Sincewe assume that N(VL) ∩ VC = {ui, uj, uk} we find thatt ∈ {ui, uj, uk}. Then vertex t is connected to ui in G[V\(VC′ ∪{w})] via the path t

−→C ui. Suppose t is in L, so |VL| ≥ 2. If

t is adjacent to VC , then t is in F. Otherwise, since G is 3-connected, there exists a vertex t′ �= w in L adjacent to VC .Since vertex w is a non-cutvertex in L, component L containsa path from t to t′ that does not use w. This means that t is F.Hence, we conclude that N(w) is in F.

This finishes the proof of Lemma 3.6. ■

From now on, we may assume that G[V\VC] is connectedfor any pseudo-pair (C, v) of a 3-connected graph G. The nextlemma provides us with information on the neighbors of C.

Lemma 3.7. Let (C, v) be a pseudo-pair of a 3-connectedgraph G = (V , E) with C = u1u2 . . . upu1 for some p ≥ 15such that G[V\VC] is connected. If C contains a vertex notadjacent to the vertex set of some component in G[V\(VC ∪{v})], then it is possible to find an H9-contraction pair inpolynomial time.

Proof. Let K denote the set of components ofG[V\(VC ∪{v})]. Then, due to our assumption that G[V\VC]is connected, every component inK contains a vertex adjacentto v. Since G is 3-connected, the vertex set of any componentin K is adjacent to at least two vertices on C. If |K| = 1, then(C, v) is an H9-contraction pair and we are done. So assume|K| ≥ 2. We first show the following claim.

Claim 1. If there exist a component K ∈ K and a pathP = ui1 ui2 ui3 ⊂ C such that VK and VP are not adjacent,then it is possible to find an H9-contraction pair of G inpolynomial time.

We prove Claim 1 as follows. Let K be a component ofG[V\(VC ∪ {v})] such that VK is not adjacent to a path ofthree vertices of C, say K is not adjacent to {u1, u2, u3}. Wewill show how to identify an H9-contraction pair of G. It iseasy to check that this can be done in polynomial time.

Let ui and uj be two neighbors of VK on C. We assume

without loss of generality that u1, u2, u3 are on ui−→C uj. Let

x ∈ VK be adjacent to ui and let y ∈ VK be adjacent to uj.We note that x = y is possible. Let P be a path from x to y

in K . We define C′ = x−→P yuj

←−C uix. With an eye on Remark

1, we claim that (C′, u2) is an H9-contraction pair of G. Bydefinition of C′ and C, we note that N(u2) ∩ VC′ = ∅. Weshow that N(u2) is in the component F of G[V\(VC′ ∪ {u2})]to which v belongs.

Since C is chordless, vertices u1 and u3 are the only neigh-bors of u2 that are on C. We first consider u1. Since G is3-connected, vertex u1 has a neighbor z in some componentK ′ ∈ K\{K}. Because G[V\VC] is connected, K ′ contains avertex adjacent to v. We then find that u1 is in F. In the sameway we prove that u3 is in F. Any other neighbor z of u2 is

40 NETWORKS—2008—DOI 10.1002/net

Page 10: The Computational Complexity of Graph …gwoegi/papers/contract2.pdfThe Computational Complexity of Graph Contractions II: Two Tough Polynomially Solvable Cases Asaf Levin Department

in a component in K\{K}. Let z be in K∗ ∈ K\{K}. Thenz is connected to v via a path in VK∗ ∪ {v}, again becauseG[V\VC] is connected. Hence N(u2) is in F. This finishesthe proof of Claim 1.

From now on we may assume that the situation in Claim 1does not occur (as otherwise we are done). So all componentsin K are adjacent to any set of three consecutive vertices onC. We will now prove the complete statement of Lemma 3.7.Suppose u is a vertex on C that is not adjacent to VK for someK ∈ K. We will show how to identify an H9-contraction pairof G. It is easy to check that this can be done in polynomialtime.

Cycle C has at least p ≥ 15 vertices. Then we can choose apath P ⊂ C on seven vertices, say without loss of generality,P = u1u2 . . . u7 such that u4=u, and G[VC\VP] contains apath P′ = u′

1u′2 . . . u′

6 on at least six vertices. Recall that weassume that the situation under Claim 1 does not occur. So Kcontains a vertex x that has a neighbor u′

i ∈ {u′1, u′

2, u′3} and

K contains a vertex y that has a neighbor u′j ∈ {u′

4, u′5, u′

6}.We note that x = y is possible. Let Q be a path from x to y in

K . Then we define C′ = x−→Q yu′

j

←−P′ u′

ix.Keeping Remark 1 in mind we claim that (C′, u) is an

H9-contraction pair. By definition of C′ and C, we note thatN(u) ∩ VC′ = ∅. We show that N(u) is in the component Fof G[V\(VC′ ∪ {u})] to which v belongs.

Any neighbor y of u not on C is in a component K ′ ∈K\{K}. Since G[V\VC] is connected, v is adjacent to VK ′ .This implies that y is in F. As mentioned above, we assumethat the situation under Claim 1 does not occur. Hence, anycomponent in K has at least one neighbor in {u1, u2, u3} andat least one neighbor in {u5, u6, u7}. Since K contains at leastone other component besides K , we use our assumption thatG[V\VC] is connected again to conclude that also u3 and u5,which are the only neighbors of u on C, are in F. This finishesthe proof of Lemma 3.7. ■

From now on, we may assume that for any pseudo-pair(C, v) of a 3-connected graph G not only G[V\VC] is con-nected, but also all vertices of C have a neighbor in everycomponent of G[V\(VC ∪ {v})]. We say that a block L of agraph K is a leaf-block if L contains at most one cutvertex ofK . Note that a leaf-block in a tree consists of a leaf togetherwith its neighbor. We will show that we may assume thatevery component in G[V\(VC ∪ {v})] contains a vertex thatis adjacent to at least two neighbors in C. First, in Lemma3.8, we show that for components that are not trees we caneven prove something stronger, namely that all its leaf-blockscontain a non-cutvertex (of the whole component) adjacentto at least two vertices on C. We need this extra informationlater on. In Lemma 3.9, we prove that also a component thatis a tree contains a vertex that has two neighbors on C.

Lemma 3.8. Let (C, v) be a pseudo-pair of a 3-connectedgraph G = (V , E) with C = u1u2 . . . upu1 for some p ≥ 15such that G[V\VC] is connected and such that all vertices ofC have a neighbor in every component of G[V\(VC ∪ {v})].Let L be a leaf-block of a component K of G[V\(VC ∪ {v})].

If K is not a tree and the vertices of L that are non-cutverticesof K have at most one neighbor in C, then it is possible tofind an H9-contraction pair of G in polynomial time.

Proof. Let K denote the set of components ofG[V\(VC ∪{v})]. If |K| = 1, then (C, v) is an H9-contractionpair and we are done. So assume |K| ≥ 2. Let K be a com-ponent in K that is not a tree. Let L be a leaf-block of K suchthat all vertices of L that are non-cutvertices of K are adjacentto at most one vertex on C. We will show how to identify anH9-contraction pair of G. It is easy to check that this can bedone in polynomial time.

We distinguish three cases based on the size of VL.

Case 1. |VL| = 1.Then VK = VL = {x} for some x ∈ V\(VC ∪{v}) meaning

that K is a tree. So L contains at least two vertices.

Case 2. |VL| = 2.Then L consists of two adjacent vertices x, y. Since K is

not a tree, only one of those vertices, say x, is a non-cutvertexof K . Since G is 3-connected and we assume that all verticesof L that are non-cutvertices of K have at most one neighboron C, vertex x has a unique neighbor ui on C, and x is adjacentto v as well.

Since K is not a tree, component K contains a block Bthat is not an edge. By definition, B is 2-connected. Thisimplies that B contains a (chordless) cycle C′. Recall that Kcontains at least two components. Let x′ be a non-cutvertexof a component K ′ ∈ K\{K}.

We claim that (C′, x′) is an H9-contraction pair. By def-inition of C′, we find that N(x′) ∩ VC′ = ∅. We show thatN(x′) is in the component F of G[V\(VC′ ∪ {x′})] to which vbelongs.

We first note that any vertex uj ∈ VC is in F due to the

path P = uj−→C uixv. This means that any neighbors of x′ on

C are in F. Suppose y′ is a neighbor of x′ in K ′. Since G is3-connected, component K ′ contains a vertex z′ �= x′ that hasa neighbor uh on C ⊂ F. Since x′ is a non-cutvertex of K ′,there exists a path from y′ to z′ in K ′ that does not use x′.Then we find that y′ is in F. Hence N(x′) is in F.

Case 3. |VL| ≥ 3.Then L contains two adjacent vertices x and y that are both

non-cutvertices of K for which G[VK\{x, y}] is connected.This can be seen as follows. Let x ∈ VL be a non-cutvertexof K . Suppose the only neighbor of x in K is a cutvertex ofK . Then VL would consist of exactly two vertices. So let xbe adjacent to a vertex y ∈ VL that is not a cutvertex of K .Suppose G[VK\{x, y}] is not connected. Then {x, y} is a two-vertex cut of L. Let F be a component in G[VL\{x, y}] thatdoes not contain a cutvertex of K . If |VF | ≥ 2 we take twovertices of F instead of x, y and check whether they are anappropriate choice. Suppose VF = {z}. Then z is adjacent to{x, y}. As a matter of fact N(z) ∩ VK = {x, y}; otherwise x ory would be a cutvertex of K . We choose x, z instead of x, y.

NETWORKS—2008—DOI 10.1002/net 41

Page 11: The Computational Complexity of Graph …gwoegi/papers/contract2.pdfThe Computational Complexity of Graph Contractions II: Two Tough Polynomially Solvable Cases Asaf Levin Department

Suppose G[VK\{x, z}] is not connected. Then x is a cutver-tex of K , but this would contradict our choice of x. Hencewe may indeed assume there exist two adjacent vertices x, ythat are both non-cutvertices of K such that G[VK\{x, y}] isconnected.

Case 3a. Both x and y are not adjacent to VC .Since x is not a cutvertex of K , all neighbors of x in K are in

the same component of G[VK\{x}]. Since y is not a cutvertexof K , all neighbors of y in K are in the same component ofG[VK\{y}]. Then the following statements are easy to see. Ify is not adjacent to v, then (C, y) is an H9-contraction pair ofG. If x is not adjacent to v, then (C, x) is an H9-contractionpair of G. If both [v, x] and [v, y] are edges in G, then (C, x)and (C, y) are both H9-contraction pairs of G.

Case 3b. Only one of the vertices x, y is adjacent to VC .We assume without loss of generality that x has a unique

neighbor ur on C. Since y is not a cutvertex of K , all neighborsof y in K are in the same component of G[VK\{y}]. If v is notadjacent to y, we then find that (C, y) is an H9-contractionpair of G. So we assume that [v, y] ∈ E. If v is adjacent tosome vertex in VK\{y}, we again find that (C, y) is an H9-contraction pair of G. Suppose y is the only vertex in K thatis adjacent to v.

Since L is 2-connected and |VL| ≥ 3, block L contains a(chordless) cycle C′. Let x′ be a non-cutvertex of a componentK ′ ∈ K\{K}. We claim that (C′, x′) is an H9-contraction pairof G. By definition of C′ we find that N(x′) ∩ VC′ = ∅. Weshow that N(x′) is in the component F of G[V\(VC′ ∪ {x′})]to which VC belongs.

Let y′ be a neighbor of x′ not on C. Suppose y′ is in K ′.Then |VK ′ | ≥ 2 and, since G is 3-connected, component K ′contains at least two vertices z′, z∗ that have a neighbor onC. At least one of them, say z′, is not equal to x′. Since x′is not a cutvertex of K ′, there exists a path from y′ to z′ inG[VK ′ \{x′}]. This means that y′ is in F.

Suppose v is a neighbor of x′. If there exists a vertex inVK ′ \{x′} ⊂ VF that is adjacent to v, then v is in F. Supposethe only vertex in K ′ that is adjacent to v is x′. Since G is3-connected, vertex v must be adjacent to some vertex w /∈{x′, y}. Since v is neither a neighbor of VK\{y} nor a neighborof VK ′ \{x′}, vertex w is in some component K∗ ∈ K\{K , K ′}.Since every component of K is adjacent to C, we find that vis in F. Hence we can conclude that N(x′) is in F.

Case 3c. Both vertices x, y are adjacent to VC .Let ur be the unique neighbor of x on C, and let us be

the unique neighbor of y on C. We note that ur = us ispossible. We construct a (chordless) cycle C′ that consists ofthe vertices x, y together with the vertices of a path P betweenur and us on C. Since |VC | ≥ 15, we can choose P in sucha way that G[VC\VP] contains a path Q on five vertices. Weassume without loss of generality that Q = u1u2 . . . u5.

We claim that (C′, u2) is an H9-contraction pair of G. Bydefinition of C′ and C, we note that N(u2) ∩ VC′ = ∅. We

show that N(u2) is in the component F of G[V\(VC′ ∪ {u2})]to which the vertex u3 belongs.

Since C is chordless, vertices u1 and u3 are the only neigh-bors of u2 that are on C. Since G is 3-connected, vertex u1

has a neighbor z in some component K ′ ∈ K. As we assumein the statement of the lemma, VK ′ contains a vertex x′ that isadjacent to u3. If K ′ �= K , we immediately find that u1 is inF. Suppose K ′ = K . Then x′ can neither be equal to x nor toy. Since G[VK\{x, y}] is connected, subgraph G[VK\{x, y}]contains a path from z to x′. Then, also in this case, we findthat u1 is in F. We use the same arguments to prove that allother neighbors of u2 belong to F as well. Hence, N(u2) is inF. This finishes the proof of Lemma 3.8. ■

Lemma 3.9. Let (C, v) be a pseudo-pair of a 3-connectedgraph G = (V , E) with C = u1u2 . . . upu1 for some p ≥ 15such that G[V\VC] is connected and such that all vertices ofC have a neighbor in every component of G[V\(VC ∪ {v})].If there exists a component of G[V\(VC ∪{v})] with no vertexadjacent to at least two vertices on C, then it is possible tofind an H9-contraction pair of G in polynomial time.

Proof. Let K denote the set of components ofG[V\(VC ∪{v})]. If |K| = 1, then (C, v) is an H9-contractionpair and we are done. So assume |K| ≥ 2. Suppose all ver-tices of component T ∈ K are adjacent to at most one vertexon C. We show how to identify an H9-contraction pair of G.It is easy to check that this can be done in polynomial time.

First, if T is not a tree then we are done due to Lemma3.8. So we may assume that T is a tree. Suppose T consistsof a single vertex w. Since G is 3-connected, vertex w musthave at least two neighbors on C. So T contains at least twovertices.

Let x and z be leaves of T . Since G is 3-connected, x hasa neighbor ui on C. Due to our assumption, vertex ui is theonly neighbor of x on C. Let y �= x be the first vertex on theunique path P from x to z in T that has a (unique) neighbor uj

on C. Since z has a neighbor on C, such a vertex y exists. Infact, y = z is possible. We also note that ui = uj is possible.

We construct a (chordless) cycle C′ that consists of thevertices from the path x

−→P y together with the vertices of a

path P′ from ui to uj on C. Since |VC | ≥ 15, we can chooseP′ in such a way that G[VC\VP′ ] contains a path on threevertices. Without loss of generality we assume that these threevertices are u1, u2, u3.

We claim that (C′, u2) is an H9-contraction pair of G. Bydefinition of C′ and C, we find that N(u2) ∩ VC′ = ∅. Weshow that N(u2) is in the component F of G[V\(VC′ ∪ {u2})]to which v belongs.

Since C is chordless, vertices u1 and u3 are the only neigh-bors of u2 that are on C. We first consider u1. Since G is3-connected, vertex u1 has a neighbor z′ in some componentK ′ ∈ K. Suppose K ′ �= T . Then, since G[V\VC] is connected,v has a neighbor in K ′. Then u1 is in F. Suppose K ′ = T .By definition of y, vertex z′ is not on x

−→P y. Then there exists

a path from z′ to a leaf z′′ �= x of T that does not contain avertex of x

−→P y. Since G is 3-connected and all vertices of T

42 NETWORKS—2008—DOI 10.1002/net

Page 12: The Computational Complexity of Graph …gwoegi/papers/contract2.pdfThe Computational Complexity of Graph Contractions II: Two Tough Polynomially Solvable Cases Asaf Levin Department

have at most one neighbor in C, leaf z′′ must be adjacent tov. We find that, also in this case, vertex u1 is in F. In exactlythe same way we prove that u3 is in F. We furthermore notethat all other neighbors of u2, which are not on C, are stillconnected to v, because G[V\VC] is connected. Hence N(u2)

is in F. This finishes the proof of Lemma 3.9. ■

As mentioned before, we may assume that for any pseudo-pair (C, v) of a 3-connected graph G, G[V\VC] is connectedand all vertices of C have a neighbor in every component ofG[V\(VC ∪ {v})]. In Lemma 3.9 we have shown that eachcomponent in G[V\(VC ∪ {v})] can be assumed to contain avertex adjacent to at least two vertices on C. In order to geta complete pseudo-pair of G, we will now show that we mayassume that every vertex in V\VC that has at least two neigh-bors in C is adjacent to all vertices of C. First, in Lemma 3.10we show that this is true for non-cutvertices of componentsin G[V\(VC ∪ {v})] . Then, in Lemma 3.11, we give a prooffor the remaining vertices in V\VC .

Lemma 3.10. Let (C, v) be a pseudo-pair of a 3-connectedgraph G = (V , E) with C = u1u2 . . . upu1 for some p ≥ 15such that G[V\VC] is connected and such that all vertices ofC have a neighbor in every component of G[V\(VC ∪ {v})].Let x be a non-cutvertex of a component of G[V\(VC ∪{v})].If x is adjacent to at least two vertices on C but not to allof them, then it is possible to find an H9-contraction pair inpolynomial time.

Proof. Let K denote the set of components ofG[V\(VC ∪{v})]. If |K| = 1, then (C, v) is an H9-contractionpair and we are done. So assume |K| ≥ 2. Let x be a non-cutvertex in a component K ∈ K that is adjacent to at leasttwo vertices on C, but not to all vertices on C. We will showhow to identify an H9-contraction pair of G. It is easy to checkthat this can be done in polynomial time.

We need to distinguish two cases: either x is not adjacentto a set of three consecutive vertices on C, or x is adjacent toall sets of three consecutive vertices on C.

Case 1. Vertex x is not adjacent to the vertices of some pathP ⊂ C on three vertices.

We assume without loss of generality that P = u1u2u3.Let ur , us be neighbors of x on C such that ur

−→C us does not

contain the vertices u1, u2, u3. Let C′ = xur−→C usx.

Keeping Remark 1 in mind, we claim that (C′, u2) is anH9-contraction pair of G. By definition of C′ and C, we notethat N(u2) ∩ VC′ = ∅. We show that all vertices of N(u2) arein the component F of G[V\(VC′ ∪ {u2})] to which the vertexu1 belongs.

Since C is chordless, vertices u1 and u3 are the only neigh-bors of u2 that are on C. In the statement of the lemma weassume that both u1 and u3 have a neighbor in K . Let y bethe neighbor of u1 in K and let y′ be the neighbor of u3 in K .We note that y = y′ is possible. Since x is adjacent neither tou1 nor to u3, vertices y and y′ are not equal to x. Since x is a

non-cutvertex of K , there exists a path P from y to y′ in K .Hence u3 is in F.

Let z be a neighbor of u2 that is not on C. Suppose z isin K . Clearly, z �= x. Since x is a non-cutvertex of K , thereexists a path from z to y in K . Hence z is in F. Suppose z is inK ′ ∈ K\{K}. As we assume in the statement of the lemma,vertex u1 has a neighbor z′ in K ′ as well. Again we find thatz is in F. Hence, we conclude that N(u2) is in F.

Case 2. Vertex x is adjacent to a vertex on every path P ⊂ Con three vertices.

Since x is not adjacent to all vertices on C, there exists avertex uh ∈ VC with [uh, x] /∈ E. We need to consider twosubcases.

Case 2a. There exists a vertex in VC\{uh} that has aneighbor in VK\{x}.

Then there exists a vertex ui �= uh on C such that ui isthe only vertex of ui

−→C uh−1 that is adjacent to VK\{x}. Let

R = ui+1−→C uh−2 and R′ = uh+2

−→C ui−1. Note that R or R′ may

be empty. However, since |VC | ≥ 15, we find that |VR| ≥ 2or else that |VR′ | ≥ 6. If |VR| ≥ 2 we choose P = R andelse we choose P = R′. We claim that x is adjacent to twovertices ur , us on P. This can be seen as follows. If P = R (so|VR| ≥ 2) then vertex x is adjacent to all vertices on P, dueto the definition of R and our assumption (in the statementof the lemma) that every vertex on C is adjacent to at leastone vertex of K . If P = R′ (so |VR′ | ≥ 6) then x has at leasttwo neighbors on P, due to our assumption that x is adjacentto every set of three consecutive vertices on C. We note thatur , us are not adjacent to uh. This is important for the rest ofour proof of this subcase.

We assume r < s, and we define C′ = xur−→C usx.

With an eye on Remark 1, we claim that (C′, uh) is an H9-contraction pair of G. By definition of C′ and C, we find thatN(uh) ∩ VC′ = ∅. We show that all vertices of N(uh) are inthe component F of G[V\(VC′ ∪ {uh})] to which vertex uh−1

belongs.Since C is chordless, vertices uh−1 and uh+1 are the only

neighbors of uh that are on C. As we assume in the statementof the lemma, both uh−1 and uh+1 have a neighbor in someK ′ ∈ K with K ′ �= K . Hence uh+1 in F. Therefore, all verticesin VC \ VC′ are in F (including ui). Let z′ be a neighbor ofuh that is not on C. Suppose z′ is in K . Clearly, z′ �= x. Sincex is a non-cutvertex of K , there exists a path from z′ to z inK . Recall that z is adjacent to ui. Since ui is in F, we findthat z′ is in F. Suppose z′ is in K ′ ∈ K with K ′ �= K . Bythe statement of the lemma, vertex uh−1 has a neighbor z′′in K ′ as well. Then, again we find that z′ is in F. Hence, weconclude that N(uh) is in F.

Case 2b. There does not exist a vertex in VC\{uh} that hasa neighbor in VK\{x}.

As we assume in the statement of the lemma, uh has aneighbor y in K . Since uh /∈ N(x), we find that y �= x. SupposeVK\{x} is not adjacent to v. If |VK | ≥ 3, then any vertex

NETWORKS—2008—DOI 10.1002/net 43

Page 13: The Computational Complexity of Graph …gwoegi/papers/contract2.pdfThe Computational Complexity of Graph Contractions II: Two Tough Polynomially Solvable Cases Asaf Levin Department

z ∈ VK\{x, y} is only connected to C via a path using x or uh.Since G is 3-connected, this is not possible. We derive thatVK = {x, y}. However, since G is 3-connected, y must have aneighbor ui in VC\{uh}. This contradicts our assumption thatsuch a vertex ui does not exist. Hence, we may assume thatVK\{x} is adjacent to v.

Since |VC | ≥ 15, the path P = uh+2−→C uh−2 has at least

twelve vertices. Then, due to our assumption on N(x) ∩ VC ,path P contains two vertices ur , us that are adjacent to x. Weassume r < s, and we define C′ = xur

−→C usx.

With an eye on Remark 1, we claim that (C′, uh) is anH9-contraction pair of G. By definition of C′ and C, we notethat N(uh) ∩ VC′ = ∅. We show that all vertices of N(uh) arein the component F of G[V\(VC′ ∪ {uh})] to which vertex vbelongs.

Since C is chordless, vertices uh−1 and uh+1 are the onlyneighbors of uh that are on C. By the statement in the lemma,both uh−1 and uh+1 have a neighbor in some K ′ ∈ K withK ′ �= K . Because G[V\VC] is connected, VK ′ is adjacent tov. Hence uh−1, uh+1 are in F. Let z′ be a neighbor of uh thatis not on C. Suppose z′ is in K . Since x is a non-cutvertexof K , the graph G[VK\{x}], whose vertex set is adjacent tov, is connected. This means that z′ is in F. Suppose z′ is inK ′ ∈ K with K ′ �= K . Because G[V\VC] is connected, VK ′ isadjacent to v. Again we find that z′ is in F. We conclude thatN(uh) is in F. This finishes the proof of Lemma 3.10. ■

Lemma 3.11. Let (C, v) be a pseudo-pair of a 3-connectedgraph G = (V , E) with C = u1u2 . . . upu1 for some p ≥ 15such that G[V\VC] is connected and such that all vertices ofC have a neighbor in every component of G[V\(VC ∪ {v})].If there exists a vertex x ∈ V\VC adjacent to at least twovertices on C but not to all of them, then it is possible to findan H9-contraction pair in polynomial time.

Proof. Let K denote the set of components ofG[V\(VC ∪{x})]. If |K| = 1, then (C, v) is an H9-contractionpair and we are done. So assume |K| ≥ 2. Let x ∈ VK forsome K ∈ K be adjacent to at least two vertices on C butnot to all vertices of C. We will show how to identify anH9-contraction pair of G. It is easy to check that this can bedone in polynomial time.

If x is a non-cutvertex of a component of G[V\(VC ∪{v})]then we are done due to Lemma 3.10. Suppose x is a cutvertexof K ∈ K. We first prove the following claim that enables usto create a new pseudo-pair (which will turn out to be anH9-contraction pair).

Claim 1. There exist vertices ur , us, uh with {ur , us} ⊆ N(x)and uh /∈ N(x) such that uh is on ur+2

−→C us−2.

We note that we do allow uh−1, uh+1 to be adjacent to x.We only want to make sure that these two vertices are not in{ur , us}, because later we define a cycle C′ with ur , us on it,such that (C′, uh) turns out to be an H9-contraction pair of G.We can choose ur , us, uh as follows.

Suppose x is adjacent to at most four vertices ua, ub, uc, ud

on C. Since |VC | ≥ 15, we may without loss of generalityassume that ua

−→C ub contains at least five vertices, such that

only vertices ua and ub are adjacent to x. Then we chooseur = ua, us = ub and uh = ua+2.

Suppose x is adjacent to all but one of the vertices on C, sayx is not adjacent to u1. Then we choose uh = u1, ur = up−1

and us = u3.Suppose x is adjacent to all but two vertices on C, say x

is not adjacent to u1 and uj for some j ≥ 2. If j /∈ {3, p − 1}we choose uh = u1, ur = up−1 and us = u3. Otherwise, wechoose uh = u1, ur = up−2 and us = u4. We can do thisbecause p ≥ 15.

Suppose x is adjacent to at least five verticesua, ub, uc, ud , ue with a < b < c < d < e and x is notadjacent to at least three vertices on C. Suppose ub

−→C ud con-

tains a vertex not adjacent to x. Then we let uh be that vertex,and we choose ur = ua and us = ue. Suppose ub

−→C ud only

contains vertices adjacent to x. Then we may without loss ofgenerality assume that ub

−→C ud = ubucud . This implies that

ue−→C ua contains at least twelve vertices, and three of them

are not adjacent to x. We let uh be the second vertex on thepath ue

−→C ua that is not adjacent to x. We choose ur = ud and

us = ub. This finishes the proof of Claim 1.Let ur , us, uh be the vertices of Claim 1. We define C′ =

xur←−C usx and, having Remark 1 in mind, claim that (C′, uh)

is an H9-contraction pair of G. By definition of C′ and C, wefind that N(uh)∩VC′ = ∅. We show that all vertices of N(uh)

are in the component F of G[V\(VC′ ∪ {uh})] to which uh−1

belongs.Since C is chordless, vertices uh−1 and uh+1 are the only

neighbors of uh that are on C. Let K ′ be a componentin K\{K}. As we assume in the statement of the lemma,both uh−1 and uh+1 have a neighbor in K ′. Hence uh+1 isin F.

Let z be a neighbor of uh on K . Then G[VK\{x}] containsa path from z to some vertex y of a leaf-block L of K such thaty is a non-cutvertex of K . Suppose y is adjacent to at leasttwo vertices on C. By Lemma 3.10, we may assume that y isadjacent to all vertices on C (otherwise we are done). As aconsequence, y is adjacent to uh−1. Then z is in F. Suppose yis adjacent to at most one vertex on C, and suppose we can notreplace y by some vertex in L that is a non-cutvertex of K andthat is adjacent to at least two vertices on C. So all verticesin L that are non-cutvertices in K are adjacent to at most onevertex on C. Then, by Lemma 3.8, we may assume that Kis a tree and y is a leaf of K (otherwise we are done). SinceG is 3-connected, y must be adjacent to v. Since G[V\VC]is connected, v is adjacent to a component K∗ ∈ K\{K} andVK∗ is adjacent to uh−1 by the statement of the lemma. Thisway we find that vertex z is in F.

Let z′ be a neighbor of uh on a component K ′ ∈ K\{K}.By the statement of the lemma, uh−1 has a neighbor in K ′.Then z′ is in F.

From the above, we conclude that N(uh) is in F. Thisfinishes the proof of Lemma 3.11. ■

44 NETWORKS—2008—DOI 10.1002/net

Page 14: The Computational Complexity of Graph …gwoegi/papers/contract2.pdfThe Computational Complexity of Graph Contractions II: Two Tough Polynomially Solvable Cases Asaf Levin Department

We can now finally prove that a sufficiently large pseudo-pair of a 3-connected graph may be assumed to be complete.

Lemma 3.12. Let (C, v) be a pseudo-pair of a 3-connectedgraph G = (V , E) with C = u1u2 . . . upu1 for some p ≥15. If (C, v) is not complete then it is possible to find anH9-contraction pair of G in polynomial time.

Proof. Suppose (C, v) is not a complete pseudo-pair ofG. We will show how to identify an H9-contraction pair of G.It is easy to check that this can be done in polynomial time.

First, we may assume that G[V\VC] is connected.Otherwise we are done by Lemma 3.6. Let K denote the setof components of G[V\(VC ∪{x})]. If |K| = 1, then (C, v) isan H9-contraction pair and we are done. So assume |K| ≥ 2.If there exists a component in K with no vertex adjacent to atleast two vertices on C then we are done due to Lemma 3.9.So we may assume that every component K ∈ K has a vertexy adjacent to at least two vertices on C. We may even assumethat such a y is adjacent to all vertices on C. Otherwise weare done due to Lemma 3.11.

Recall that (C, v) would have been a complete pseudo-pairof G if

(i) every vertex in V\(VC ∪ {v}) is adjacent to v, so N(v) =V\(VC ∪ {v};

(ii) every vertex in V\(VC ∪ {v}) is adjacent to all vertices on C.

So (C, v) fails condition (i) or (ii).

Case 1. (C, v) fails (ii).Let x be a vertex of a component K that is not adjacent

to all vertices on C. Then we may assume that x is adjacentto at most one vertex of C. Otherwise we are done due toLemma 3.11. So we assume without loss of generality thatx is not adjacent to VC\{u1} (while x is possibly adjacent tou1). Let K ′ be a component in K\{K}. As we argued above,K ′ contains a vertex y′ adjacent to all vertices on C.

We define C′ = y′u3u4y′ and claim that (C′, x) is an H9-contraction pair of G. Obviously, N(x) ∩ VC′ = ∅. Let u2

belong to component F of G[V\(VC′ ∪ {x})]. We are done ifwe can show N(x) belongs to F.

We first show v ∈ VF . Since G is 3-connected, there existsa path P from v to u2 not using the vertices x, y. Let ui be thefirst vertex of P that is on C, i.e., v

−→P ui does not contain any

other vertices of C except ui. If i ≤ 2 or i ≥ 5, we defineP′ = v

−→P ui

−→C u2. Then v belongs to F, since P′ is a subgraph

of F. Suppose i ∈ {3, 4}. We define P′′ = v−→P ui

←−C u2. We

replace C′ by C′′ = y′u5u6y′ in (C′, x) in order to find v ∈ VF

via P′′. So we may assume without loss of generality that vbelongs to F.

Now let w be a neighbor of x. If w = v, then w belongsto F as we just showed. If w = u1, it is also clear that wbelongs to F. Suppose w ∈ VK . Then G[VK\{x}] contains apath from w to a vertex z in a leaf-block L of K such that z isa non-cutvertex of K . Suppose K is not a tree. Due to Lemma3.9, we may assume that z is adjacent to at least two vertices

on C (as otherwise we are done). Due to Lemma 3.11, wethen may even assume that z is adjacent to all vertices on C,including u2 (as otherwise we are done). Then w is in F.

Suppose K is a tree. Then z is a leaf of K . If z is adjacentto at least two vertices on C, then we may assume that z isadjacent to all vertices on C including u2, due to Lemma 3.11.Then w is in F. Otherwise, since G is 3-connected, z must beadjacent to v. Since v ∈ VF , we find that z, and consequentlyw, belongs to F. This shows that (C′, x) (or else (C′′, x)) isan H9-contraction pair of G.

Case 2. (C, v) fails (i) but does not fail (ii).So we assume that all vertices in V\(VC∪{v}) are adjacent

to all vertices on C. Let x ∈ VK for some component K ∈ Ksuch that x is not adjacent to v. Since x is adjacent to allvertices on C, we define C′ = xu1u2x. Then G[V\(VC′ ∪{v})]is connected because all vertices in V\(VC∪{v}) are adjacentto all vertices on C. Furthermore, v is not adjacent to VC′ .Hence we find that (C′, v) is an H9-contraction pair of G.This finishes the proof of Lemma 3.12. ■

Step 6. Transform a complete pseudo-pair into an H9-contraction pair In the previous step we have shown howour algorithm found an H9-contraction cycle of a 3-connectedgraph G with a “large” pseudo-pair that is not complete. Sowe are left to consider a 3-connected graph G with a com-plete pseudo-pair. In the next lemma we give a sufficient andnecessary condition for a graph with complete pseudo-pairto be H9-contractible.

Lemma 3.13. Let (C, v) with |VC | ≥ 15 be a completepseudo-pair of a 3-connected graph G = (V , E) that is not anH9-contraction pair of G. Then G has an H9-contraction pairif and only if G[N(v)] contains a cycle on at most |N(v)| − 2vertices.

Proof. Suppose G has an H9-contraction pair (C′, v′). Ifv′ = v, then C′ = C, and (C, v) would be an H9-contractionpair. If C′ = C, then v′ = v, and (C, v) would be an H9-contraction pair. So we find that v′ �= v and C′ �= C.

Suppose v′ is on C. Since (C, v) is a complete pseudo-pairof G, vertex v′ is adjacent to all vertices in N(v) = V\(VC ∪{v}). Then the cycle C′ does not contain any vertex of N(v).Since C′ �= C, we find that v′ can not be on C. Then v′must be in N(v). This means that v′ is adjacent to v andto all vertices on C. Hence C′ only consists of vertices inV\(VC ∪ {v}) = N(v). Suppose C′ ∪ {v′} = N(v). Thenv ∈ N(v′) and VC ⊂ N(v′) are in different components ofG[V\(VC′ ∪ {v′})]. Hence, we conclude that C′ is a cycle inG[N(v)] that contains at most |N(v)| − 2 vertices.

For the other direction of the proof, suppose G[N(v)]contains a cycle C′ on at most |N(v)| − 2 vertices. Let VC′

be in component K of G[N(v)]. Since (C, v) is not an H9-contraction pair of G, there exists a vertex v′ adjacent to vthat is in some component K ′ of G[N(v)] with K ′ �= K .

We claim that (C′, v′) is an H9-contraction pair of G. Sinceall the neighbors of v′ are in VK ′ ∪ VC ∪ {v}, we find that

NETWORKS—2008—DOI 10.1002/net 45

Page 15: The Computational Complexity of Graph …gwoegi/papers/contract2.pdfThe Computational Complexity of Graph Contractions II: Two Tough Polynomially Solvable Cases Asaf Levin Department

N(v′) ∩ VC′ = ∅. We show that all neighbors of v′ belong tothe component F in G[V\(VC′ ∪ {v′})] to which v belongs.

Let z be a neighbor of v′ not equal to v. Suppose z is in K ′.Then z ∈ N(v). This means that z is in F. Suppose z is on C.Since C′ contains at most |N(v)| − 2 vertices, there exists avertex w ∈ N(v)\(VC′ ∪ {v′}). Vertex w is adjacent to z andadjacent to v. This means that z is in F. Hence, we concludethat N(v′) is in F. ■

We are now ready to state the following theorem for 3-connected graphs.

Theorem 5. Let G be a 3-connected graph. It is possible inpolynomial time either to find H9-witness sets of G, or elseto conclude that G is not H9-contractible.

Proof. Let G = (V , E) be a 3-connected graph. Dueto Lemma 3.3 we can restrict ourselves to finding an H9-contraction pair of G. Obtaining H9-witness sets from an H9-contraction pair in polynomial time is straightforward (seee.g. the proof of Lemma 3.3).

Due to Lemma 3.4 we can find in polynomial time an H9-contraction pair (C, v) of G with |VC | ≤ 14, if G has sucha pair. Otherwise, due to Lemma 3.5, we can, in polynomialtime, either find a pseudo-pair (C′, v′) of G with |VC′ | ≥ 15,or else conclude that G does not have an H9-contraction pair.

Suppose we find a pseudo-pair (C′, v′) of G with |VC′ | ≥15. It is easy to see that we can check in polynomialtime whether (C′, v′) is complete. If (C′, v′) is not a com-plete pseudo-pair then, due to Lemma 3.12, we can find anH9-contraction pair in polynomial time.

Suppose the pseudo-pair (C′, v′) is complete. Then byusing Lemma 3.13, it remains to check in polynomial timewhether G[N(v)] contains a cycle C′′ on at most |N(v)| − 2vertices. This can be done as follows. We guess a pairof vertices x1, x2 in G[N(v)] not to be on C′′. We thenapply the Breadth-First-Search algorithm (BFS) in the graphG[N(v)\{x1, x2}]. If the BFS algorithm finds a back-edgethen we find a desired cycle. If not, then we take anotherpair x3, x4 and repeat the above procedure with the graphG[N(v)\{x3, x4}]. ■

Because of Corollary 4 and Theorem 5 we immediatelyobtain the main result of this section.

Corollary 6. The H9-Contractibility problem is solvablein polynomial time. Moreover, if a graph G is H9-contractible,an H9-witness structure of G can be found in polynomial time.

4. ANOTHER TOUGH POLYNOMIALLYSOLVABLE CASE

The graph Wk that is obtained from a cycle C on k verticesfor some integer k ≥ 3 by adding a new vertex adjacent toall vertices of C is called a wheel on k + 1 vertices. Then thepattern graph H10 = W4 (cf. Fig. 1).

We denote the dominating vertex of a wheel Wk by x, andthe other vertices by y1, . . . yk such that [yi, yi+1] ∈ EWk for1 ≤ i ≤ k−1 and [yk , y1] ∈ EWk . If a graph G = (V , E) is Wk-contractible with witness sets W(x) and W(y1), . . . , W(yk)

then we denote X := W(x) and Yi := W(yi) for i = 1, . . . , k.Unlike the wheel W3 = K4, wheels on more than four

vertices are no longer complete graphs. This makes thecorrectness proof of a polynomial time algorithm for theW4-Contractibility problem more complicated. Below weprovide a polynomial time algorithm for the pattern graphH10 = W4. Given a graph G, our algorithm either concludesthat G is not W4-contractible, or finds W4-witness sets of G. InSection 4.1 we give an intuitive description of our algorithm,and in Section 4.2 we discuss it in detail.

4.1. Outline of the Algorithm

We will proceed as follows.

Step 1. Increase the connectivity as much as possible.We first try to restrict ourselves to p-connected input graphsG = (V , E) with p as high as possible. The intuitive rea-son behind this is that W4-contractible graphs with a higherconnectivity are expected to have witness structures that areeasier to analyze than those with lower connectivity. We didnot succeed in showing p ≥ 4 but we could show that wemay choose p = 3. First we show that p ≥ 2 by usingLemma 2.1: if our input graph G is 1-connected then our algo-rithm only has to find a block of G that is W4-contractible.So from now on we can assume that G is 2-connected. InLemma 4.1 we give a necessary and sufficient condition forG to be W4-contractible. In Corollary 7 we show that ouralgorithm may break G into a polynomial number of smaller3-connected parts that can be processed one by one.

Step 2. Decrease the search space of possible W4-witnessstructures. As explained in Step 1, we now may assumethat G is 3-connected. This has the following advantage: if Gcontains a chordless cycle C = v1v2 . . . vpv1 with p ≥ 4 suchthat G[V\VC] is connected, then G is W4-contractible. Thiscan be seen as follows. Since all vertices of G have degreeat least three, any vertex on C has a neighbor in G[V\VC].Hence, G is W4-contractible with witness sets Y1 = {vi} for1 ≤ i ≤ 3, Y4 = {v4, . . . , vp} and X = V\VC . This is why wecall C a W4-contraction cycle of G (see Fig. 7 for an illus-tration of a W4-contraction cycle C.) In Lemma 4.2 we showthat having a W4-contraction cycle is not only a sufficient butalso a necessary condition for a 3-connected graph to be W4-contractible. This structural result restricts the search spaceof possible witness structures considerably.

Step 3. Find a chordless cycle on at least four vertices anddo some easy checks. As explained in the previous step, inthis stage our algorithm searches for a W4-contraction cycleof G (although it sometimes finds W4-witness sets directly).We observe that a chordless cycle C on at least four verticesis not necessarily a W4-contraction cycle of G. It may happen

46 NETWORKS—2008—DOI 10.1002/net

Page 16: The Computational Complexity of Graph …gwoegi/papers/contract2.pdfThe Computational Complexity of Graph Contractions II: Two Tough Polynomially Solvable Cases Asaf Levin Department

FIG. 7. An example graph G with a W4-contraction cycle C over fivevertices of G.

that G[V\VC] contains more than one component. However,to get started, any chordless cycle will do. If we find one thatis not a W4-contraction cycle, then we just perform a numberof (efficient) checks on G with respect to C, in order to seeif we can modify C into a W4-contraction cycle. If not wemove on to Step 4. Below we will explain the checks.

First, in Lemma 4.3, we show that we can find a chordlesscycle on at least four vertices in polynomial time if G hassuch a cycle. Otherwise, if G does not have such a cycle, thenG does not have a W4-contraction cycle, and hence is not W4-contractible. So assume G has a chordless cycle C on at leastfour vertices. Let K be the set of components of G[V\VC].We show in Lemma 4.4 that G is W4-contractible if one ofthe following cases is true:

(i) there exists a vertex v ∈ VC that is not adjacent to any vertexin some K ∈ K;

(ii) |K| = 1 or |K| ≥ 3;(iii) there exists a component K ∈ K that contains two vertices u1

and u2 that are both adjacent to all vertices of C.

These three conditions are easy to check. Our algorithm stopsif one of them is true. Then, due to Lemma 4.5, we can finda W4-witness structure in polynomial time. Now suppose allthree conditions are false. Then |K| = 2, say K = {K , K ′},so V = VC ∪ VK ∪ VK ′ . We then say that C induces a basicstate (C, K , K ′) of G. So, a basic state (C, K , K ′) of G has thefollowing two properties.

(1) Every vertex in C has a neighbor in both K and K ′.(2) Both K and K ′ contain at most one vertex that is adjacent to

all vertices of C.

Step 4. Decrease the size of one of the two remaining com-ponents. As explained in the previous step, by now we havea basic state (C, K , K ′) of G. If we can somehow completelyeliminate K then we have found a W4-contraction cycle, andwe can stop. So, our next goal is to decrease the size of one ofthe components, say K , as much as possible. We can do thisby considering chordless cycles of G[VC ∪ VK ] that have atleast one vertex of K (so they cannot be equal to C itself). LetD be such a cycle. First we check whether D induced a basicstate. If not, then we are done as we explained in Step 3. Inthe other case, i.e., if we find a basic state (D, L, L′), then we

show in Lemma 4.6 that L is a proper subgraph of K . Then, inLemma 4.7, we show that we can repeat this argument againand again, in polynomial time, until we end in one of the fol-lowing two situations: either we found a W4-witness structureof G, or else we cannot decrease the first component of thebasic state anymore (by using this technique). In the lattercase, we say that the basic state is an advanced state of G(see Fig. 8 for an illustration of an advanced state (C, K , K ′)where K = {u}). So an advanced state of G is a basic statewith the extra property that the subgraph of G induced bythe vertices in the cycle and in the component we tried todecrease does not contain a chordless cycle on at least fourvertices with at least one vertex not on the cycle. We have tofind a new technique that deals with advanced states.

Step 5. Detect a vertex adjacent to all vertices in the cycleand do an easy check. By now, we have an advanced state(C, K , K ′). Since any advanced state is also a basic state, bydefinition, K contains at most one vertex adjacent to all ver-tices of C. In Lemma 4.8, we show that such a vertex u indeedexists, and we call u the main vertex of K . We call a chord-less cycle D that has at least four vertices and that containsu, a u-cycle of G. In Lemma 4.9, we further analyze u-cyclesand find that any u-cycle contains one vertex of K (namelyu itself), exactly two (non-adjacent) vertices of C, called theC-vertices of D, and at least one vertex of K ′. Since, by defi-nition, K ′ is connected and every vertex in C has a neighborin K ′, graph G has at least one u-cycle for every pair vi, vj ofC-vertices. However, only u-cycles of a special type specifiedbelow turn out to be useful. Since C contains at least four ver-tices and C-vertices vi, vj are not adjacent, the disjoint paths

P1 = vi+1−→C vj−1 and P2 = vj+1

−→C vi−1 are non-empty. If

the vertices of P1 and P2 belong to a common component in

FIG. 8. An example graph G with advanced state (C, {u}, K ′), and a correctu-cycle uaww′bu.

NETWORKS—2008—DOI 10.1002/net 47

Page 17: The Computational Complexity of Graph …gwoegi/papers/contract2.pdfThe Computational Complexity of Graph Contractions II: Two Tough Polynomially Solvable Cases Asaf Levin Department

G[V\VD], then we say that D is a correct u-cycle of G. SeeFigure 8 for an example. Note that a correct u-cycle is notnecessarily a W4-contraction cycle of G. However, Lemma4.10 explains that this fact does not matter: if G has a correctu-cycle, then G is W4-contractible. Lemma 4.11 shows thatcorrect u-cycles, in case they exist, can be found in polyno-mial time. So, our algorithm finishes as soon as it has founda correct u-cycle of G. If G does not have a correct u-cycle,our algorithm needs to perform a new step.

Step 6. Reduce the size of the vertex set. By now, wehave an advanced state (C, K , K ′) such that K has a mainvertex u with no correct u-cycles. Lemma 4.12 shows thatin such a case all W4-contraction cycles of G (if they exist)do not contain a vertex of K . So far our algorithm has notreduced the size of G itself. However, as soon as we find outthat two adjacent vertices u and v of G will never be on anyW4-contraction cycle C of G then both u and v will be inwitness set X. (This is, of course, under the assumption thatG is W4-contractible.) Hence, we can contract the edge [u, v]and apply our algorithm on the resulting graph. We show thatwe can indeed perform such contractions. First we considerthe case in which K contains more than one vertex. We usethe information provided by Lemma 4.12. In Lemma 4.13,we show that our algorithm can remove all vertices of K notequal to u: the obtained graph is W4-contractible if and onlyif G is W4-contractible. So, we define G := G[V\(VK\{u})]with advanced state (C, {u}, K ′) and without any correct u-cycles. Our purpose is to reduce the size of V even more. Wefirst show in Lemma 4.14 that all W4-contraction cycles ofG (if they exist) contain at most two vertices of G such thatif there are two such vertices then they are adjacent. Then inLemma 4.15 we show that we may contract an edge [u, v] forany v ∈ C such that the resulting graph is W4-contractibleif and only if G is W4-contractible. Our algorithm returns toStep 3 with a smaller 3-connected graph as input. Finally, inTheorem 9 and Corollary 10, we prove the correctness of thewhole algorithm and show that it runs in polynomial time.

4.2. The Algorithm Itself

As explained in Section 4.1, our polynomial time algo-rithm for solving the W4-Contractibility problem per-forms six steps. Here we describe them in more detail. Wecould prove some statements regarding Wk-contractibility forall k ≥ 4. However, at some moment we need to restrictourselves to k = 4: the computational complexity of theWk-Contractibility problem for k ≥ 5 is still open.

Step 1. Increase the connectivity as much as possible.Note that every wheel Wk is 2-connected. Hence, we canrestrict ourselves to 2-connected input graphs due to Lemma2.1. Since every wheel Wk is 3-connected, we can even provea stronger result by using the following lemma. Recall that,for an induced subgraph F of a graph G = (V , E) and twovertices u, v ∈ V\VF , we write F +[u, v] to denote the graphobtained from G[VF ∪ {u, v}] after adding the edge [u, v].

Lemma 4.1. Let {u, v} be a 2-vertex cut of a 2-connectedgraph G = (V , E), and let k ≥ 3. Then G is Wk-contractibleif and only if there exists a component F ∈ G[V\{u, v}] suchthat F + [u, v] is Wk-contractible.

Proof. Let C denote the set of all components inG[V\{u, v}]. Suppose G is contractible to Wk . There are twocases to consider.

Case 1. Vertices u and v are in two different witness setsW(i) and W(j) of G. The witness sets of u and v must beadjacent because otherwise u or v is a cutvertex of G implyingthat G is not 2-connected. Since {u, v} is a 2-vertex cut, thevertices in the other three witness sets must all belong to thesame component F of C. We remove all vertices in W(i) ∪W(j) not in VF ∪ {u, v}. Note that the two resulting witnesssets W ′(i) and W ′(j) are still connected. However, there mightnot be an edge between W ′(i) and W ′(j). By adding the edge[u, v] we obtain a Wk-contractible graph.

Case 2. Vertices u and v are in the same witness set W(i) ofG. Since {u, v} is a 2-vertex cut, the vertices in the other fourwitness sets must all belong to the same component F of C.In this case, removing all vertices in W(i) that are not in VF ∪{u, v} and adding the edge [u, v] results in a Wk-contractiblegraph.

For the other direction of the proof, suppose there existsa component F ∈ C such that F + [u, v] is Wk-contractible.Since we can contract G[V\VF] to the graph ({u, v}, {[u, v]}),it is clear that G is Wk-contractible as well. ■

Corollary 7. Let k ≥ 3. If the Wk-Contractibilityproblem is solvable in polynomial time for the class of3- connected graphs, then the Wk-Contractibility problemis solvable in polynomial time.

Proof. Let k ≥ 3 and assume that the Wk-Contractibility problem is solvable in polynomial timefor the class of 3-connected graphs. Let G = (V , E) be agraph. The number of blocks of G is O(|V |), and we can findall blocks of G in polynomial time. Since Wk is 3-connected,and consequently 2-connected, we can use Lemma 2.1. Henceit is sufficient to verify each block of G. Furthermore, we canfind out in polynomial time whether a block B of G is 3-connected. If not, we can find a 2-vertex cut {u, v} of B withset C of components in B[VB\{u, v}] in polynomial time. Dueto Lemma 4.1, we only have to check whether there existssome F ∈ C such that F + [u, v] is Wk-contractible. If someF + [u, v] with F ∈ C is not 3-connected, we repeat the pro-cedure with respect to F +[u, v]. This way we find a total setof O(|V |) 3-connected graphs, and each of these has at most|V | vertices. We check each of them. ■

Because of Corollary 7 we will only consider 3-connectedinput graphs from now on.

48 NETWORKS—2008—DOI 10.1002/net

Page 18: The Computational Complexity of Graph …gwoegi/papers/contract2.pdfThe Computational Complexity of Graph Contractions II: Two Tough Polynomially Solvable Cases Asaf Levin Department

Step 2. Decrease the search space of possible W4-witnessstructures. We show that a 3-connected graph G is Wk-contractible if and only if G has a Wk-contraction cycle, i.e.,a chordless cycle C = v1v2 . . . vpv1 with p ≥ k such thatG[V\VC] is connected.

Lemma 4.2. Let k ≥ 3. A 3-connected graph G is Wk-contractible if and only if G has a Wk-contraction cycle.

Proof. Suppose G has a Wk-contraction cycle C =v1v2 . . . vpv1. Since all vertices of a 3-connected graph Ghave degree at least three, any vertex on C has a neighborin G[V\VC]. Hence, G is Wk-contractible with Wk-witnesssets Yi = {vi} for 1 ≤ i ≤ k − 1, Yk = {vk , . . . , vp} andX = V\VC (note that by definition G[X] is connected).

To prove the reverse implication, let G = (V , E) be3-connected and Wk-contractible with witness sets X andY1, . . . , Yk . We say that a cycle C in G[Y1 ∪ · · · ∪ Yk] is acycle over Y1, . . . , Yk if C contains some vertices ui, vi ∈ Yi

(with possibly ui = vi) for i = 1, . . . , k such that [ui−1, vi]for i = 2, . . . , k and [uk , v1] are the only edges of C betweentwo different witness sets.

We apply the following procedure to obtain witness setsX∗ and Y∗

1 , . . . , Y∗k such that every neighbor of X∗ is on every

cycle over Y∗1 , . . . , Y∗

k . As long as there exists a cycle C overY1, . . . , Yk that does not contain a vertex z ∈ N(X) ∩ Yi forsome 1 ≤ i ≤ k, move z to X . If z is a cutvertex of G[Yi],this operation results in a disconnected witness set Y ′

i . Notethat in this case all vertices of VC ∩ Yi are contained in oneof the connected components, and we move all vertices thatbelong to the other components of G[Yi\{z}] to X as well. Wenote that in each such iteration the size of X increases, andtherefore this procedure terminates at some point.

Let C = v1v2 . . . vpv1 be an arbitrary cycle overY∗

1 , . . . , Y∗k . From the above we find that C contains all

|N(X∗)| ≥ k neighbors of X∗. We now prove that everyvertex of C is a neighbor of X∗. Suppose vi ∈ VC is nota neighbor of X∗. Let vh be the vertex in VC ∩ N(X∗) suchthat vi

←−C vh+1 does not contain any neighbors in X∗. Let vj be

the vertex in VC ∩N(X∗) such that vi−→C vj−1 does not contain

any neighbors in X∗. Because G is 3-connected, there existsa path P = u1 . . . ur in G from vi = u1 to a vertex ur in X∗such that vh and vj are not on P. Without loss of generalitywe may assume the following. First, P is an induced path inG and P contains at most one edge between any two differentwitness sets Y∗

s and Y∗t as otherwise we can easily redefine P.

Second, vi is the only vertex of P on vh+1−→C vj−1 as otherwise

we can redefine vi to be the last such vertex along P (notethat since vh+1

−→C vj−1 does not contain neighbors of X , this

re-definition of vi can be made).Since N(X∗) ⊆ VC , path P must contain a vertex of C.

We let uq ∈ VP\{vi} be the first vertex of P on C, i.e., vertexuq ∈ VC and ui /∈ VC for i = 2, . . . , q−1. By definition of P,

vertex uq is on the path vj+1−→C vh−1. Then either vi

−→C uq

←−P vi

is a cycle over Y∗1 , . . . , Y∗

k that does not contain vertex vh ∈N(X∗), or else vi

−→P uq

−→C vi is a cycle over Y∗

1 , . . . , Y∗k that does

not contain vj ∈ N(X∗). In both cases we have constructeda cycle over Y∗

1 , . . . , Y∗k not containing all neighbors of X∗.

This is again a contradiction. So the vertex set of any cycleover Y∗

1 , . . . , Y∗k consists of N(X∗).

Let C be a cycle over Y∗1 , . . . , Y∗

k . Then C is chordless.Otherwise we can easily construct a shorter cycle C′ overY∗

1 , . . . , Y∗k which would not contain all neighbors of X∗. We

finish the proof by showing that each G[Y∗i ] only contains

vertices of C. Then, since C is chordless, each G[Yi] is a pathas is desired.

Suppose a witness set, say Y∗1 , contains a vertex w1 that is

not on C. Since VC = N(X∗), vertex w1 is not adjacent to X∗.We assume without loss of generality that w1 is adjacent to avertex v on VC ∩ Y∗

1 . Because G is 3-connected, there existsa path Q = w1 . . . wr in G from w1 to a vertex wr in X∗ suchthat v is not on Q. Without loss of generality we assume thatQ is an induced path in G and that Q contains at most oneedge between any two different witness sets Y∗

s and Y∗t .

Since N(X∗) = VC , path Q must contain a vertex of C.We let wj ∈ VQ be the first vertex of Q on C, i.e., vertexwj ∈ VC and wi /∈ VC for i = 1, . . . , j − 1. Suppose wj isnot in Y1. Then we may without loss of generality assumethat wj is in Y2. Then the cycle C′ = w1

−→Q wj

−→C vw1 is a

cycle over Y∗1 , . . . , Y∗

k containing a vertex (namely vertex w1)not adjacent to X∗. This is a contradiction. Suppose wj is

in Y1. Then either w1−→Q wj

−→C vw1 or else w1v

−→C wj

←−Q w1 is a

cycle over Y∗1 , . . . , Y∗

k containing vertex w1 /∈ N(X∗). Hence,G[Y∗

i ] contains only vertices of C. ■

Note that any Wk-contractible graph G with k ≥ 4 is alsoWj-contractible for 3 ≤ j ≤ k − 1. So Wk-contractibility isa necessary condition for Wk+1-contractibility. As a directconsequence of Lemma 4.2 we can even strengthen thisobservation.

Corollary 8. Let G be a 3-connected graph that is Wk-contractible for some k ≥ 3. If G does not contain aWk-contraction cycle C on k vertices, then G is not Wk+1-contractible.

In the rest of this section we will concentrate on theW4-Contractibility problem. We will present a polyno-mial time algorithm that either finds a W4-witness structureof a 3-connected graph G, or else outputs that G is notW4-contractible.

Step 3. Find a chordless cycle on at least four vertices anddo some easy checks. The next lemma provides us with a‘start state’ for the algorithm.

Lemma 4.3. Let G be a 3-connected graph. It is possiblein polynomial time either to find a chordless cycle C on atleast four vertices, or else to conclude that G is not W4-contractible.

Proof. For each three vertices u, v, w of G that inducea path uvw in G we proceed as follows. We remove v and

NETWORKS—2008—DOI 10.1002/net 49

Page 19: The Computational Complexity of Graph …gwoegi/papers/contract2.pdfThe Computational Complexity of Graph Contractions II: Two Tough Polynomially Solvable Cases Asaf Levin Department

N(v)\{u, w}. Then we compute (in polynomial time) a short-est path P from w to u in the resulting graph G′. If such aninduced path P of G′ indeed exists, then uvw

−→P u is a chord-

less cycle on at least four vertices in G. Otherwise we guessanother triple of vertices of G and so on.

If G contains a chordless cycle C = v1v2 . . . vpv1 on p ≥ 4vertices, then we will find a chordless cycle by performing theabove procedure for the triple (v1, v2, v3). Hence, G does notcontain a chordless cycle on at least four vertices, if we havenot found it after considering all O(|V |3) possible triples. Inthat case G is not W4-contractible due to Lemma 4.2. ■

Suppose for the 3-connected input graph G we found achordless C cycle on at least four vertices. The followinglemma describes the three easy situations in which we canimmediately conclude that G is W4-contractible.

Lemma 4.4. Let G = (V , E) be a 3-connected graph thatcontains a chordless cycle C on at least four vertices. LetK denote the set of components in G[V\VC]. Then G is W4-contractible if one of the following cases is true:

(i) there exists a vertex v ∈ VC that is not adjacent to any vertexin some K ∈ K;

(ii) |K| = 1 or |K| ≥ 3;(iii) there exists a component K ∈ K that contains two vertices u1

and u2 that are both adjacent to all vertices of C.

Proof. We write C = v1v2 . . . vpv1 with p ≥ 4. We firstprove that G is W4-contractible if (i) holds. Suppose vi ∈ VC isnot adjacent to any vertex of K ∈ K. Since G is 3-connected,VK is adjacent to at least three vertices of C. Let vh, vj betwo vertices in N(VK ) ⊆ VC such that K has a neighbor inneither vh+1

−→C vi nor vi

−→C vj−1. Let L ⊆ K be the set of all

components of G[V\VC] that only have neighbors on vh−→C vj,

i.e., N(VL) ⊆ Vvh

−→C vj

for all L ∈ L.

We will show that G is W4-contractible with the followingwitness sets: Y1 = {vh}, Y2 = V

vh+1−→C vj−1

∪ ⋃L∈L VL, Y3 =

{vj}, Y4 = VK , and X = V\(Y1 ∪ Y2 ∪ Y3 ∪ Y4). Obviously,the subgraphs G[Y1], G[Y3] and G[Y4] are connected. SinceG is 3-connected, any component in L has a neighbor onvh+1

−→C vj−1. Hence G[Y2] is connected. Since K does not

belong to L, its vertex set has a neighbor in vj+1−→C vh−1. This

implies that vj+1−→C vh−1 is non-empty, and hence [vj, vh] is

not an edge of EG. Then it is clear that G[Y1 ∪ Y2 ∪ Y3 ∪Y4] is contractible to a chordless cycle on four vertices. Bydefinition of L, every component in K\L has a neighbor onvj+1

−→C vh−1. Then the induced subgraph G[X] is connected.

We are left to show that there is an edge between X and Yi

for all 1 ≤ i ≤ 4.Obviously, both Y1 and Y3 are adjacent to X . Recall that

Y4 = VK has a neighbor in X as well. Since G is 3-connected,there exists a path P from vi ∈ Y2 to a vertex u in K thatcontains neither vh nor vj. Hence, P must contain a vertex in

vj+1−→C vh−1 ⊂ G[X].

We now prove that G is W4-contractible if (ii) holds. Thecase in which K contains only one component is trivial. Sup-pose K has at least three components. We assume that (i) isnot valid, i.e., every vertex vi ∈ VC is adjacent to the vertexset of every component in K.

Let K , K ′ be two different components in K. We claimthat G is W4-contractible with witness sets Y1 = {v1}, Y2 =VK , Y3 = {v3}, Y4 = VK ′ , and X = V\(Y1 ∪ Y2 ∪ Y3 ∪ Y4).Obviously, G[Y1 ∪Y2 ∪Y3 ∪Y4] is contractible to a chordlesscycle on four vertices. So we are left to show that G[X] isconnected and that every Yi has a neighbor in X .

Let L be a component in K\{K , K ′}. Since (i) is not valid,all vertices of C have a neighbor in L. Hence there is a path(going through L) from v2 to v4 in G[X]. Since v2 is adjacentto the vertex sets of all components of K, the subgraph G[X]is connected and every Yi has a neighbor, namely v2, in X.

Finally, we show that G is W4-contractible if (iii) holds.We assume that (i) and (ii) are not valid for C. Since (ii)is not valid, G[V\VC] consists of exactly two componentsK and K ′. Suppose K contains two vertices u1 and u2 thatare adjacent to all vertices of C. Since (i) is not valid, wemay assume that every vi ∈ VC has a neighbor in K ′. Letw be a neighbor of v1 in K ′ and let z be a neighbor of v3

in K ′. Since K ′ is connected, K ′ contains a path P from wto z. Suppose t ∈ VP\{w, z} is a neighbor of v1. Then weconsider the subpath from t to z instead of P. If t ∈ VP\{w, z}is a neighbor of v3, then we consider the subpath from wto t instead of P. Hence, we may without loss of generalityassume that the cycle C′ = u1v1w

−→P zv3u1 is a chordless cycle

of G on at least four vertices.If one of the vertices of C′ is not adjacent to the vertex set

of a component in G[V\VC′ ], then G is W4-contractible due to(i). Suppose every vertex of C′ is adjacent to the vertex set ofevery component in G[V\VC′ ]. We will show that G[V\VC′ ]is connected implying that G is W4-contractible.

Because u2 is adjacent to all vertices in C, the verticesu2, v2, v4, . . . , vp all belong to the same component L ofG[V\VC′ ]. Suppose s ∈ V\VC′ is not in L. Then s is a vertexof K or of K ′. Suppose s is in K . Let L′ be the component ofG[V\VC′ ] that contains s. Then, since VC ⊆ VL∪VC′ , we con-clude that L′ is contained in K . If w does not have a neighborin L′, then G is W4-contractible due to (i). Let s′ be a neighborof w in L′ ⊂ G[V\VC′ ]. Then s′ �∈ VK and this contradictsthe fact that L′ ⊆ K . If s is a vertex of K ′, we can apply asimilar argument to obtain a contradiction. Hence, G[V\VC′ ]is connected implying that G is W4-contractible. ■

Let G be a 3-connected graph with a chordless cycle Con at least four vertices. Recall that in case G[V\C] consistsof exactly two components K and K ′ then G induces a basicstate (C, K , K ′) of G, so

(1) every vertex in C has a neighbor in both K and K ′, and(2) both K and K ′ contain at most one vertex that is adjacent to

all vertices of C,

By checking the three conditions (i)-(iii) of Lemma 4.4, it canbe verified in polynomial time whether a chordless cycle C on

50 NETWORKS—2008—DOI 10.1002/net

Page 20: The Computational Complexity of Graph …gwoegi/papers/contract2.pdfThe Computational Complexity of Graph Contractions II: Two Tough Polynomially Solvable Cases Asaf Levin Department

at least four vertices induces a basic state of a 3-connectedgraph G or not. As a direct consequence of (the proof of)Lemma 4.4, we find the following.

Lemma 4.5. Let G be a 3-connected graph with chordlesscycle C on at least four vertices. If C does not induce abasic state, then a W4-witness structure of G can be found inpolynomial time.

Step 4. Decrease the size of one of the two remaining com-ponents. Our next goal is to decrease the size of componentK of a basic state (C, K , K ′) of a 3-connected input graph Gas much as possible. For this purpose we need the followinglemma.

Lemma 4.6. Let (C, K , K ′) be a basic state of a 3-connectedgraph G such that G[VC ∪ VK ] contains a chordless cycle Dthat has at least four vertices and that has at least one vertexin K. Then G is W4-contractible or D induces a basic state(D, L, L′) of G with L ⊂ K.

Proof. If D does not induce a basic state of G, then Gis W4-contractible due to Lemma 4.5. Suppose D induces abasic state (D, L, L′) of G. Since (C, K , K ′) is a basic stateof G, all vertices of C have a neighbor in K ′. Then we canchoose L′ to be the component that contains all vertices inVK ′ ∪VC\VD (plus possibly some vertices of K). This meansthat all vertices in L are in VK\VD. Since D contains at leastone vertex of K , we find that VL ⊆ VK\VD is a proper subsetof VK . ■

Let (C, K , K ′) be a basic state of a 3-connected graph G =(V , E). Recall that (C, K , K ′) is an advanced state if G[VC ∪VK ] does not contain a chordless cycle D on at least fourvertices with at least one vertex in K . Note that if (C, K , K ′)is an advanced state of G, then any W4-contraction cycle Dof a W4-contractible, 3-connected graph G must contain atleast one vertex of K ′. We now show it is possible to find anadvanced state of G in polynomial time.

Lemma 4.7. Let (C, K , K ′) be a basic state of a 3-connectedgraph G. It is possible in polynomial time either to find aW4-witness structure of G, or else to find an advanced state(D, L, L′) of G.

Proof. Let (C, K , K ′) be a basic state of a 3-connectedgraph G = (V , E). We apply the following procedure. Weconsider all O(|V |3) triples u, v, w in VC ∪ VK that inducea path uvw in G[VC ∪ VK ] with {u, v, w} ∩ VK �= ∅, untilwe find such a triple u, v, w for which there exists a path Pfrom w to u in G[(VC ∪ VK )\({v} ∪ N(v))]. If we do not findsuch a path P for any triple, then (C, K , K ′) is an advancedstate. Otherwise, in case we do find such a path P, the cycleD = uvw

−→P u is a chordless cycle of G[VC ∪ VK ] that has at

least four vertices and that contains at least one vertex in K . ByLemma 4.6, graph G is either W4-contractible or D induces abasic state (D, L, L′) of G with L ⊂ K . Note that we can check

in polynomial time whether D induces a basic state of G. IfD does not induce a basic state, then we can find W4-witnesssets of G in polynomial time according to Lemma 4.5. If Dinduces a basic state (D, L, L′) of G with L ⊂ K , then weapply the whole procedure again, but this time with respectto D. After considering a sequence of O(|V |) chordless cyclesDi that induce basic states (Di, Li, L′

i) of G, in which the sizeof Li is strictly decreasing, we have either found W4-witnesssets of G, or else an advanced state of G. ■

Step 5. Detect a vertex adjacent to all vertices in the cycleand do an easy check. Let (C, K , K ′) be an advanced stateof a 3-connected graph so it is also a basic state. By definition,K contains at most one vertex adjacent to all vertices of C.Recall that we call such a vertex u the main vertex of K . Inorder to continue we need some information on the structureof an advanced state of a 3-connected graph.

Lemma 4.8. Let (C, K , K ′) be an advanced state of a 3-connected graph G. Then the following hold:

(i) only a main vertex in K is adjacent to two non-adjacentvertices in C, and

(ii) K contains one (and exactly one) main vertex.

Proof. We write C = v1v2 . . . vpv1 for some p ≥ 4. Wewill first show that (i) holds. Suppose s is a vertex of K thatis not a main vertex but that is adjacent to two non-adjacentvertices vh, vj ∈ VC . Assume that vh and vj are chosen in such

a way that s is not adjacent to any vertex on vh+1−→C vj−1. Then

we have found a chordless cycle D = svh−→C vjs of G[VC ∪

VK ] that has at least four vertices and that contains a vertexof K . This contradicts our assumption that (C, K , K ′) is anadvanced state of G. We will now show that (ii) holds.

We first prove that all adjacent vertices of C have a com-mon neighbor in K . Suppose C contains two adjacent vertices,say v1, v2, that do not have a common neighbor in K . Since(C, K , K ′) is an advanced state of G, it is also a basic state ofG, and therefore vertex v1 has a neighbor u ∈ VK and vertexv2 has a neighbor w ∈ VK . Since we assume that v1 and v2 donot have a common neighbor in K , vertices u and w are twodifferent vertices in K . Since K is connected, there exists apath from u to w in K . Let P be a shortest path from u to w inK . If P contains a vertex z �= u adjacent to v1, we consider thesubpath from z to w instead of P. If P contains a vertex z �= wadjacent to v2, we consider the subpath from u to z instead ofP. So we may assume that u and w are the only vertices of P

adjacent to v1 and v2. Then D = v1u−→P wv2v1 is a chordless

cycle of G[VC ∪VK ] that has at least four vertices and that hasa vertex in K . This contradicts our assumption that (C, K , K ′)is an advanced state of G. So we have found that every pairof adjacent vertices on C has a common neighbor in K .

Suppose K does not contain a main vertex. Due to theabove, v1 and v2 have a common neighbor t in K and v2, v3

have a common neighbor t′ in K . Due to (i), vertices t and t′are different vertices. Let P be a shortest path from t to t′ incomponent K . If P contains a common neighbor s of v1 and

NETWORKS—2008—DOI 10.1002/net 51

Page 21: The Computational Complexity of Graph …gwoegi/papers/contract2.pdfThe Computational Complexity of Graph Contractions II: Two Tough Polynomially Solvable Cases Asaf Levin Department

v2 not equal to t, then we consider the subpath from s to t′instead of P. So we may assume that t is the only commonneighbor of v1 and v2 on P. By using the same argument wemay also assume that t′ is the only common neighbor of v2

and v3 on P.Suppose all vertices of P are adjacent to v2. Due to (i),

all vertices of P do not have a neighbor in v4−→C vp. Then the

cycle D = v1t−→P t′v3

−→C v1 is a chordless cycle of G[VK ∪ VC]

that has at least four vertices and that has at least two verticesin K . This contradicts our assumption that (C, K , K ′) is anadvanced state.

Suppose P contains a vertex u not adjacent to v2. Let s

and s′ be vertices of P such that the path s−→P s′ contains u

and does not contain any neighbors of v2 other than s and s′.Then D = v2s

−→P s′v2 is a chordless cycle of G[VC ∪ VK ] that

has at least four vertices and that has at least three verticesin K . This contradicts our assumption that (C, K , K ′) is anadvanced state. We conclude that K has a main vertex (whichis the only one by definition of a basic state). ■

Let (C, K , K ′) be an advanced state of a 3-connected graphG. Recall that we denote its main vertex, which exists dueto Lemma 4.8, by u, and that we call a chordless cycleD of G on at least four vertices that contains u a u-cycleof G. In the lemma below we describe the structure ofu-cycles.

Lemma 4.9. Let (C, K , K ′) be an advanced state of a 3-connected graph G with main vertex u. Let D be a u-cycleof G. Then D contains at least one vertex of K ′, exactly twovertices vi, vj of C, which are not adjacent, and exactly onevertex of K (namely the main vertex u).

Proof. We write C = v1v2 . . . vpv1 for some p ≥ 4. LetD be a u-cycle of G. Since (C, K , K ′) is an advanced stateof G, cycle D must contain at least one vertex of K ′. Since udoes not have a neighbor in K ′, the u-cycle D contains at leasttwo vertices vi, vj of C. Because u is adjacent to all verticesof C and D is chordless, we find the following. First, vi andvj are not adjacent. Second, vi and vj are the only vertices ofD that are on C. Third, D does not contain any other verticesof K besides u. ■

Let (C, K , K ′) be an advanced state of a 3-connected graphG with main vertex u. Recall that the vertices of a u-cycle Dof G that are on C are called C-vertices of D. By Lemma4.9, D has exactly two C-vertices. Since K ′ is connectedand every vertex in C has a neighbor in K ′, graph G has atleast one u-cycle for every pair vi, vj of C-vertices. However,as explained in Section 4.1, only u-cycles that are correctturn out to be useful. Recall that a u-cycle D with C-verticesvi, vj is called correct if the (disjoint and non-empty) paths

P1 = vi+1−→C vj−1 and P2 = vj+1

−→C vi−1 belong to a common

component in G[V\VD]. A correct u-cycle is not necessarilya W4-contraction cycle of G; however this does not matter aswe see in the following lemma.

Lemma 4.10. Let (C, K , K ′) be an advanced state of a 3-connected graph G with main vertex u. If G has a correctu-cycle, then G is W4-contractible.

Proof. We write C = v1v2 . . . vpv1 for some p ≥ 4. LetD be a correct u-cycle with C-vertices vi and vj. We showthat D does not induce a basic state of G. Then, by Lemma4.5, G is W4-contractible.

Suppose D induces a basic state (D, L, L′) of G. We assumewithout loss of generality that L contains the vertices onvi+1

−→C vj−1. Since D is a correct u-cycle, also all vertices of

vj+1−→C vi−1 belong to L. Since L′ is connected and any vertex

of C is in VD ∪ VL, either L′ is a subgraph of K or L′ is a sub-graph of K ′. Suppose L′ is a subgraph of K . By Lemma 4.9,the u-cycle D contains a vertex z of K ′. Because (D, L, L′) is abasic state, each vertex in D, and hence also z, has a neighborin L′ ⊂ K . This is not possible though, because z belongs toK ′, and K ′ is not adjacent to K by definition of (C, K , K ′).Suppose L′ is a subgraph of K ′. Since (D, L, L′) is a basicstate, vertex u ∈ VK ∩ VD must have a neighbor in L′ ⊂ K ′.Again this is not possible. ■

We will now show that correct u-cycles, in case they exist,can be found in polynomial time.

Lemma 4.11. Let (C, K , K ′) be an advanced state of a3-connected graph G with main vertex u. It is possible inpolynomial time either to find a correct u-cycle of G, or elseto conclude that G does not have a correct u-cycle.

Proof. We write C = v1v2 . . . vpv1 for some p ≥ 4. Dueto Lemma 4.9, every u-cycle contains at least one vertex ofK ′, exactly two C-vertices, and no other vertices of K besidesu. This means we can apply the following procedure.

Let vi and vj be two non-adjacent vertices on C. Since(C, K , K ′) is an advanced state, every vertex on C is adjacentto at least one vertex in K ′. Let w be a neighbor of vi in K ′,and let z be a neighbor of vj in K ′. We remove u, vi, vj, and

perform a series of edge contractions that contract vi+1−→C vj−1

into a new vertex x1 and vj+1−→C vi−1 into a new vertex x2. We

call the resulting graph G∗. Suppose G∗ contains an inducedpath P from x1 to x2 and an induced path P′ from w to z, suchthat P and P′ are vertex-disjoint, i.e., VP ∩ VP′ = ∅. Then P′

is a path in K ′, and the cycle uviw−→P′ zvju is a correct u-cycle

of G. Shiloach [5] gives an algorithm that finds such vertex-disjoint paths P and P′ in G∗, if they exist, in polynomialtime.

If the choice of neighbors w, z does not result in a correctu-cycle, then we try other neighbors of vi and vj in K ′. If westill do not obtain a correct u-cycle, then we choose anotherpair of non-adjacent vertices on C, and repeat the procedure.Since the total number of guesses is O(|V |4) and each guesscan be checked in polynomial time, we establish the claim ofthe lemma. ■

Because of Lemma 4.11 our algorithm finishes as soon asit has found (in polynomial time) a correct u-cycle of G. In

52 NETWORKS—2008—DOI 10.1002/net

Page 22: The Computational Complexity of Graph …gwoegi/papers/contract2.pdfThe Computational Complexity of Graph Contractions II: Two Tough Polynomially Solvable Cases Asaf Levin Department

the next step we describe how to proceed if G does not haveany correct u-cycle.

Step 6. Reduce the size of the vertex set. Suppose we havean advanced state (C, K , K ′) of a 3-connected graph G withmain vertex u of K and with no correct u-cycles. In order toproceed we first have to prove the following structural result.

Lemma 4.12. Let (C, K , K ′) be an advanced state of a 3-connected graph G with main vertex u. If G does not have acorrect u-cycle, then any W4-contraction cycle D of G doesnot contain any vertices of K.

Proof. We write C = v1v2 . . . vpv1 for some p ≥ 4.Suppose G does not have a correct u-cycle. Suppose D =v′

1v′2 . . . v′

qv′1 with q ≥ 4 is a W4-contraction cycle of G that

contains a vertex, say v′1, of K .

Suppose D is a u-cycle. By Lemma 4.9, D contains(exactly) two C-vertices vi and vj. Since D is a W4-contractioncycle, the subgraph G[V\VD] is connected. Then the pathsvi+1

−→C vj−1 and vj+1

−→C vi−1 are connected in G[V\VD]. Then

D would be a correct u-cycle of G. Hence, u is not on D.Since (C, K , K ′) is an advanced state of G, by definition,

D contains a vertex of K ′. Since K and K ′ are not adjacentand v′

1 ∈ VD ∩VK , cycle D must contain at least two differentvertices of C. Let v′

i be the vertex of VD ∩ VC such that

P1 = v′1−→D v′

i−1 only contains vertices of K . Let v′j be the

vertex of VD ∩ VC such that P2 = v′j+1

−→D v′

1 only contains

vertices of K . If v′i = v′

j, then D = v′1−→P1v′

i−1v′iv

′i+1

−→P2v′

1, and

if [v′i, v′

j] ∈ EG then D = v′1−→P1v′

i−1v′iv

′jv

′j+1

−→P2v′

1. However,since D contains a vertex of K ′, these two cases do not occur.So v′

i and v′j are two different, non-adjacent vertices of C.

We consider the cycle D1 = v′1−→D v′

i−→C v′

j−→D v′

1. Since v′i

and v′j are not adjacent, D1 is a cycle in G[VC ∪ VK ] on at

least four vertices. Let v be the successor of v′i on D1, and let

v∗ be the predecessor of v′j on D1. Note that both v and v∗

are on C. Since (C, K , K ′) is an advanced state of G, cycleD1 ⊂ G[VC ∪VK ] is not a chordless cycle of G. Since both Dand C are chordless cycles of G, we then find that there existsan edge between a vertex on v

−→D1v∗ = v

−→C v∗ and a vertex on

v′j+1

−→D1v′

i−1 = v′j+1

−→D v′

i−1.

Let vh ∈ VC be the first vertex on the path v−→C v∗ that has

a neighbor v′r in v′

j+1−→D v′

i−1, and assume that v′r is the first

neighbor of vh along v′j+1

−→D v′

i−1, so D′ = v′i−→C vhv′

r−→D v′

i is achordless cycle of G. This means that D′ is a chordless cycleof G[VC∪VK ]. Since (C, K , K ′) is an advanced stated of G, thechordless cycle D′ must contain three vertices. Hence, vh = vand v′

r = v′i−1 implying that v′

i−1 is adjacent to the successorof v′

i on C. By using the same arguments with respect to

D2 = v′1−→D v′

i←−C v′

j−→D v′

1, we deduce that v′i−1 is also adjacent

to the predecessor of v′i on C. Recall that u is not on D,

so v′i−1 �= u. By Lemma 4.8, vertex v′

i−1 ∈ VK can not be

adjacent to two non-adjacent vertices on C. Hence, the lemmahas been proven. ■

The following lemmas show that we may reduce the sizeof G. First we consider the case in which K contains morethan one vertex.

Lemma 4.13. Let (C, K , K ′) be an advanced state of a3-connected graph G = (V , E) with main vertex u such thatG does not have a correct u-cycle. Then G is W4-contractibleif and only if G[VC ∪ {u} ∪ VK ′ ] is W4-contractible.

Proof. If VK = {u}, the lemma is true. Suppose |VK | ≥2. Define G′ = G[VC ∪ {u} ∪ VK ′ ]. Suppose G′ is W4-contractible. Since G′ can be obtained after a sequence of|VK | − 1 edge contractions, graph G is W4-contractible.

For the other direction of the proof, suppose G is W4-contractible. Then G has a W4-contraction cycle C∗ due toLemma 4.2. By Lemma 4.12, all vertices of K are in V\VC∗ .As C∗ is a W4-contraction cycle, the graph G[V\VC∗ ] is con-nected. Since u ∈ VK is adjacent to all vertices on C, we canremove all vertices of VK\{u} from G without breaking theconnectivity of G[V\VC∗ ]. Every vertex in VC∗ that is on Cis adjacent to vertex u. Every vertex in VC∗ that is not on Cis in K ′ and, consequently, not adjacent to VK . Then C∗ is aW4-contraction cycle of G′ (note that G′ is 3-connected). ByLemma 4.2, graph G′ is W4-contractible. ■

By Lemma 4.13 we may assume that we have a graph Gin an advanced state (C, {u}, K ′) such that G does not containa correct u-cycle. We need one last structural result.

Lemma 4.14. Let D be a W4-contraction cycle of a 3-connected graph G that is in advanced state (C, {u}, K ′)without any correct u-cycles. Then D contains at most twovertices of C. If D contains exactly two vertices of C, thenthese two vertices are adjacent.

Proof. We write C = v1v2 . . . vpv1 for some p ≥ 4. Weuse a proof by contradiction. Suppose D = v′

1v′2 . . . v′

qv′1 with

q ≥ 4 is a W4-contraction cycle of G that does not satisfy theclaim of the lemma. Then D either contains at least threevertices of C, or else exactly two vertices of C, but those twovertices are not adjacent.

Claim 1. u is not on D.

This claim immediately follows from Lemma 4.12.

Claim 2. D contains two non-adjacent vertices v′h, v′

j such

that v′h+1

−→D v′

j−1 only contains vertices of K ′.

We prove Claim 2 as follows. By Claim 1, u is not onD. Then Claim 2 is immediately clear if D contains exactlytwo vertices of C (since those two vertices are non-adjacent).Suppose D contains at least three vertices of C. Since D is

NETWORKS—2008—DOI 10.1002/net 53

Page 23: The Computational Complexity of Graph …gwoegi/papers/contract2.pdfThe Computational Complexity of Graph Contractions II: Two Tough Polynomially Solvable Cases Asaf Levin Department

chordless and has at least four vertices, we find that D con-tains a pair of non-adjacent vertices v′

h, v′j of C. Since D �= C,

we may without loss of generality assume that v′h+1

−→D v′

j−1contains a vertex v′

i in VD\VC . But then we may even assume

that v′h+1

−→D v′

j−1 only contains vertices from K ′. If not, we canreplace the pair v′

h, v′j by another pair of non-adjacent vertices

v′k , v′

� of C that are on v′h−→D v′

j, such that vk′+1−→D v′

i−→D v�′−1

only contains vertices of K ′. This finishes the proof ofClaim 2.

Claim 3. The path v′j+1

−→D v′

h−1 has a neighbor in V\VD notequal to u.

We prove Claim 3 as follows. First recall that, since G is3-connected, all vertices on D have a neighbor in V\VD. Weconsider v′

j+1. There are two cases: either v′j+1 belongs to K ′,

or v′j+1 belongs to C. Suppose v′

j+1 is a vertex of K ′. Thenany neighbor of v′

j+1 in V\VD is not equal to u, because uis not adjacent to K ′. Suppose v′

j+1 is a vertex of C. Since(C, {u}, K ′) is an advanced state, every vertex of C has aneighbor in K ′. If v′

j+2 is on C (this may happen for exam-ple in the case that v′

j+2 = v′h) then since D is chordless,

such a neighbor of v′j+1 must be in V\VD. Suppose v′

j+2 isin K ′. Note that this implies that v′

j+2 is not equal to v′h, so

v′j+2 is on v′

j+1−→D v′

h−1. Hence we can use the same argumentas before: any neighbor of v′

j+2 in V\VD is not equal to u,because u is not adjacent to K ′. This completes the proof ofClaim 3.

We define the u-cycle D′ = uv′h−→D v′

ju. Since G does nothave a correct u-cycle, G[V\VD′ ] is not connected. OtherwiseD′ would be a W4-contraction cycle, and therefore a correctu-cycle of G by the same arguments as in the proof of Claim1. We denote the set of components of V\VD′ by C, so |C| ≥ 2.Let L ∈ C contain v′

j+1−→D v′

h−1.

Claim 4. Each component in C contains a vertex of VC\VD.

We prove Claim 4 as follows. First consider the compo-nents in C not equal to L. Let L′ be a component in C\L.Then all vertices of L′ belong to V\VD. Since G[V\VD] isconnected and contains u, L′ contains a vertex adjacent to u.Since u is not adjacent to K ′, such a vertex must be in C.We now consider L. By Claim 2, v′

j+1−→D v′

h−1 has a neighbor

in V\(VD ∪ {u}). Hence L is not equal to v′j+1

−→D v′

h−1 andcontains at least one vertex z of V\VD. Since G[V\VD] isconnected and contains u, G[V\VD] contains a path Pzu fromz to u. So all vertices of Pzu belong to VL\VD. Since u is notadjacent to K ′, Pzu contains a vertex of C. This finishes theproof of Claim 4.

Let P ⊂ C denote the path from the successor of v′h in

C to the predecessor of v′j in C. Let P′ ⊂ C denote the

path from the successor of v′j in C to the predecessor of

v′h in C. We observe that no vertices of P and P′ are on

D′, i.e., (V\VD′) ∩ VC = VP ∪ VP′ . By Claim 4, we mayassume without loss of generality that L contains a vertex ofP, and consequently all vertices of P. Recall that |C| ≥ 2. LetL′ �= L be another component of C. By Claim 4, L′ containsa vertex of VC\VD. Hence L′ contains a vertex of P′, andconsequently all vertices of P′. We observe that, again due toClaim 4,

C = {L, L′}.

Claim 5. Graph G contains a path Q from a vertex vr ∈VP\VD = (VL ∩ VC)\VD to a vertex v′

a on v′h+1

−→D v′

j−1 suchthat all vertices of VQ\{v′

a, vr} belong to (VL ∩ VK ′)\VD.

We prove Claim 5 as follows. By Claim 4, we can choose avertex vr ∈ VP\VD. By definition of (C, {u}, K ′), all verticesof C are adjacent to K ′ and K ′ is connected. So there exists apath Q′ from vr ∈ VC to a vertex v′

a in v′h+1

−→D v′

j−1 such thatVQ′ \{vr} belongs to K ′. We may without loss of generality

assume that v′a is the only vertex of v′

h+1−→D v′

j−1 on Q′: if notwe just take a subpath of Q′ from vr to the first vertex ofv′

h+1−→D v′

j−1 on Q′.If v′

a is the only vertex of Q′ that is on D, then we takeQ = Q′ and we have proven Claim 5. Suppose Q con-tains more vertices of D. Let v′

d �= v′a be another vertex

of Q′ that is on D. By construction of Q′, v′d is not on

v′h+1

−→D v′

j−1. So v′d belongs to v′

j+1−→D v′

h−1. Then, since D ischordless, there exists a vertex t ∈ VL\VD such that we can

write Q′ = vr−→Q′v′

d

−→Q′ t

−→Q′v′

a. We may without loss of gen-

erality assume that t−→Q′v′

a does not contain any vertex v′e in

v′j+1

−→Q′v′

h−1. Otherwise we could just replace v′d by v′

e (andthen find a vertex t′ ∈ VL\VD instead of t and so on).

Since G[V\VD] is connected, t and u are in the same com-ponent of G[V\VD]. Hence there exists a path Q∗ from u tot in G[V\VD]. Note that all vertices of Q∗ except u belongto L, since t belongs to L. Let v∗

r be a neighbor of u on Q∗.Since u only has neighbors on C, v∗

r belongs to C. We choose

v∗r instead of vr . Then we let Q = v∗

r−→Q∗t

−→Q′v′

a (possibly, after

deleting some cycles that may exist if v∗r−→Q∗t and t

−→Q′v′

a over-lap in other vertices than t only). This finishes the proof ofClaim 5.

Claim 6. Graph G contains a path R from a vertex vs ∈VP′ = VL′ ∩ VC to a vertex v′

b on v′h+1

−→D v′

j−1 such that allvertices of VR\{v′

b, vs} belong to (VL′ ∩ VK ′)\VD.

We prove Claim 6 as follows. Let vs be a vertex of P′. Bydefinition of (C, {u}, K ′), all vertices of C are adjacent to K ′and K ′ is connected. So there exists a path R′ from vs ∈ VC

to a vertex v′b in v′

h+1−→D v′

j−1 such that VR′ \{vs} belongs to K ′.We may without loss of generality assume that v′

b is the only

vertex of v′h+1

−→D v′

j−1 on R′: if not we just take a subpath of R′

from vs to the first vertex of v′h+1

−→D v′

j−1. Since v′j+1

−→D v′

h−1

54 NETWORKS—2008—DOI 10.1002/net

Page 24: The Computational Complexity of Graph …gwoegi/papers/contract2.pdfThe Computational Complexity of Graph Contractions II: Two Tough Polynomially Solvable Cases Asaf Levin Department

belongs to L, we then find that v′b is the only vertex of Q′ that

is on D. Hence we can take R = R′. This finishes the proofof Claim 6.

We note that Q and R may only have v′a as a common

vertex (in that case v′a = v′

b) because Q without v′a and R

without v′b belong to L and L′ respectively.

Consider the u-cycle D∗ formed by u, the vertices fromQ, R and the path between v′

a and v′b on v′

h+1−→D v′

j−1. Sincevr is on P and vs is on P′, the vertices v′

h and v′j are in two

different segments of C after removing vr and vs. However,recall that the vertices of Q belong to (V\VD)∪ {v′

a} and thatthe vertices of R belong to (V\VD) ∪ {v′

b}. Hence, due to this

choice of Q and R, none of the vertices of v′j−→D v′

h belong to

D∗. In other words, G[V\VD∗ ] contains the path v′j−→D v′

h. Thismeans that D∗ is a correct u-cycle. By this contradiction wehave finished the proof of Lemma 4.14. ■

We now show the final step of our algorithm (and thenwe can state our main theorem). Recall that G\e denotes thegraph obtained from G = (V , E) after contracting the edgee ∈ E.

Lemma 4.15. Let (C, {u}, K ′) be an advanced state of a3-connected graph G that does not have a correct u-cycle.Let v be a vertex of C. Then G is W4-contractible if and onlyif G\[u, v] is W4-contractible.

Proof. Let v be a vertex on C. Since G\[u, v] is obtainedafter an edge contraction, G is W4-contractible if G\[u, v] isW4-contractible.

For the other direction of the proof, suppose G is W4-contractible. Then G has a W4-contraction cycle C∗ due toLemma 4.2. By Lemma 4.12, vertex u is in V\VC∗ . Supposev is in V\VC∗ . Then C∗ is a W4-contraction cycle of G\[u, v].Hence, by Lemma 4.2, the graph G\[u, v] is W4-contractible.Suppose v is on C∗. If v is the only vertex of C that is onC∗, then G[V\(VC∗ ∪ {u}] is connected. Suppose v is not theonly vertex of C that is on C∗. Then, due to Lemma 4.14,cycle C∗ contains one other vertex v′ of C and [v, v′] is anedge in G. Again, we find that G[V\(VC∗ ∪ {u}] is connected.Recall that u is only adjacent to vertices in C. Hence, in bothcases, we can move u to the witness set that contains v, i.e.,contract [u, v], such that the resulting graph G\[u, v] is stillW4-contractible. ■

Theorem 9. Let G be a 3-connected graph. It is possible inpolynomial time either to find a W4-witness structure of G orelse to conclude that G is not W4-contractible.

Proof. Let G be a 3-connected graph. According toLemma 4.2 finding a W4-witness structure of G is equivalentto finding a chordless cycle C ⊂ G on at least four verticessuch that G[V\VC] is connected. By Lemma 4.3 we deducethat either G is not W4-contractible, or else we find a chord-less cycle C ⊆ G on at least four vertices. Due to the samelemma, we can do this in polynomial time. We can check

in polynomial time whether C induces a basic state of G. IfC does not induce a basic state then we find a W4-witnessstructure of G in polynomial time by using Lemma 4.5. Inthe other case we apply Lemma 4.7 to find in polynomialtime either a W4-witness structure of G, or else an advancedstate (D, K , K ′) of G.

Suppose we find an advanced state (D, K , K ′) of G. ByLemma 4.11 we can determine in polynomial time whetherG has a correct u-cycle for the main vertex u of K . SupposeG has a correct u-cycle. By the proof of Lemma 4.10, thisu-cycle does not induce a basic state of G. By Lemma 4.5 wefind a W4-witness structure of G in polynomial time.

Suppose G does not have a correct u-cycle. By Lemma4.13, graph G is W4-contractible if and only if G′ = G[VD ∪{u}∪VK ′ ] is W4-contractible. It is clear that G′ is 3-connected.If it turns out that G′ is W4-contractible, then we obtain aW4-witness structure of G from W4-witness sets of G′ byadding the vertices of VK\{u} to the W4-witness set of G′that contains u.

If G′ does not have a correct u-cycle, then we choose anarbitrary vertex on D and contract the edge [u, v]. By Lemma4.15, graph G′ is W4-contractible if and only if the smallergraph G′\[u, v] is W4-contractible. For given W4-witness setsof G′\[u, v] it is easy to construct W4-witness sets of G′:we remove the new vertex u∗ in G′\[u, v], obtained aftercontracting [u, v], from its W4-witness set, and replace itby u, v.

Since (C, {u}, K) is an advanced state of G′, every vertexin C has a neighbor in K ′. Then, G′[VG′ \{u}] contains threedisjoint paths from v to its predecessor on C and three disjointpaths to its successor on C. Since any other three disjoint pathsbetween any two vertices s �= u and t �= u in G′ can easily bereplaced by three disjoint paths from s to t in G′\[u, v], graphG′\[u, v] is 3-connected. Hence, we may apply our algo-rithm for 3-connected graphs on the smaller graph G′\[u, v].After at most |V | calls of this algorithm, we either find aW4-witness structure of G, or else conclude that G is notW4-contractible. ■

Because of Corollary 7 and Theorem 9 we immediatelyobtain the main result of this section.

Corollary 10. The W4-Contractibility problem is solv-able in polynomial time. Moreover, if a graph G is W4-contractible, a W4-witness structure of G can be found inpolynomial time.

Acknowledgments

We would like to thank the anonymous referees formaking a number of suggestions that helped us to improveour paper.

REFERENCES

[1] J.A. Bondy and U.S.R. Murty, Graph theory with applica-tions, Macmillan, London and Elsevier, New York, 1976.

NETWORKS—2008—DOI 10.1002/net 55

Page 25: The Computational Complexity of Graph …gwoegi/papers/contract2.pdfThe Computational Complexity of Graph Contractions II: Two Tough Polynomially Solvable Cases Asaf Levin Department

[2] A.E. Brouwer and H.J. Veldman, Contractibility and NP-completeness, J Graph Theory 11 (1987), 71–79.

[3] A. Levin, D. Paulusma, and G.J. Woeginger, The com-putational complexity of graph contractions I: Polynomi-ally solvable and NP-complete cases, Networks 51 (2008),178–189.

[4] N. Robertson and P.D. Seymour, Graph minors. XIII. Thedisjoint paths problem, J Combin Theory Ser B 63 (1995),65–110.

[5] Y. Shiloach, A polynomial solution to the undirectedtwo paths problem, J Assoc Comput Machine 27 (1980),445–456.

56 NETWORKS—2008—DOI 10.1002/net