Three-in-a-Tree in Near Linear Time

24  Download (0)

Full text


Three-in-a-Tree in Near Linear Time

Kai-Yuan Lai National Taiwan University


Hsueh-I Lu National Taiwan University


Mikkel Thorup § University of Copenhagen



The three-in-a-tree problem is to determine if a simple undirected graph contains an induced subgraph which is a tree connecting three given vertices. Based on a beautiful characterization that is proved in more than twenty pages, Chudnovsky and Seymour [Com- binatorica 2010] gave the previously only known polynomial-time algorithm, running in 𝑂(𝑚𝑛2) time, to solve the three-in-a-tree problem on an 𝑛-vertex 𝑚-edge graph. Their three-in-a-tree algo- rithm has become a critical subroutine in several state-of-the-art graph recognition and detection algorithms.

In this paper we solve the three-in-a-tree problem in 𝑂(𝑚 log2𝑛) time, leading to improved algorithms for recognizing perfect graphs and detecting thetas, pyramids, beetles, and odd and even holes.

Our result is based on a new and more constructive characterization than that of Chudnovsky and Seymour. Our new characterization is stronger than the original, and our proof implies a new simpler proof for the original characterization. The improved characteriza- tion gains the first factor 𝑛 in speed. The remaining improvement is based on dynamic graph algorithms.


•Mathematics of computing → Graph algorithms.


Induced subgraph detection, graph recognition, dynamic graph algorithm, top tree, SPQR-tree, perfect graph, odd hole, even hole ACM Reference Format:

Kai-Yuan Lai, Hsueh-I Lu, and Mikkel Thorup. 2020. Three-in-a-Tree in Near Linear Time. InProceedings of the 52nd Annual ACM SIGACT Symposium on Theory of Computing (STOC ’20), June 22–26, 2020, Chicago, IL, USA. ACM, New York, NY, USA,24pages.

A full version of this extended abstract:

Department of Computer Science and Information Engineering, National Taiwan University. The master’s thesis of this author is a preliminary version [47] of this extended abstract.

Corresponding author. Department of Computer Science and Information Engineer- ing, National Taiwan University. Research of this author is supported by MOST grants 107–2221–E–002–032–MY3 and 104–2221–E–002–044–MY3.

§Department of Computer Science, University of Copenhagen. Research of this au- thor is supported by VILLUM Investigator Grant 16582, Basic Algorithms Research Copenhagen (BARC).

Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and /or a fee. Request permissions from

STOC ’20, June 22–26, 2020, Chicago, IL, USA

© 2020 Association for Computing Machinery.

ACM ISBN 978-1-4503-6979-4/20/06. . . $15.00

best previously known results our work three-in-a-tree 𝑂(𝑛4) [18] 𝑂˜(𝑛2): Theorem1.1

theta 𝑂(𝑛11) [18] 𝑂˜(𝑛6): Theorem1.2 pyramid 𝑂(𝑛9) [13] 𝑂˜(𝑛5): Theorem1.3 perfect graph 𝑂(𝑛9) [13] 𝑂(𝑛8): Theorem1.4 odd hole 𝑂(𝑛9) [17] 𝑂(𝑛8): Theorem1.4 beetle 𝑂(𝑛11) [11] 𝑂˜(𝑛6): Theorem1.5 even hole 𝑂(𝑛11) [11] 𝑂(𝑛9): Theorem1.6

Figure 1: Comparing results for 𝒏-vertex graphs.


The graphs considered in this paper are all assumed to be undirected.

Also, it is convenient to think of them as connected. Let 𝐺 be such a graph with 𝑛 vertices and 𝑚 edges. An induced subgraph of 𝐺 is a subgraph 𝐻 that contains all edges from 𝐺 between vertices in 𝐻 . For the three-in-a-tree problem, we are given three specific terminals in 𝐺 , and we want to decide if 𝐺 has an induced tree 𝑇 , that is, a tree 𝑇 which is an induced subgraph of 𝐺 , containing these terminals. Chudnovsky and Seymour [18] gave the formerly only known polynomial-time algorithm, running in 𝑂(𝑚𝑛2) time, for the three-in-a-tree problem. In this paper, we reduce the complexity of three-in-a-tree from 𝑂(𝑚𝑛2) to 𝑂 (𝑚 log2𝑛) = ˜𝑂(𝑚) time.

Theorem 1.1. It takes 𝑂(𝑚 log2𝑛) time to solve the three-in-a-tree problem on an 𝑛-vertex 𝑚-edge simple graph.

To prove Theorem1.1, we first improve the running time to 𝑂(𝑚𝑛) using a simpler algorithm with a simpler correctness proof than that of Chudnovsky and Seymour. The remaining improve- ment is done employing dynamic graph algorithms.

1.1 Significance of Three-in-a-Tree

The three-in-a-tree problem may seem like a toy problem, but it has proven to be of general importance because many difficult graph detection and recognition problems reduce to it. The reductions are often highly non-trivial and one-to-many, solving three-in-a-tree on multiple graph instances with different placements of the three terminals. With our near-linear three-in-a-tree algorithm and some improved reductions, we get the results summarized Figure1. These results will be explained in more detail in Section1.2.

Showcasing some of the connections, our improved three-in-a- tree algorithm leads to an improved algorithm to detect if a graph has anodd hole, that is, an induced cycle of odd length above three.

This is via the recent odd-hole algorithm of Chudnovsky, Scott, Sey- mour, and Spirkl [17]. A highly nontrivial consequence of odd-hole


algorithm is that we can use it to recognize if a graph 𝐺 is perfect, that is, if the chromatic number of each induced subgraph 𝐻 of 𝐺 equals the clique number of 𝐻 . The celebrated Strong Perfect Graph Theorem states that a graph is perfect if and only if neither the graph nor its complement has an odd hole. An odd-hole algorithm can therefore trivially test if a graph is perfect. The Strong Perfect Graph Theorem, implying the last reduction was a big challenge to mathematics, conjectured by Berge in 1960 [5–7] and proved by Chudnovsky, Robertson, Seymour, and Thomas [16], earned them the 2009 Fulkerson prize. Our improved three-in-a-tree algorithm improves the time to recognize if a graph is perfect from 𝑂(𝑛9) to 𝑂(𝑛8). While this is a modest polynomial improvement, the point is that three-in-a-tree is a central sub-problem on the path to solve many other problems.

The next obvious question is why three-in-a-tree? Couldn’t we have found a more general subproblem to reduce to? The dream would be to get something like disjoint paths and graph minor theory where we detect a constant sized minor or detect if we have disjoint paths connecting of a constant number of terminal pairs (one path connecting each pair) in 𝑂(𝑛2) time. This is using the algorithm of Kawarabayashi, Kobayashi, and Reed [45], improving the original cubic algorithm of Robertson and Seymour [54].

In light of the above grand achievements, it may seem unam- bitious for Chudnovsky and Seymour to work on three-in-a-tree as a general tool. The difference is that the above disjoint paths and minors are not necessarily induced subgraphs. Working with induced paths, many of the most basic problems become NP-hard.

Obviously, we can decide if there is an induced path between two terminals, but Bienstock [8] has proven that it is NP-hard to decide two-in-a-cycle, that is, if two terminals are in an induced cycle. From this we easily get that it is NP-hard to decide three-in-a-path, that is if there is an induced path containing three given terminals. Both of these problems would be trivial if we could solve the induced disjoint path problem for just two terminal pairs. In connection with the even and odd holes and perfect graphs, Bienstock also proved that it is NP-hard to decide if there is an even (respectively, odd) hole containing a given terminal.

In light of these NP-hardness results it appears quite lucky that three-in-a-tree is tractable, and of sufficient generality that it can be used as a base for solving other graph detection and recognition problems nestled between NP-hard problems. In fact, three-in-a-tree has become such a dominant tool in graph detection that authors sometimes explained when they think it cannot be used [19,60], e.g., Trotignon and Vušković [60] wrote “A very powerful tool for solving detection problems is the algorithm three-in-a-tree of Chudnovsky and Seymour [...] But as far as we can see, three-in-a- tree cannot be used to solveΠ𝐻1|1.”

While proving that a problem is in P is the first big step in understanding the complexity, there has also been substantial prior work on improving the polynomial complexity for many of the problems considered in this paper. In the next subsection, we will explain in more detail how our near-linear three-in-a-tree algorithm together with some new reductions improve the complexity of different graph detection and recognition problems. In doing so we also hope to inspire more new applications of three-in-a-tree in efficient graph algorithms.

1.2 Implications

We are now going to describe the use of our three-in-a-tree algo- rithm to improve the complexity of several graph detection and recognition problems. The reader less familiar with structural graph theory may find it interesting to see how the route to solve the big problems takes us through several toy-like subproblems, starting from three-in-a-tree. Often we look for some simple configuration implying an easy answer. If the simple configuration is not present, then this tells us something about the structure of the graph that we can try to exploit.

We first define the big problems in context. Ahole is an in- duced simple cycle with four or more vertices. A graph ischordal if and only if it has no hole. Rose, Tarjan, and Leuker [55] gave a linear-time algorithm for recognizing chordal graphs. A hole is odd (respectively, even) if it consists of an odd (respectively, even) number of vertices. 𝐺 is Berge if 𝐺 and its complement are both odd- hole-free. The celebrated Strong Perfect Graph Theorem, which was conjectured by Berge [5–7] and proved by Chudnovsky, Robertson, Seymour, and Thomas [16], states that 𝐺 is Berge if and only if 𝐺 is perfect, i.e., the chromatic number of each induced subgraph 𝐻 of 𝐺 equals the clique number of 𝐻 .

The big problems considered here are detecting odd and even holes, but related to this we are going to look for “thetas”, “pyra- mids”, and “beetles”. These are different induced subdivisions where asubdivision of a graph is one where edges are replaced by paths of arbitrary length. A hole is thus an induced subdivision of a length-4 cycle, and a minimal three-in-a-tree is an induced subdivision of a star with 2 or 3 leaves that are all prespecified terminals.

The first problem Chudnovsky and Seymour [18] solved us- ing their three-in-tree algorithm was to detect atheta which is any induced subdivision of 𝐾2,3[4]. Chudnovsky and Seymour are interested in thetas because they trivially imply an even hole.

They developed the previously only known polynomial-time algo- rithm, running in 𝑂(𝑛11) time, for detecting thetas in 𝐺 via solving the three-in-a-tree problem on 𝑂(𝑛7) subgraphs of 𝐺. Thus, Theo- rem1.1reduces the time to𝑂˜(𝑛9). Moreover, we show in Lemma6.1 that thetas in 𝐺 can be detected via solving the three-in-a-tree prob- lem on 𝑂(𝑚𝑛2) 𝑛-vertex graphs, leading to an ˜𝑂(𝑛6)-time algorithm as stated in Theorem1.2.

Theorem 1.2. It takes 𝑂(𝑚𝑛4log2𝑛) time to detect thetas in an 𝑛-vertex 𝑚-edge graph.

The next problem Chudnovsky and Seymour solved using their three-in-tree algorithm was to detect apyramid which is an induced subgraph consisting of an apex vertex 𝑢 and a triangle 𝑣1𝑣2𝑣3and three paths 𝑃1, 𝑃2, and 𝑃3such that 𝑃𝑖 connects 𝑢 to 𝑣𝑖 and touch 𝑃𝑗, 𝑗≠ 𝑖, only in 𝑢, and such that at most one of 𝑃1, 𝑃2, and 𝑃3has only one edge. The point in a pyramid is that it must contain an odd hole. An 𝑂(𝑛9)-time algorithm for detecting pyramids was already contained in the perfect graph algorithm of Chudnovsky et al. [13,

§2], but Chudnovsky and Seymour use their three-in-a-tree to give a more natural “less miraculous” algorithm for pyramid detection, but with a slower running time of 𝑂(𝑛10). With our faster three-in-a- tree algorithm, their more natural pyramid detection also becomes the faster algorithm with a running time of𝑂˜(𝑛8). Moreover, as for thetas, we improve the reductions to three-in-a-tree. We show (see Lemma6.2) that pyramids in 𝐺 can be detected via solving the


three-in-a-tree problem on 𝑂(𝑚𝑛) 𝑛-vertex graphs, leading to an 𝑂˜(𝑚𝑛3)-time algorithm as stated in Theorem1.3.

Theorem 1.3. It takes 𝑂(𝑚𝑛3log2𝑛) time to detect pyramids in an 𝑛-vertex 𝑚-edge graph.

We now turn to odd holes and perfect graphs. Since a graph is perfect if and only if it and its complement are both odd-hole-free, an odd-hole algorithm implies a perfect graph algorithm, but not vice versa. Cornuéjols, Liu, and Vušković [29] gave a decomposition- based algorithm for recognizing perfect graphs that runs in 𝑂(𝑛18) time, reduced to 𝑂(𝑛15) time by Charbit, Habib, Trotignon, and Vušković [12]. The best previously known algorithm, due to Chud- novsky, Cornuéjols, Liu, Seymour, and Vušković [13], runs in 𝑂(𝑛9) time. However, the tractability of detecting odd holes was open for decades [20,23,27,43] until recently. Chudnovsky, Scott, Seymour, and Spirkl [17] announced an 𝑂(𝑛9)-time algorithm for detecting odd holes, which also implies a simpler 𝑂(𝑛9)-time algorithm for recognizing perfect graphs. An 𝑂(𝑛9)-time bottleneck of both of these perfect-graph recognition algorithms was the above men- tioned algorithm for detecting pyramids [13, §2].

By Theorem1.3, the pyramids can now be detected in ˜ 𝑂(𝑚𝑛3)- time, but Chudnovsky et al.’s odd-hole algorithm has six more 𝑂(𝑛9)-time subroutines [17, §4]. By improving all these bottle- neck subroutines, we improve the detection time for odd holes to 𝑂(𝑚2𝑛4), hence the recognition time for perfect graphs to 𝑂 (𝑛8).

Theorem 1.4. (1) It takes 𝑂(𝑚2𝑛4) time to detect odd holes in an 𝑛-vertex 𝑚-edge graph, and hence (2) it takes 𝑂(𝑛8) time to recognize an 𝑛-vertex perfect graph.

Even-hole-free graphs have been extensively studied [1,24,25, 30,31,38,46,56]. Vušković [65] gave a comprehensive survey.

Conforti, Cornuéjols, Kapoor, and Vušković [22,26] gave the first polynomial-time algorithm for detecting even holes, running in 𝑂(𝑛40) time. Chudnovsky, Kawarabayashi, and Seymour [15] re- duced the time to 𝑂(𝑛31). A prism consists of two vertex-disjoint triangles together with three vertex-disjoint paths between the two triangles such that the union of every two of the three paths induces a cycle. Chudnovsky et al. [15] also observed that the time of detecting even holes can be further reduced to 𝑂(𝑛15) as long as detecting prisms is not too expensive, but this turned out to be NP-hard [52]. However, Chudnovsky and Kapadia [14] and Maffray and Trotignon [52, Algorithm 2] devised 𝑂(𝑛35)-time and 𝑂 (𝑛5)- time algorithms for detecting prisms in theta-free and pyramid-free graphs 𝐺 , respectively. Later, da Silva and Vušković [31] improved the time of detecting even holes in 𝐺 to 𝑂(𝑛19). The best formerly known algorithm, due to Chang and Lu [11], runs in 𝑂(𝑛11) time.

One of its two 𝑂(𝑛11)-time bottlenecks [11, Lemma 2.3] detects so- called beetles in 𝐺 via solving the three-in-a-tree problem on 𝑂(𝑛7) subgraphs of 𝐺 . Theorem1.1reduces the time to ˜

𝑂(𝑛9). Moreover, we show in Lemma6.3that beetles can be detected via solving the three-in-a-tree problem on 𝑂(𝑚2) 𝑛-vertex graphs, leading to an 𝑂˜(𝑛6)-time algorithm as stated in Theorem1.5.

Theorem 1.5. It takes 𝑂(𝑚2𝑛2log2𝑛) time to detect beetles in an 𝑛-vertex 𝑚-edge graph.

Combining our faster beetle-detection algorithm with our 𝑂(𝑛9)- time algorithm in §6.4, which is carefully improved from the other

𝑂(𝑛11)-time bottleneck subroutine [11, Lemma 2.4], we reduce the time of detecting even holes to 𝑂(𝑛9) as stated in Theorem1.6.

Theorem 1.6. It takes 𝑂(𝑚2𝑛5) time to detect even holes in an 𝑛-vertex 𝑚-edge graph.

For other implications of Theorem1.1, Lévêque, Lin, Maffray, and Trotignon gave 𝑂(𝑛13)-time and 𝑂 (𝑛14)-time algorithms for certain propertiesΠ𝐵4andΠ𝐵6, respectively [50, Theorems 3.1 and 3.2]. By Theorem1.1and the techniques of §6, the time can be reduced by aΘ(𝑛5/log2𝑛) factor. Theorem1.1also improves the algorithms of van ’t Hof, Kaminski, and Paulusma [63, Lemmas 4 and 5]. We hope and expect that three-in-a-tree with its new near-optimal efficiency will find many other applications in efficient graph algorithms.

1.3 Other Related Work

For the general 𝑘 -in-a-tree problem, we are given 𝑘 specific termi- nals in 𝐺 , and we want to decide if 𝐺 has an induced tree 𝑇 . The 𝑘 -in-a-tree problem is NP-complete [33] when 𝑘 is not fixed. With our Theorem1.1, it can be solved in near-linear time for 𝑘 ≤ 3, and the tractability is unknown for any fixed 𝑘 ≥ 4 [39]. Solving it in polynomial time for constant 𝑘 would be a huge result. It is, however, not clear that 𝑘 -in-a-tree for 𝑘 > 3 would be as powerful a tool in solving other problems as three-in-a-tree has proven to be.

While 𝑘 -in-a-tree with bounded 𝑘 is unsolved for general graphs, there has been substantial work devoted to 𝑘 -in-a-tree for special graph classes. Derhy, Picouleau, and Trotignon [34] and Liu and Trotignon [51] studied 𝑘 -in-a-tree on graphs with girth at least 𝑘 for 𝑘= 4 and general 𝑘 ≥ 4, respectively. Dos Santos, da Silva, and Szwarcfiter [36] studied the 𝑘 -in-a-tree problem on chordal graphs.

Golovach, Paulusma, and van Leeuwen [39] studied the 𝑘 -in-a- tree, 𝑘 -in-a-cycle, and 𝑘 -in-a-path problems on AT-free graphs [49].

Bruhn and Saito [10], Fiala, Kaminski, Lidický, and Paulusma [37], and Golovach, Paulusma, and van Leeuwen [40] studied the 𝑘 -in-a- tree and 𝑘 -in-a-path problems on claw-free graphs.

On the hardness side, recall that three-in-a-tree can also be viewed as three in a subdivided star with two or three terminal leaves. However, detecting such a star with 4 terminal leaves is NP- hard. (This follows from Bienstock’s NP-hardness of 2-in-a-cycle [8], asking if there exists a hole containing two vertices 𝑢 and 𝑣 , which may be assumed to be nonadjacent: Add two new leaves 𝑢1 and 𝑢2adjacent to 𝑢 and then, for every two neighbors 𝑣1and 𝑣2 of 𝑣 , check if the new graph contains an induced subdivision of a star with exactly four terminal leaves 𝑢1, 𝑢2, 𝑣1, 𝑣2.) Even without terminals, it is NP-hard to detect induced subdivisions of any graph with minimum degree at least four [3,50]. Finally, we note that if we allow multigraphs with parallel edges, then even 2-in-a-path becomes NP-hard. This NP-hardness is an easy exercise since the induced path cannot contain both end-points of parallel edges.

We note that it is the subdivisions that make induced graph detec- tion hard for constant sized pattern graphs. Without subdivisions, we can trivially check for any induced 𝑘 -vertex graph in 𝑂(𝑛𝑘) time.

Nesetril and Poljak has improved this to roughly 𝑂(𝑛𝑘 𝜔/3) where 𝜔 is the exponent of matrix multiplication [53]. On the other hand, the ETH hypothesis implies that we cannot detect if a 𝑘 -clique is a(n induced) subgraph in 𝑛𝑜(𝑘)time [44]. See [32] for a more general understanding of the hardness of detecting induced graphs.


1.4 Techniques

Chudnovsky and Seymour’s 𝑂(𝑛2𝑚)-time algorithm for the three- in-a-tree problem is based upon their beautiful characterization for when a graph with three given terminals are contained in some induced tree [18]. The aim is to either find a three-in-a-tree or a witness that it cannot exist. During the course of the algorithm, they develop the witness to cover more and more of the graph.

In each iteration, they take some part that is not covered by the current witness and try to add it in, but then some other part of the witness may pop out. They then need a potential function argument to show progress in each iteration.

What we do is to introduce some extra structure to the witness when no three-in-a-tree is found, so that when things are added, nothing pops out. This leads to a simpler more constructive al- gorithm that is faster by a factor 𝑛. Our new witness has more properties than that of Chudnovsky and Seymour, so our charac- terization of no three-in-a-tree is strictly stronger, yet our overall proof is shorter. Essentially the point is that by strengthening the in- ductive hypothesis, we get a simpler inductive step. The remaining improvement in speed is based on dynamic graph algorithms.

1.5 Road Map

The rest of the paper is organized as follows. Section2is a back- ground section where we review Chudnovsky and Seymour’s char- acterization for three-in-a-tree, sketch how it is used algorithmi- cally, as well as the bottleneck for a fast implementation. Sec- tion3 presents our new stronger characterization as well as a high level description of the algorithms and proofs leading to our 𝑂˜(𝑚) implementation. Section4proves the correctness of our new characterization. Section5provides an efficient implementation.

Section6shows how our improved three-in-a-tree algorithm, in tandem with other new ideas, is used to improve many state-of- the-art graph recognition and detection algorithms. Section7con- cludes the paper. See Appendix (pp.15–24)) or a full version at the proofs omitted in the first14 pages due to the page limit of STOC 2020.


Let|𝑆 | denote the cardinality of set 𝑆. Let 𝑅 \ 𝑆 for sets 𝑅 and 𝑆 consist of the elements of 𝑅 not in 𝑆 . Let 𝐺 and 𝐻 be graphs.

Let 𝑉(𝐺) (respectively, 𝐸 (𝐺)) consist of the vertices (respectively, edges) of 𝐺 . Let 𝑢 and 𝑣 be vertices. Let 𝑈 and 𝑉 be vertex sets. Let 𝑁𝐺(𝑢) consist of the neighbors of 𝑢 in 𝐺. The degree of 𝑢 in 𝐺 is

|𝑁𝐺(𝑢) |. Let 𝑁𝐺[𝑢] = 𝑁𝐺(𝑢) ∪ {𝑢}. Let 𝑁𝐺(𝑈 ) be the union of 𝑁𝐺(𝑢) \ 𝑈 over all vertices 𝑢 ∈ 𝑈 . Let 𝑁𝐺(𝑢, 𝐻 ) = 𝑁𝐺(𝑢) ∩ 𝑉 (𝐻 ) and 𝑁𝐺(𝑈 , 𝐻 ) = 𝑁𝐺(𝑈 ) ∩ 𝑉 (𝐻 ). The subscript 𝐺 in notation 𝑁𝐺

may be omitted. Aleaf of 𝐺 is a degree-one vertex of 𝐺 . Let∇(𝐺) denote the graph obtained from 𝐺 by adding an edge between each pair of leaves of 𝐺 . Let 𝐺[𝐻 ] denote the subgraph of 𝐺 induced by 𝑉(𝐻 ). Let 𝐺 −𝑈 = 𝐺 [𝑉 (𝐺) \𝑈 ]. Let 𝐺 −𝑢 = 𝐺 − {𝑢}. Let 𝑢𝑣 denote an edge with end-vertices 𝑢 and 𝑣 . Graphs 𝐻1and 𝐻2aredisjoint if 𝑉(𝐻1) ∩ 𝑉 (𝐻2) = ∅. Graphs 𝐻1and 𝐻2areadjacent in 𝐺 if 𝐻1and 𝐻2are disjoint and there is an edge 𝑢𝑣 of 𝐺 with 𝑢 ∈ 𝑉 (𝐻1) and 𝑣 ∈ 𝑉 (𝐻2). A 𝑈 𝑉 -path is either a vertex in 𝑈 ∩ 𝑉 or a path having one end-vertex in 𝑈 and the other end-vertex in 𝑉 . A 𝑈 𝑉 -rung [18]

is a vertex-minimal induced 𝑈 𝑉 -path. If 𝑈= {𝑢}, then a 𝑈 𝑉 -path

Figure 2: (a) An 𝑿 -net H with nodes 𝑽1, . . . , 𝑽4 and arcs 𝑬1, 𝑬2, 𝑬3, where 𝑿 consists of the vertices other than 4, 5, 6.

Vertices 4 and 5 are H-local. Vertex 6 is H-nonlocal. (b) A nonlocal net H having a triad 𝚫(𝑽4, 𝑽5, 𝑽6) = {6, 8, 9}. Vertex 5is H-local. Vertex 4 is H-nonlocal.

is also called a 𝑢𝑉 -path and a 𝑉 𝑢 -path. If 𝑈 = {𝑢} and 𝑉 = {𝑣 }, then a 𝑈 𝑉 -path is also called a 𝑢𝑣 -path. Let 𝑈 𝑣 -rung, 𝑢𝑉 -rung, and 𝑢𝑣 -rung be defined similarly.

For the three-in-a-tree problem, we assume without loss of gen- erality that the three given terminals of the input 𝑛-vertex 𝑚-edge simple undirected graph 𝐺 are exactly the leaves of 𝐺 . A sapling of 𝐺 is an induced tree containing all three leaves of 𝐺 , so the three-in-a-tree problem is the problem of finding a sapling.

2.1 Chudnovsky & Seymour’s Characterization

LetH be a graph such that each member of 𝑉 (H) and 𝐸(H), called node and arc respectively, is a subset of 𝑋 ⊆ 𝑉 (𝐺). H is an 𝑋 -net of 𝐺 if the following ConditionsNhold (see Figure2(a)): N1: Graph H is connected and graph ∇(H) is biconnected.N2: The arcs ofH form a nonempty disjoint partition of the vertex set 𝑋 .N3: GraphH has exactly three leaf nodes, each of which consists of a leaf vertex of 𝐺 .N4: For any arc 𝐸= 𝑈 𝑉 ofH, each vertex of 𝑋 in 𝐸 is on a 𝑈 𝑉 -rung of 𝐺[𝐸].N5: For any arc 𝐸 and node 𝑉 ofH, 𝐸 ∩ 𝑉 ≠ ∅ if and only if 𝑉 is an end-node of 𝐸 inH.N6: For any vertices 𝑢 and 𝑣 in 𝑋 contained by distinct arcs 𝐸 and 𝐹 ofH, 𝑢𝑣 is an edge of 𝐺 if and only if arcs 𝐸 and 𝐹 share a common end-node 𝑉 inH with {𝑢, 𝑣 } ⊆ 𝑉 . An arc 𝐸 = 𝑈 𝑉 is simple if 𝐺 [𝐸] is a 𝑈 𝑉 -rung. A net is an 𝑋 -net for an 𝑋 . A base net is a net obtained via the next lemma.

Lemma 2.1 (Chudnovsky and Seymour [18]). It takes 𝑂(𝑚) time to find a sapling of 𝐺 or a net of 𝐺 whose arcs are all simple.

The original definition of Chudnovsky and Seymour only used nets with no parallel arcs, but for our own more efficient construc- tion, we need to use parallel arcs. Atriad ofH is Δ(𝑉1, 𝑉2, 𝑉3) = (𝑉1∩𝑉2) ∪ (𝑉2∩𝑉3) ∪ (𝑉3∩𝑉1) for nodes 𝑉1, 𝑉2, and 𝑉3that induce a triangle in graphH. A subset 𝑆 of 𝑋 is H-local if 𝑆 is contained by a node, arc, or triad ofH [18]. A set 𝑌 ⊆ 𝑉 (𝐺 − 𝑋 ) is H-local if 𝑁(𝑌 , 𝑋 ) is H-local. H is local if every 𝑌 ⊆ 𝑉 (𝐺 − 𝑋 ) with con- nected 𝐺[𝑌 ] is H-local. See Figure2. The following theorem is Chudnovsky and Seymour’s characterization.

Theorem 2.2 (Chudnovsky and Seymour. [18, 3.2]). 𝐺 is sapling free if and only if 𝐺 admits a local net with no parallel arcs.

The proof of Theorem2.2in [18] takes up more than 20 pages. We will here present a stronger characterization with a shorter proof, which moreover leads to a much faster implementation. Our results throughout the paper do not rely on Theorem2.2. Moreover, our paper delivers an alternative self-contained proof for Theorem2.2.


Figure 3: ∇(H) for a web H. The yellow arcs are in ∇(H) \ H.

Chudnovsky and Seymour’s proof of Theorem2.2is algorithmic maintaining an 𝑋 -netH with 𝑋 ⊆ 𝑉 (𝐺) having no parallel arcs until a sapling of 𝐺 is found orH becomes local, implying that 𝐺 is sapling-free by the if direction of Theorem2.2. In each iteration, ifH is not local, they find a minimal set 𝑌 ⊆ 𝑉 (𝐺 − 𝑋 ) with con- nected 𝐺[𝑌 ] such that 𝑌 is H-nonlocal. Their proof for the only-if direction of Theorem2.2shows that if 𝐺[𝑋 ∪𝑌 ] is sapling-free, then H can be updated to an 𝑋-net with 𝑌 ⊆ 𝑋⊆ 𝑋 ∪ 𝑌 . Although 𝑌 joins the resulting 𝑋-netH, a subset of 𝑋 may have to be moved out ofH to preserve ConditionsNforH. To bound the number of iterations, Chudnovsky and Seymour showed that the potential

|𝑋 | + (𝑛 + 1) · |𝑉 (H)| of H stays 𝑂 (𝑛2) and is increased by each iteration, implying that the total number of iterations is 𝑂(𝑛2). In the next section, we will present a new stronger characterization that using parallel arcs with particular properties avoids the afore- mentioned in-and-out situation. More precisely, our 𝑋 will grow in each iteration, reducing the number of iterations to at most 𝑛.


A base net of 𝐺 contains only simple arcs. However, we do need other more complex arcs, but we will show that it suffices that all non-simple arcs are “flexible” in the sense defined below. For vertex sets 𝑆 , 𝑉1, and 𝑉2, an(𝑆, 𝑉1, 𝑉2)-sprout is an induced subgraph of 𝐺 in one of the followingTypesS:S1: A tree intersecting each of 𝑆 , 𝑉1, and 𝑉2at exactly one vertex.S2: An 𝑆𝑉1-rung not intersecting 𝑉2plus a disjoint 𝑆𝑉2-rung not intersecting 𝑉1.S3: A 𝑉1𝑉2-rung not intersect- ing 𝑆 plus a disjoint 𝑆𝑉 -rung with 𝑉= 𝑉1∪ 𝑉2. Let 𝑆= {1, . . . , 7}

for the example in Figure3. Vertex 1 is an(𝑆, 𝑉1, 𝑉2)-sprout of TypeS1. The set{2, 19, 12, 11, 13, 14, 15, 16} induces an (𝑆, 𝑉1, 𝑈2)- sprout of TypeS1. The only (𝑆, 𝑈1, 𝑈2)-sprout and (𝑆, 𝑊1, 𝑊2)- sprout of TypeS1contain vertex 1. The set{23, 4, 7, 28} induces an (𝑆, 𝑊1, 𝑊2)-sprout of TypeS2. The set{19, 2, 13, 14, 15, 16} induces an(𝑆, 𝑈1, 𝑈2)-sprout of TypeS3. An arc 𝐸 = 𝑈 𝑉 ofH is flexible if 𝐺[𝐸] contains an (𝑆, 𝑈 , 𝑉 )-sprout for each nonempty vertex set 𝑆 ⊆ 𝐸. For the example in Figure3, arcs 𝐸1, 𝐸3, 𝐸4, 𝐸5, 𝐸6are simple and arcs 𝐸1, 𝐸2, 𝐸7are flexible. An 𝑋 -netH is an 𝑋 -web if all arcs of H are simple or flexible. A web is an 𝑋 -web for some 𝑋 . A base net of 𝐺 is a web of 𝐺 . LetH be a net. A split component G for H is ei- ther an arc 𝑈 𝑉 ofH or a subgraph of H containing a cutset {𝑈 , 𝑉 } of∇(H) such that G is a maximal subgraph of ∇(H) in which 𝑈 and 𝑉 are nonadjacent and do not form a cutset [35]. For both cases, we call{𝑈 , 𝑉 } the split pair of G for H. The split components

Figure 4: The aiding net of the H in (a) is the Hin (b) with 𝑬2 =𝑬2∪ · · · ∪𝑬8and 𝑬3 =𝑬9∪ · · · ∪𝑬15. The net H in (c) aids itself.

having split pair{𝑉1, 𝑉2} in Figure3are (1) the 𝑉1𝑉2-path with an arc 𝐸1, (2) the 𝑉1𝑉2-path with arcs 𝐸3, 𝐸2, 𝐸4, and (3) the 𝑉1𝑉2-path with arcs 𝐸5, 𝐸7, 𝐸6. Thus, even ifH has no parallel arcs, there can be more than one split components sharing a common split pair.

One can verify that each split componentG of H contains at most one leaf node ofH and, if G contains a leaf node 𝑉 of H, then 𝑉 belongs to the split pair ofG. A vertex subset 𝐶 of 𝐺 is a chunk ofH if 𝐶 is the union of the arcs of one or more split components forH that share a common split pair {𝑈 , 𝑉 } for H. In this case, we call{𝑈 , 𝑉 } the split pair of 𝐶 for H and call 𝐶 a 𝑈𝑉 -chunk of H. A chunk ofH is maximal if it is not properly contained by any chunk ofH. A node of H is a maximal split node if it belongs to the split pair of a maximal chunk forH. For the net H of 𝐺 in Figure3, 𝐸1, 𝐸3, 𝐸3∪ 𝐸2, 𝐸3∪ 𝐸2∪ 𝐸4, and 𝐸1∪ 𝐸3∪ 𝐸2∪ 𝐸4are all chunks ofH.

If we consider only the subsets of 𝑉(𝐺) that intersect the numbered vertices, then 𝐸1∪ · · · ∪ 𝐸7is the only maximal chunk and 𝑉1and 𝑉2 are the only maximal split nodes. Given an 𝑋 -netH, a subset 𝑆 of 𝑋 isH-tamed if every pair of vertices from 𝑆 is either in the same arc or together in some node ofH. A set 𝑌 ⊆ 𝑉 (𝐺 − 𝑋 ) is H-tamed if 𝑁(𝑌 , 𝑋 ) is H-tamed. H is taming if every 𝑌 ⊆ 𝑉 (𝐺 − 𝑋 ) with connected 𝐺[𝑌 ] is H-tamed. If 𝑆 ⊆ 𝑋 is H-local, then 𝑆 is H-tamed.

The converse does not hold: IfH has simple arcs 𝐸 and 𝐹 between nodes 𝑈 and 𝑉 , 𝐺[𝐸] is an edge 𝑢𝑣 with 𝑢 ∈ 𝑈 and 𝑣 ∈ 𝑉 , and 𝐺 [𝐹 ] is a vertex 𝑤∈ 𝑈 ∩ 𝑉 , then {𝑢, 𝑣, 𝑤 } is H-tamed and H-nonlocal.

However, ifH has no parallel arcs, then each H-tamed subset of 𝑋 isH-local, as shown in Lemma3.5(2).

Anon-trivial 𝑉1𝑉2-chunk 𝐶 ofH is one that is not an arc in H.

We then define the operation merge(𝐶) which for a 𝑉1𝑉2-chunk 𝐶 ofH replaces all arcs of H intersecting 𝐶 by an arc 𝐸 = 𝑉1𝑉2with 𝐸 = 𝐶 and deletes the nodes whose incident arcs are all deleted.

We shall prove that this merge operation preserves thatH is a net (see Lemma3.4). LetHdenote the 𝑋 -net obtained fromH by applying merge(𝐶) on H for each maximal chunk 𝐶 of H. We call Hthe 𝑋 -net that aidsH. Such an aiding net has no non-trivial chunks and no parallel arcs. See Figure4for examples. The simple graph∇(H) is triconnected. 𝑉 is node ofHif and only if 𝑉 is a maximal split node ofH. 𝐸 is an arc of Hif and only if 𝐸 is a maximal chunk ofH (respectively, H). The next theorem is our characterization, which is the basis for our much more efficient near-linear time algorithm.

Theorem 3.1. 𝐺 is sapling-free if and only if 𝐺 admits a webH with a taming aiding netH.


Theorem3.1is stronger than Chudnovsky and Seymour’s Theo- rem2.2in that our proof of Theorem3.1provides as a new shorter proof of Theorem2.2. For the relation between the two structural theorems, we will prove in Lemma3.5(2) that every taming net of 𝐺 having no parallel arcs is local. Since the aiding netHin Theo- rem3.1has no parallel arcs,His local as required by Theorem2.2.

The algorithmic advantage of Theorem3.1is thatHis the aiding net of a webH which has more structure than an arbitrary net.

To get a self-contained proof of the easy if-direction of Theo- rem3.1, we prove more generally that if 𝐺 admits a taming net, then 𝐺 is sapling-free (Lemma3.5(1)). This proof holds for any net including nets with parallel arcs like our webH. Proving the only-if direction is the hard part for both structural theorems. Our new proof follows the same general pattern as the old one stated after the statement of Theorem2.2, but with crucial differences to be detailed later.

We grow an 𝑋 -webH with 𝑋 ⊆ 𝑉 (𝐺) until a sapling of 𝐺 is found orHbecomes taming, implying that 𝐺 is sapling-free by the if direction of Theorem3.1. In each iteration, ifHis not taming, we find a minimal set 𝑌 ⊆ 𝑉 (𝐺 −𝑋 ) with connected 𝐺 [𝑌 ] such that 𝑌 is notH-tamed. To prove the only-if direction of Theorem3.1, we show that if 𝐺[𝑋 ∪ 𝑌 ] is sapling-free, then H can be expanded to an 𝑋-web with 𝑋= 𝑋 ∪ 𝑌 .

Comparing with the proof of Chudnovsky and Seymour that we sketched below Theorem2.2, we note that in their case, their new 𝑋-net would be for some 𝑌 ⊆ 𝑋⊆ 𝑋 ∪ 𝑌 , whereas we get 𝑋= 𝑋 ∪ 𝑌 . This is why we can guarantee termination in 𝑂 (𝑛) rounds while they need a more complicated potential function to demonstrate enough progress in 𝑂(𝑛2) rounds.

Another major difference is that we operate both on a webH and its aiding netH. Recall that the webH is a net allowing parallel arcs, but with the special structure that all arcs are simple or flexible.

This special structure is crucial to our simpler inductive step where we can always add 𝑌 as above to get a new web over 𝑋= 𝑋 ∪ 𝑌 . If we just usedH, then we would have too many untamed sets. This is where we use the aiding netHwhich generally has fewer untamed sets. It is only for the minimallyH-untamed sets 𝑌 ⊆ 𝑉 (𝐺 −𝑋 ) that we can guarantee progress as above. Thus we need the interplay between the well-structured fine grained webH and its more coarse grained aiding netHto get our shorter more constructive proof of Theorem3.1. On its own, our more constructive characterization buys us a factor 𝑛 in speed. This has to be combined with efficient data structures to get down to near-linear time.

3.1 Two Lemmas & Our Algorithm for Sapling

LetH be an 𝑋 -net. An H-wild set is a minimally H-untamed 𝑌 ⊆ 𝑉(𝐺 −𝑋 ) such that 𝐺 [𝑌 ] is a path. In Figure5, 𝑌1∪𝑌2isH-untamed but notH-wild, since 𝑌1⊊ 𝑌1∪ 𝑌2isH-untamed. H is not taming if and only if 𝐺 admits anH-wild set. An 𝑆 ⊆ 𝑋 is H-solid if 𝑆 is a node ofH or 𝑆 is a subset of an arc 𝐸 = 𝑈𝑉 of H such that 𝐺 [𝐸]

contains no(𝑆, 𝑈 , 𝑉 )-sprout. If 𝑆 is a subset of a simple arc of H, then 𝑆 isH-solid if and only if 𝐺 [𝑆] is an edge, since a sprout has to be an induced subgraph of 𝐺 . Let 𝑌⊆ 𝑉 (𝐺 − 𝑋 ) such that 𝐺 [𝑌 ] is a path. 𝑌 isH-solid if (1) 𝑁 (𝑌, 𝑋 ) is the union of two H-solid sets and (2) 𝑁(𝑦, 𝑋 ) = ∅ for each internal vertex 𝑦, if any, of path 𝐺[𝑌 ]. A pod of 𝑌 in H is a 𝑉1𝑉2-chunk 𝐶 ofH with the following

Figure 5: An 𝑿 -web H, where 𝑿 consists of the vertices other than 𝒚1, 𝒚2, 𝒚3, 𝒚4. Vertices 𝒚1, . . . , 𝒚4are all H-tamed and H- tamed. 𝒀1and 𝒀2are H-wild and H-nonwild. 𝒀3is H-wild and H-wild. 𝒀1is H-solid. 𝒀2and 𝒀3are H-nonsolid. 𝑬1, 𝑬1∪ 𝑬2∪𝑬3, and 𝑬1∪𝑬2∪𝑬3∪𝑬4are pods of 𝒀1and 𝒀2in H. 𝒀3is H-unpodded. 𝒀1and 𝒀2are H-sticky and 𝒀3is H-nonsticky.

ConditionsP: P1: 𝑁(𝑌 , 𝑋 ) ⊆ 𝑉1∪ 𝐶 ∪ 𝑉2.P2: For each 𝑖 ∈ {1, 2}, 𝑁(𝑦, 𝑉𝑖) ⊆ 𝐶 or 𝑉𝑖 ⊆ 𝐶 ∪ 𝑁 (𝑦) holds for an end-vertex 𝑦 of path 𝐺[𝑌 ]. 𝑌 is H-podded if 𝑌 admits a pod in H. 𝑌 is H-sticky if 𝑌 is H-solid or H-podded. See Figure5.

Lemma 3.2. Let 𝑌 be anH-wild set for an 𝑋 -webH. (1) If 𝑌 is H-nonsticky, then 𝐺 [𝑋 ∪ 𝑌 ] contains a sapling. (2) If 𝑌 is H-sticky, thenH can be expanded to an 𝑋 ∪ 𝑌 -web.

By Lemmas2.1and3.2and Theorem3.1, the following algorithm detects saplings in 𝐺 :


StepA1: If a sapling of 𝐺 is found (Lemma2.1), then exit.

StepA2: Let 𝑋 -webH be the obtained base net of 𝐺 and repeat:

(a) IfHis taming, then report that 𝐺 is sapling-free (if-direction of Theorem3.1) and exit.

(b) IfHis not taming, then obtain anH-wild set 𝑌 .

(c) If 𝑌 isH-nonsticky, then report that 𝐺 [𝑋 ∪ 𝑌 ] contains a sapling (Lemma3.2(1)) and exit.

(d) If 𝑌 isH-sticky, then expand H to an 𝑋 ∪𝑌 -web (Lemma3.2(2)).

Lemma 3.3. AlgorithmAcan be implemented to run in 𝑂(𝑚 log2𝑛) time.

3.2 Reductions to Lemmas 3.2 and 3.3

This subsection reduces Theorems1.1,2.2, and3.1to Lemmas3.2 and3.3. We need a relationship between simple paths inH and induced paths in 𝐺 . For any simple 𝑈 𝑉 -pathP of H (i.e., 𝑈 and 𝑉 are the end-nodes ofP in H), we define a P-rung of 𝐺 as a 𝑈𝑉 -rung of 𝐺 where all edges are contained in the arcs ofP. Such a P-rung always exists by ConditionsN4andN6ofH as long as 𝑈 ≠ 𝑉 . For the degenerate case 𝑈 = 𝑉 , letP-rung be defined as the empty vertex set. For any distinct nodes 𝑈1and 𝑈2ofH intersecting a 𝑉1𝑉2-chunk 𝐶 ofH, there are disjoint UV-rungs P1andP2ofH withU = {𝑈1, 𝑈2} and V = {𝑉1, 𝑉2} by ConditionN1ofH. Since P1andP2are disjoint, anyP1-rung andP2-rung of 𝐺 are disjoint and nonadjacent by ConditionsN2andN6ofH. Consider the 𝑉1𝑉2- chunk 𝐶= 𝐸1∪ · · · ∪ 𝐸7in Figure3. LetV = {𝑉1, 𝑉2}. Let P1be the path ofH with arc 𝐸3. LetP2be the path ofH with arc 𝐸4. Let P3be the path ofH with arcs 𝐸6and 𝐸7. LetP4be the degenerate path ofH consisting of a single node 𝑉1. IfU = {𝑈1, 𝑈2}, then


P1andP2are disjointUV-rungs. If U = {𝑈1, 𝑊1}, then P1and P3are disjointUV-rungs of H. If U = {𝑉1, 𝑊1}, then P3and P4are disjointUV-rungs of H. The path of 𝐺 induced by vertex set{11, 12} is the unique P1-rung of 𝐺 . The path of 𝐺 induced by vertex set{17, 18} is the unique P2-rung of 𝐺 . The paths induced by vertex sets{25, 26, 27, 5, 4, 23} and {25, 26, 28, 7, 6, 24} are the two P3-rungs of 𝐺 . The empty vertex set is the uniqueP4-rung of 𝐺 .

Lemma 3.4. If 𝐶 is a 𝑉1𝑉2-chunk of an 𝑋 -netH, then applying merge(𝐶) on H results in an 𝑋 -net.

Lemma 3.5. (1) If 𝐺 admits a taming net, then 𝐺 is sapling-free.

(2) If an 𝑋 -netH has no parallel arcs, then every H-tamed subset of 𝑋 isH-local.

Since anyH-local subset of 𝑋 for any 𝑋 -net H is H-tamed, the if direction of Chudnovsky and Seymour’s Theorem2.2follows from Lemma3.5(1). Moreover, by Lemma3.5(2), the only-if direction of Theorem3.1implies the only-if direction of Theorem2.2. Thus, our proofs for Lemma3.5and the only-if direction of Theorem3.1form a self-contained proof for Theorem2.2.

Proof of Theorems1.1and3.1. Lemma3.5(1) implies the if di- rection of Theorem3.1. For the only-if direction of Theorem3.1, letH be an 𝑋 -web maximizing |𝑋 | by Lemma2.1. IfHwere not taming, then anyH-wild 𝑌 would beH-sticky by Lemma3.2(1), which in turn implies an 𝑋∪ 𝑌 -web by Lemma3.2(2), contradicting the maximality ofH. Thus Theorem3.1follows. By Lemmas2.1 and3.2and the if direction of Theorem3.1, AlgorithmAdetects saplings in 𝐺 . Thus, Theorem1.1follows from Lemma3.3. □ The above reduction of Theorem3.1does not need Lemma3.3or else our proof of Theorem2.2would not be shorter than that in [18].

To finish proving Theorems2.2and3.1, we prove Lemma3.2in §4.

After that, to finish proving Theorem1.1, we prove Lemma3.3in §5.


The next lemma for an 𝑋 -webH is needed for proving Lemma3.2(1) in §4.1and Lemma3.2(2) in §4.2. For any chunk 𝐶 of a netH, the arc setC of H for 𝐶 consists of the arcs of H that intersect 𝐶.

Lemma 4.1. (1) If 𝑌 is anH-wild set, then 𝑌 isH-podded if and only if 𝑌 isH-podded. (2) Each H-solid subset of 𝑋 isH-solid.

4.1 Proving Lemma 3.2 (1)

A netself-aids if it aids itself. Since the aiding net of any web self- aids, Lemma3.2(1) is immediate from Lemma4.2by Lemma4.1.

Lemma 4.2. For self-aiding 𝑋 -netH0andH0-wildH0-nonsticky set 𝑌 , 𝐺[𝑋 ∪ 𝑌 ] contains a sapling.

The rest of the subsection proves Lemma4.2via Lemmas4.3,4.4, and4.5. LetL consist of the leaves of the self-aiding net H in Lemma4.3,4.4, or4.5. Since∇(H) is triconnected, each nonleaf node ofH has degree at least three in H and any three-node set U of H admits pairwise disjoint UL-rungs P1,P2,P3ofH. By ConditionN6ofH, any P𝑖-rungs 𝑃𝑖 of 𝐺 with 𝑖 ∈ {1, 2, 3} are pairwise disjoint and nonadjacent.

Lemma 4.3. If 𝑌 is anH-wild H-nonsticky set for a self-aiding 𝑋 -netH of 𝐺 with 𝑁𝐺(𝑌 , 𝑋 ) = 𝑀1∪ 𝑀2and each of 𝑀1and 𝑀2is contained by a node or arc ofH, then 𝐺 [𝑋 ∪ 𝑌 ] contains a sapling.

If 𝑌 isH-wild for an 𝑋 -net H, then let ℓ (𝑌, H, 𝐺) denote the min- imum number ofH-tamed subsets of 𝑋 whose union is 𝑁𝐺(𝑌 , 𝑋 ).

A net issimple if all of its arcs are simple. IfH is a simple self- aiding 𝑋 -net of 𝐺 , then 𝐺[𝑋 ] is isomorphic to the line graph of a subdivision ofH.

Lemma 4.4. If 𝑌 is anH-wild set for a simple self-aiding 𝑋 -net H of 𝐺 with ℓ(𝑌 , H, 𝐺) = 2 such that 𝑁𝐺(𝑌 , 𝑋 ) contains a triad of H, then 𝐺[𝑋 ∪ 𝑌 ] contains a sapling.

Lemma 4.5. Let 𝑌 be anH-wild set for a simple self-aiding 𝑋 -net H of graph 𝐺 with ℓ (𝑌, H, 𝐺) ≥ 3. If 𝐺 [𝑋 ∪ 𝑌 ] is sapling-free, then 𝑌 isH-podded for 𝐺.

Proof of Lemma4.2. Assume for contradiction that 𝐺[𝑋 ∪𝑌 ] is sapling-free. A vertex set 𝐷⊆ 𝑋 is an inducing set of H0if 𝐺[𝐸0∩𝐷]

for each arc 𝐸0= 𝑈0𝑉0is an 𝑈0𝑉0-rung of 𝐺[𝐸0]. For any inducing set 𝐷 ofH0, letH0(𝐷) denote the simple self-aiding 𝐷-net of graph 𝐻0(𝐷) = 𝐺 [𝑌 ∪ 𝐷] obtained from H0by replacing each arc 𝐸0of H0with the arc 𝐸= 𝐸0∩ 𝐷 and replacing each node 𝑉0ofH0with the node 𝑉 = 𝑉0∩ 𝐷. Let 𝑁 = 𝑁𝐺(𝑌 , 𝑋 ). Let ℓ = ℓ (𝑌 , H0, 𝐺). If ℓ = 2, then Lemma4.3implies 𝑁 ⊈ 𝑆1∪ 𝑆2for any node or arc 𝑆𝑖ofH0with 𝑖∈ {1, 2}. Thus, 𝑁 contains a triadΔ and 𝑁 \ Δ is not contained by any arc ofH0between two nodes ofΔ. By ℓ = 2, there is an inducing set 𝐷 ofH0with ℓ(𝑌 , H0(𝐷), 𝐻0(𝐷)) = 2 and Δ ⊆ 𝑁𝐻0(𝐷)(𝑌 , 𝐷), contradicting Lemma4.4. Thus, ℓ≥ 3, implying a three-vertex set 𝑆⊆ 𝑁 such that every two-vertex subset of 𝑆 is H0-untamed. Let 𝐷 be an inducing set ofH0with 𝑆⊆ 𝐷, implying ℓ(𝑌 , H0(𝐷), 𝐻0(𝐷)) ≥ 3. By Lemma4.5, there is a pod 𝐸= 𝑈 𝑉 of 𝑌 inH0(𝐷) for 𝐻0(𝐷) such that 𝑁𝐻0(𝐷)(𝑌 ) intersects 𝐸 \ (𝑈 ∪ 𝑉 ), 𝑈\ 𝐸, and 𝑉 \ 𝐸. Let 𝐸0= 𝑈0𝑉0be the arc ofH0with 𝐸= 𝐸0∩ 𝐷, 𝑈 = 𝑈0∩ 𝐷, and 𝑉 = 𝑉0∩ 𝐷. Since 𝐸0is not a pod of 𝑌 inH0and 𝑁 intersects 𝐸0\ (𝑈0∪ 𝑉0), 𝑈0\ 𝐸0, and 𝑉0\ 𝐸0, a vertex 𝑥 belongs to 𝑁\ (𝑈0∪ 𝐸0∪𝑉0) or (𝑈0∪𝑉0) \ (𝐸0∪ 𝑁 ). Let 𝐷be an inducing set (𝐷 \ 𝐸0) ∪𝑉 (𝑃 ) of H0, where 𝐸0= 𝑈0𝑉0is the arc ofH0containing 𝑥 and 𝑃 is a 𝑈0𝑉0-rung of 𝐺[𝐸0] containing 𝑥 . One can verify that 𝑌 isH0(𝐷)-unpodded for 𝐻0(𝐷) with ℓ (𝑌 , H0(𝐷), 𝐻0(𝐷)) ≥ 3,

contradicting Lemma4.5. □

4.2 Proving Lemma 3.2 (2)

This subsection shows that if 𝑌 isH-sticky for an 𝑋 -web H, then H can be expanded to an 𝑋 ∪ 𝑌 -web via SubroutineBbelow. LetH be an 𝑋 -net. For anyH-solid subset 𝑆 of 𝑋 contained by a simple arc 𝐹 = 𝑈1𝑈2ofH, define Operation subdivide(𝑆) to (1) create a new node 𝑆 and (2) replace the simple arc by new simple arcs 𝑆𝑈𝑖 with 𝑖 ∈ {1, 2} consisting of the vertices of the 𝑆𝑈𝑖-rung of 𝐺[𝐹 ].

DefineSubroutineBwith 𝑁= 𝑁 (𝑌 , 𝑋 ) as follows (see Figure6):


StepB1: 𝑌 isH-solid. Let 𝑆1and 𝑆2beH-solid sets with 𝑁 = 𝑆1∪𝑆2. (a) For each 𝑖 ∈ {1, 2}, if 𝑆𝑖 is contained by a simple arc, then

create node 𝑆𝑖by subdivide(𝑆𝑖).

(b) Add each end-vertex 𝑦 of path 𝐺[𝑌 ] into the nodes 𝑆𝑖 with 𝑖∈ {1, 2} and 𝑆𝑖 ⊆ 𝑁 (𝑦).

(c) Make a simple arc 𝑌 = 𝑆1𝑆2.

StepB2: 𝑌 isH-nonsolid. Thus, 𝑌 is H-podded. Let 𝑉1𝑉2-chunk 𝐶 ofH be a minimal pod of 𝑌 in H. Since 𝑌 is H-wild, assume 𝑉1∈ 𝑉 (H) and 𝑉1⊆ 𝐶 ∪ 𝑁 without loss of generality.


Figure 6: Applying StepB1on the example in (a) results in the example in (b), in which 𝑬1∪𝑬2∪𝑭 is a minimal pod of the green 𝒚1𝒚2-rung. Applying StepB2(a)on the example in (b) results in the example in (c), in which 𝑬1∪𝑬2∪𝑬3is a minimal pod of the green 𝒚1𝒚2-rung. Applying StepsB2(b) andB2(c)on the example in (c) results in the example in (d).

(a) If 𝑉2is incident to exactly one arc 𝐹 = 𝑉 𝑉2in the arc set for 𝐶 , 𝑁 ∩ 𝑉2 ⊆ 𝐹 , and 𝐹 is simple, then 𝑁 intersects 𝐹 \ 𝑉 by the minimality of 𝐶 . Let 𝑣2be the end-vertex of the 𝑁 𝑉2-rung 𝑃 of 𝐺[𝐹 ] in 𝑁 . Let 𝑣 be the neighbor of 𝑣2not in 𝑃 . Call subdivide({𝑣, 𝑣2}) to create a node 𝑉2= {𝑣, 𝑣2}. Delete 𝑉 (𝑃 ) from 𝐶 to preserve that 𝐶 is a 𝑉1𝑉2-chunk that is a minimal pod of 𝑌 inH.

(b) UpdateH by merge(𝐶). Let 𝐸 = 𝑉1𝑉2be the arc ofH with 𝐸= 𝐶.

(c) Add 𝑌 to arc 𝐸 and add each end-vertex 𝑦 of path 𝐺[𝑌 ] to the nodes 𝑉𝑖with 𝑉𝑖 ⊆ 𝐶 ∪ 𝑁 (𝑦).

The resultingH of StepB1is an 𝑋∪ 𝑌 -web, since all steps preserve ConditionsNand all new arcs are simple. It remains to prove that the resultingH of StepB2is also an 𝑋∪ 𝑌 -web.

This completes the proof of our characterization in Theorem3.1 as well as Chudnovsky and Seymour’s characterization in Theo- rem2.2. SubroutineBcan be implemented to run in 𝑂(𝑚) time, so StepsA2(c)andA2(d)take 𝑂(𝑚) time. StepsA1,A2(a), andA2(b) take 𝑂(𝑚) time. Since the set of vertices of 𝐺 in H is enlarged by StepA2(d)and not affected elsewhere, StepA2halts in 𝑂(𝑛) iterations. Thus, AlgorithmAcan be implemented to run in 𝑂(𝑚𝑛) time. To finish proving Theorem1.1, it remains to implement Al- gorithmAto run in 𝑂(𝑚 log2𝑛) time in §5via dynamic graph algorithms and other data structures.


Let 𝐺 be represented by a static adjacency list. We use a dynamic adjacency list to represent an incremental biconnected multigraph Hwith 𝑉(H) = 𝑉 (H) that is a supergraph of ∇(H). An arc or node ofHisdummy if it is an empty vertex set of 𝐺 . Thus, the arcs of∇(H) between the leaves of H are dummy in H. Other dummy nodes and arcs are created only via operation merge. The 𝑋 -webH maintained by AlgorithmAis exactlyHexcluding its dummy arcs and nodes. See Figure7(a) for an example ofH. Each node and arc ofH and His associated with a distinctcolor that is a positive integer such that two vertices share a commonarc color (resp., node color) forH and Hif and only if they are contained by a common

Figure 7: An example of Hand T. The Q-knots are omit- ted for brevity. The virtual arc in dark purple in a nonroot knot 𝑲 matches a light purple arc in the parent of 𝑲 in T.

They form the pair of virtual arcs between the poles of 𝑲 . Each non-purple arc in a knot 𝑲 is a virtual arc whose cor- responding arc of His contained by a child Q-knot of 𝑲 . A non-purple arc is yellow if and only if its corresponding arc of His dummy. The dummy nodes of Hare yellow. H is the multigraph obtained from Hby deleting the yellow nodes and arcs. H is the simple graph obtained from the one in the root of T by deleting the yellow arcs. The maxi- mal split nodes of H, i.e., the nodes of Hare red.

arc (resp., node) ofH and H. For each vertex 𝑣 of 𝐺 , we maintain a set of at most six colors indicating the arc, maximal chunk, nodes, and maximal split nodes ofH that contain 𝑣, which are called the H-arc, H-arc,H-node, and H-node colors of vertex 𝑣 . For each color 𝑐 , we store its corresponding arc or node forH or Hand maintain the number of the vertices having the color 𝑐 without keeping an explicit list of these vertices. For each node 𝑉 and each incident arc 𝐸 of 𝑉 inH, we maintain the cardinality of the vertex set 𝐸∩𝑉 . Thus, it takes 𝑂 (1) time to (1) update and query the colors of a vertex and (2) add a vertex to an arc or node ofH. For each arc ofH, mark whether it is dummy, simple, or flexible. For each simple arc 𝐸= 𝑉1𝑉2ofH, use a doubly linked list to store the 𝑉1𝑉2- rung 𝐺[𝐸]. For vertex 𝑣 and vertex set 𝑌 of 𝐺, let 𝑑 (𝑣) = |𝑁 (𝑣) | and 𝑑(𝑌 ) =Í

𝑦∈𝑌𝑑(𝑦) throughout the section. Based on Lemma5.1, to be proved in §5.4, StepsA2(a)andA2(b)are implemented in

§5.1to run in overall 𝑂(𝑚 log2𝑛) time. StepA2(c)is implemented in §5.2to run in overall 𝑂(𝑚) time. StepA2(d), i.e., SubroutineB is implemented in §5.3to run in overall 𝑂(𝑚 log 𝑛 · 𝛼 (𝑛, 𝑛)) time, where 𝛼(𝑛, 𝑛) is the inverse Ackermann function.

5.1 Steps A2(a) and A2(b)

Vertex colors change only in StepA2(d), but the overall number of changes of theH-arc andH-node colors affects the analysis of our implementation of StepsA2(a)andA2(b). Therefore, this subsection analyzes the time for the change ofH-arc andH-node colors. The time for the change ofH-arc and H-node colors will be analyzed for StepA2(d)in §5.3. A vertex of 𝐺 stays uncolored until it is added into 𝑋 . Each vertex of 𝑋 has exactly oneH-arc color and at most twoH-node colors. Each node 𝑉 ofHstays a node ofH and each vertex in 𝑉 stays in 𝑉 for the rest the algorithm. Thus, the


H-node colors of each vertex are updated 𝑂(1) times throughout the algorithm, implying that the overall time for updatingH-node colors of all vertices is 𝑂(𝑛). Although the H-arc color of a vertex may change many times, the overall time for updating theH-node colors of all vertices can be bounded by 𝑂(𝑛 log 𝑛). Observe that H is updated by SubroutineBonly via (1) subdividing a simple arc of H, (2) merging an H-podded 𝑌 into a minimal pod of 𝑌 in H, and (3) creating an arc 𝐸= 𝑌 for anH-solid 𝑌 . If the simple graph H does not change, then each of these updates takes 𝑂(𝑑 (𝑌 )) time.

If the simple graphHchanges, then 𝑌 isH-solid. For instance, letH be as in Figure4(a), implying thatHis as in Figure4(b). If anH-solid 𝑌 joins H as the arc 𝐸16in Figure4(c), then all nodes and arcs ofH become nodes and arcs of H. However, once two vertices of 𝑋 have distinctH-arc colors, they can no longer share a common arc color forH for the rest of the algorithm. Thus, one can bound the overall number of changes ofH-arc colors of all vertices by 𝑂(𝑛 log 𝑛): If 𝐸 is an arc of the original Hand 𝐸1, . . . , 𝐸𝑘are the arcs of the updatedHwith 𝐸1∪ · · · ∪ 𝐸𝑘⊆ 𝐸 and|𝐸1| ≤ · · · ≤ |𝐸𝑘|, then let the vertices in 𝐸𝑘keep their original H-arc color and assign a newH-arc color to the vertices in each 𝐸𝑖with 𝑖 ∈ {1, . . . , 𝑘 − 1}. Since the cardinality of the arc of H containing a specific vertex of 𝑋 is halved each time itsH-arc color changes, itsH-arc color changes 𝑂(log 𝑛) times, implying that the H-arc colors of all vertices change overall 𝑂(𝑛 log 𝑛) times. With Lemma5.1, to be proved in §5.4, the overall time for StepsA2(a) andA2(b)throughout the algorithm is 𝑂(𝑚 log2𝑛).

Lemma 5.1. If 𝑋 is an incremental subset of 𝑉(𝐺) such that each 𝑥 ∈ 𝑋 has exactly one H-arc color 𝑎 and a set of at most twoH- node colors corresponding to a subset of the two end-vertices of 𝑎, then there is an 𝑂(𝑚 + 𝑛)-time obtainable data structure supporting the following queries and updates: (1) Move a vertex 𝑣 of 𝐺− 𝑋 to 𝑋 in amortized 𝑂(𝑑 (𝑣) · log2𝑛) time. (2) Update the colors of a vertex 𝑣 ∈ 𝑋 in amortized 𝑂 (𝑑 (𝑣) · log 𝑛) time. (3) Determine if there is a set 𝑌 ⊆ 𝑉 (𝐺 − 𝑋 ) with connected 𝐺 [𝑌 ] such that two vertices of 𝑁(𝑌 , 𝑋 ) share no color and, for the positive case, report a minimal such 𝑌 in amortized 𝑂(𝑑 (𝑌 ) · log2𝑛) time.

5.2 Step A2(c)

LetS be the 𝑂 (𝑑 (𝑌 ))-time obtainable set consisting of the nodes 𝑉 ofH with 𝑉 ⊆ 𝑁 (𝑌, 𝑋 ) and the simple arcs 𝐸 of H with 𝐺 [𝐸 ∩ 𝑁(𝑌 , 𝑋 )] being an edge. 𝑌 is H-solid if and only if |S| = 2, 𝑁 (𝑦, 𝑋 ) =

∅ for each internal node 𝑦 of path 𝐺 [𝑌 ], and 𝑁 (𝑌 , 𝑋 ) is contained by the union of the nodes or arcs inS. Therefore, it takes 𝑂 (𝑑 (𝑌 )) time to determine whether 𝑌 isH-solid. Lemma4.1(1) implies that 𝑌 isH-podded if and only if both of the following conditions hold:

(a) 𝑁(𝑌 , 𝑋 ) is contained by the union of an arc 𝐸 of H and its end-nodes 𝑉1and 𝑉2 inH and (b) 𝐸 is a pod of 𝑌 inH. Both conditions can be checked in 𝑂(𝑑 (𝑌 )) time via the H-arc and H-node colors of each vertex in 𝑁(𝑌 , 𝑋 ) and |𝑉1\ 𝐸 | and |𝑉2\ 𝐸 |.

Hence, it takes 𝑂(𝑑 (𝑌 )) time to determine whether 𝑌 is H-podded.

Since theH-wild sets 𝑌 in all iterations of the algorithm are pair- wise disjoint, it takes overall 𝑂(𝑚) time for StepA2(c)to determine whether 𝑌 isH-sticky throughout the algorithm.

Figure 8: Four examples of the lowest common ancestor 𝑲 of the Q-knots containing the arcs of H in C1∪C2, which equals 𝑬2in (a), 𝑬1∪𝑬2in (b), 𝑬1in (c), and 𝑬2∪𝑬3in (d).

5.3 Step A2(d), i.e., Subroutine B

This subsection implements SubroutineBso that the overall time of StepA2(d)throughout AlgorithmAis 𝑂(𝑚 log 𝑛 · 𝛼 (𝑛, 𝑛)). We may delete nodes and arcs fromH via merge(𝐶) for a minimal pod 𝐶 of 𝑌 inH, but they stay as dummy nodes and arcs in Hin order to make the multigraphHincremental. One can verify thatH aidsH, even thoughHis not an 𝑋 -net due to its dummy arcs and nodes. Although StepB1(b)may changeH, the overall time for updating theH-colors has been accounted for in §5.1. This subsection only analyzes the time for changingH-arc and H-node colors and|𝐸 ∩ 𝑉1| and |𝐸 ∩ 𝑉2| for each arc 𝐸 = 𝑉1𝑉2ofH.

TheSPQR-treeT of the incremental multigraph His an 𝑂(𝑛)- time obtainable 𝑂(𝑛)-space tree structure representing the tri- connected components of H [35, 41]. Each member of 𝑉(T), which we call a knot, is a graph homeomorphic to a subgraph ofH[35, Lemma 3] such that the knots induce a disjoint partition of the arcs ofH. Specifically, there is a supergraphG of Hwith 𝑉(G) = 𝑉 (H), where each arc of G \ His calledvirtual [62], and there are four types of knots ofT: (1) S-knot: a simple cycle on three or more nodes. (2)P-knot: three or more parallel arcs. (3) Q-knot: two parallel arcs, exactly one of which is virtual. (4) R-knot:

a triconnected simple graph that is not a cycle. The Q-knots are the leaves ofT and each arc of His contained by a Q-knot. No two S-knots (respectively, P-knots) are adjacent inT. Each virtual arc is contained by exactly two adjacent knots. SinceH has 𝑂 (𝑛) arcs by ConditionN2,T has 𝑂 (𝑛) knots. If 𝑈 and 𝑉 are nonleaf nodes of H such that 𝑈𝑉 is a virtual arc, then {𝑈 , 𝑉 } is a split pair of H. If distinct nodes 𝑈 and 𝑉 admit three internally disjoint 𝑈 𝑉 -paths in H, then 𝑈 and 𝑉 are contained by a common P-knot or R-knot of T [35]. By ConditionN1ofH, there are 3 internally disjoint paths in∇(H) between each pair of leaves of H, implying an R-knot ofT containing the leaves of H. Let T be rooted at this unique R-knot. Figure7(b) is theT for the Hin Figure7(a). Let 𝐾 be a nonroot knot ofT. The poles [41] of 𝐾 are the end-nodes of the unique virtual arc contained by 𝐾 and its parent knot inT. For the four nonroot knots 𝐾 in Figure8, 𝑉1and 𝑉4(respectively, 𝑉2) are the poles of the knots in (a) and (d) (respectively, (b) and (c)). Let C(𝐾) consist of the arcs of H in the descendant Q-knots of 𝐾 in T.

Let 𝐶(𝐾 ) consist of the vertices of 𝐺 contained by the arcs of C(𝐾).

If 𝑈 and 𝑉 are the poles of a nonroot knot 𝐾 ofT, then 𝐶 (𝐾) is a 𝑈 𝑉 -chunk andC(𝐾) is the arc set for 𝐶 (𝐾). A nonempty vertex set 𝐶 is a maximal chunk ofH if and only if 𝐶 = 𝐶 (𝐾) holds for a child knot 𝐾 of the root ofT. For instance, the 𝑋 -net H in Figure7(a) has six maximal chunks. One of them is 𝐶(𝐾 ) for the child R-knot




Related subjects :