 # How to navigate through obstacles?

Given a set of obstacles and two points, is there a path between the two points that does not cross more than k different obstacles? This is a fundamental problem that has undergone a tremendous amount of work. It is known to be NP-hard, even when the obstacles are very simple geometric shapes (e.g., unit-length line segments). The problem can be generalized into the following graph problem: Given a planar graph G whose vertices are colored by color sets, two designated vertices s, t ∈ V(G), and k ∈N, is there an s-t path in G that uses at most k colors? If each obstacle is connected, the resulting graph satisfies the color-connectivity property, namely that each color induces a connected subgraph. We study the complexity and design algorithms for the above graph problem with an eye on its geometric applications. We prove that without the color-connectivity property, the problem is W[SAT]-hard parameterized by k. A corollary of this result is that, unless W = FPT, the problem cannot be approximated in FPT time to within a factor that is a function of k. By describing a generic plane embedding of the graph instances, we show that our hardness results translate to the geometric instances of the problem. We then focus on graphs satisfying the color-connectivity property. By exploiting the planarity of the graph and the connectivity of the colors, we develop topological results to "represent" the valid s-t paths containing subsets of colors from any vertex v. We employ these results to design an FPT algorithm for the problem parameterized by both k and the treewidth of the graph, and extend this result to obtain an FPT algorithm for the parameterization by both k and the length of the path. The latter result directly implies previous FPT results for various obstacle shapes, such as unit disks and fat regions.

## Authors

##### This week in AI

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

## 1 Introduction

We consider the following problem: Given a set of obstacles and two designated points in the plane, is there a path between the two points that does not cross more than obstacles? Equivalently, can we remove obstacles so that there is an obstacle-free path between the two designated points? We refer to this problem as Obstacle Removal, and to its restriction to instances in which each obstacle is connected as Connected Obstacle Removal.

By considering the auxiliary plane graph that is the dual of the plane subdivision determined by the obstacles111We assume that the regions formed by the obstacles can be computed in polynomial time. We do not assume that the obstacles contain their interiors.If the intersection of two obstacles is not a 2-D region, we can thicken the borders of the obstacles without changing the sets of obstacles they intersect, so that their intersection becomes a 2-D region., Obstacle Removal was formulated and generalized into the following graph problem, referred to as Colored Path (see Figure 1 for illustrations):

Colored Path
Given: A planar graph ; a set of colors ; ; two designated vertices ; and
Question: Does there exist an - path in that uses at most colors?

Denote by Colored Path-Con the restriction of Colored Path to instances in which each color induces a connected subgraph of . Figure 1: Illustration of instances of the problem under consideration drawn within a bounding box. The left figure shows an instance in which the optimal path crosses two obstacles, zigzagging between the other obstacles. The right figure shows an instance and its auxiliary plane graph.

As we discuss next, Connected Obstacle Removal and Colored Path are fundamental problems that have undergone a tremendous amount of work, albeit under different names and contexts, by researchers in various areas, including computational geometry, graph theory, wireless computing, and motion planning.

### 1.1 Related Work

In motion planning, the goal is generally to move a robot from a starting position to a final position, while avoiding collision with a set of obstacles. This is usually referred to as the piano-mover’s problem. Obstacle Removal is a variant of the piano-mover’s problem, in which the obstacles are in the plane and the robot is represented as a point. Since determining if there is an obstacle-free path for the robot in this case is solvable in polynomial time, if no such path exists, it is natural to seek a path that intersects as few obstacles as possible. Motivated by planning applications, Connected Obstacle Removal and Colored Path were studied under the name Minimum Constraint Removal [11, 12, 16, 18]. Connected Obstacle Removal has also been studied extensively, motivated by applications in wireless computing, under the name Barrier Coverage or Barrier Resilience [1, 2, 25, 26, 30, 31]. In such applications, we are given a field covered by sensors (usually simple shapes such as unit disks), and the goal is to compute a minimum set of sensors that need to fail before an entity can move undetected between two given sites.

Kumar et al.  were the first to study Connected Obstacle Removal. They showed that for unit-disk obstacles in some restricted setting, the problem can be solved in polynomial time. The complexity of the general case for unit-disk obstacles remains open. Several works showed the NP-hardness of the problem, even when the obstacles are very simple geometric shapes such as line segments (e.g., see [1, 30, 31]). The complexity of the problem when each obstacle intersects a constant number of other obstacles is open [12, 18].

Bereg and Kirkpatrick  designed approximation algorithms when the obstacles are unit disks by showing that the length, referred to as the thickness  (i.e., number of regions visited), of a shortest path that crosses disks is at most ; this follows from the fact that a shortest path does not cross a disk more than a constant number of times.

Korman et al.  showed that Connected Obstacle Removal is FPT parameterized by for unit-disk obstacles, and extended this result to similar-size fat-region obstacles with a constant overlapping number, which is the maximum number of obstacles having nonempty intersection. Their result draws the observation, which was also used in , that for unit-disk (and fat-region) obstacles, the length of an optimal path can be upper bounded by a linear function of the number of obstacles crossed (i.e., the parameter). This observation was then exploited by a branching phase that decomposes the path into subpaths in (simpler) restricted regions, enabling a similar approach to that of Kumar et al. .

Motivated by its applications to networking, among other areas, the problem of computing a minimum-colored path in a graph received considerable attention (e.g., see [3, 32]). The problem was shown to be NP-hard in several works [3, 4, 18, 32].222We note that some works consider the edge-colored version of the problem, but for all purposes considered in this paper the two versions are equivalent. Most of the NP-hardness reductions start from Set Cover, and result in instances of Colored Path (i.e., planar graphs), as was also observed by . These reductions are FPT-reductions, implying the W-hardness of Colored Path. Moreover, these reductions imply that, unless P NP, the minimization version of Colored Path cannot be approximated to within a factor of , for any constant . Hauser , and Gorbenko and Popov 

, implemented exact and heuristic algorithms for the problem on general graphs. Very recently, Eiben

et al.  designed exact and heuristic algorithms for Colored Path and Obstacle Removal, and proved computational lower bounds on their subexponential-time complexity, assuming the Exponential Time Hypothesis.

Finally, we mention that there is a related problem that is solvable in polynomial time, which has received considerable attention [5, 19, 20], where the goal is to find a shortest path w.r.t. the Euclidean length between two given points in the plane that intersects at most obstacles. The Colored Path problem also falls into the category of many computationally-hard problems on colored graphs, where the objective is to compute a graph structure satisfying certain (desired) properties that uses the minimum number of colors (e.g., see ).

### 1.2 Our Results and Techniques

We study the complexity and parameterized complexity of Colored Path and Colored Path-Con, eyeing the implications on their geometric counterparts Obstacle Removal and Connected Obstacle Removal, respectively. We do not treat the problem on general graphs because, as we point out in Remark 3.13, this problem is computationally very hard, even when restricted to graphs satisfying the color-connectivity property.

Our first set of hardness results show that both problems are NP-hard, even when restricted to graphs of small outerplanarity and pathwidth, and that it is unlikely that they can be solved in subexponential time:

• Colored Path is NP-complete, even for outerplanar graphs of pathwidth at most 2 and in which every vertex contains at most one color (Theorem 3.1).

• Colored Path-Con is NP-complete even for 2-outerplanar graphs of pathwidth at most 3 (Corollary 3.2).

• Unless ETH fails, Colored Path-Con (and hence Colored Path) is not solvable in subexponential time, even for 2-outerplanar graphs of pathwidth at most 3 and in which each color appears at most 4 times (Corollary 3.3).

The reduction used to prove (i) produces instances of Colored Path that can be realized as geometric instances of Obstacle Removal whose overlapping number is at most 2. Thus, this hardness result extends to the aforementioned restriction of Obstacle Removal. The same reduction is then modified to yield (ii) and (iii) for Colored Path-Con; this reduction produces instances of Colored Path that can be realized as geometric instances of Connected Obstacle Removal whose overlapping number is at most 4, again showing that the hardness results extend to these restrictions of Connected Obstacle Removal.

We then study the parameterized complexity of Colored Path and Colored Path-Con. Clearly, Colored Path is in the parameterized class XP. We show that the color-connectivity property is crucial for any hope for an FPT-algorithm, since even very restricted instances and combined parameterizations of Colored Path are W-complete:

• Colored Path, restricted to instances of pathwidth at most 4, and in which each vertex contains at most one color and each color appears on at most 2 vertices, is W-complete parameterized by (Theorem 3.8).

• Colored Path, parameterized by both and the length of the sought path , is W-complete (Theorem 3.7).

Without restrictions, the problem sits high in the parameterized complexity hierarchy:

• Colored Path, parameterized by , is W[SAT]-hard (Theorem 3.10) and is in W[P] (Theorem 3.9).

A corollary of (vi) is that, unless W FPT, Colored Path cannot be approximated in FPT time to within a factor that is a function of (Corollary 3.12).

By producing a generic construction (Remark 3.4) that can be used to realize any graph instance of Colored Path as a geometric instance of Obstacle Removal, the hardness results in (iv)–(vi), and the inapproximability result discussed above, translate to Obstacle Removal. This geometric realization may slightly increase the overlapping number by at most 2. Previously, Colored Path was only known to be W-hard, via the standard reduction from Set Cover [3, 18, 32]. Our results refine the parameterized complexity and approximability of Colored Path and Obstacle Removal.

As noted in Remark 3.13, the color-connectivity property without planarity is hopeless: We can tradeoff planarity for color-connectivity by adding a single vertex that serves as a color-connector, thus establishing the W[SAT]-hardness of the problem on apex graphs.

The above hardness results show that we can focus our attention on Colored Path-Con. We show the following algorithmic result:

• Colored Path-Con, parameterized by both and the treewidth of the input graph, is FPT (Theorem 5.12).

We remark that bounding the treewidth does not make Colored Path-Con much easier, as we show in this paper that Colored Path-Con is NP-hard even for 2-outerplanar graphs of pathwidth at most 3 (Corollary 3.2).

The folklore dynamic programming approach based on tree decomposition, used for the Hamiltonian Path/Cycle problems, does not work for Colored Path-Con to prove the result in (vii) for the following reasons. As opposed to the Hamiltonian Path/Cycle problems, where it is sufficient to keep track of how the path/cycle interacts with each bag in the tree decomposition, this is not sufficient in the case of Colored Path-Con because we also need to keep track of which color sets are used on both sides of the bag. Although (by color connectivity) any subset of colors appearing on both sides of a bag must appear on vertices in the bag as well, there can be too many such subsets (up to , where is the set of colors), and certainly we cannot afford to enumerate all of them if we seek an FPT algorithm. To overcome this issue, we develop in Section 4 topological structural results that exploit the planarity of the graph and the connectivity of the colors to show the following. For any vertex , and for any pair of vertices , the set of (valid) - paths in that use colors appearing on vertices in the face of containing can be “represented” by a minimal set of paths whose cardinality is a function of .

In Section 5, we extend the notion of a minimal set of paths w.r.t. a single vertex to a “representative set” of paths w.r.t. a specific bag, and a specific enumerated configuration for the bag, in a tree decomposition of the graph. This enables us to use the upper bound on the size of a minimal set of paths, derived in Section 4, to upper bound the size of a representative set of paths w.r.t. a bag and a configuration. This, in turn, yields an upper bound on the size of the table stored at a bag, in the dynamic programming algorithm, by a function of both and the treewidth of the graph, thus yielding the desired result.

In Section 6, we extend the FPT result for Colored Path-Con in (vii) w.r.t. the parameters and , to the parameterization by both and the length of the path:

• Colored Path-Con, and hence Connected Obstacle Removal, parameterized by both and is FPT (Theorem 6.15).

The dependency on both and is essential for the result in (viii) : If we parameterize only by , or only by , then the problem becomes W-hard (Theorem 6.1 and Theorem 6.2). By Remark 3.4, these two results translate to Connected Obstacle Removal.

The result in (viii) generalizes and explains Korman et al.’s results  showing that Connected Obstacle Removal is FPT parameterized by for unit-disk obstacles, which they also generalized to similar-size fat-region obstacles with bounded overlapping number. Their results exploit the obstacle shape to upper bound the length of the path by a linear function of , and then use branching to reduce the problems to a simpler setting. Our result directly implies that, regardless of the (connected) obstacle shapes, as long as the path length is upper bounded by some function of (Corollary 6.16), the problem is FPT. The FPT result in (viii) also implies that:

• For any computable function , Colored Path-Con restricted to instances in which each color appears on at most vertices, is FPT parameterized by (Corollary 6.18).

Result (ix) has applications to Connected Obstacle Removal, in particular, to the interesting case when the obstacles are convex polygons, each intersecting a constant number of other polygons. The question about the complexity of this problem was posed in [12, 18], and remains open. The result in (ix) implies that this problem is FPT (Theorem 6.19).

We finally mention that it remains open whether Colored Path-Con and Connected Obstacle Removal are FPT parameterized by only.

## 2 Preliminaries

We assume familiarity with the basic notations and terminologies in graph theory and parameterized complexity. We refer the reader to the standard books [9, 10] for more information on these subjects.

#### Graphs.

All graphs in this paper are simple (i.e., loop-less and with no multiple edges). Let be an undirected graph. For an edge in , contracting means removing the two vertices and from , replacing them with a new vertex , and for every vertex in the neighborhood of or in , adding an edge in the new graph, not allowing multiple edges. Given a vertex-set , contracting means contracting the edges between the vertices in to obtain a single vertex at the end.

A graph is planar if it can be drawn in the plane without edge intersections (except at the endpoints). An apex graph is a graph in which the removal of a single vertex results in a planar graph. A plane graph has a fixed drawing. Each maximal connected region of the plane minus the drawing is an open set; these are the faces. One is unbounded, called the outer face. An outerplane graph is a plane graph for which every vertex is incident to the outer face; and outerplanar graph is a graph that has such a plane embedding. An -outerplane graph (resp. -outerplaner graph), for , is defined inductively as a graph such that the removal of its outer face results in an -outerplane graph (resp. -outerplaner graph) graph.

Let be a set of points in the plane, and let be two non self-intersecting curves that meet in precisely their common endpoints and . We say that and are isotopic w.r.t.  (also known as homotopic rel. boundary) if there is a continuous deformation from to through curves between and such that no intermediate curve in this deformation meets a vertex of in its interior.

Let and , , be two walks such that . Define the gluing operation that when applied to and produces that walk .

For a graph and two vertices , we denote by the distance between and in , which the length of a shortest path between and in .

#### Treewidth, Pathwidth and Tree Decomposition.

###### Definition 2.1.

Let be a graph. A tree decomposition of is a pair where is a collection of subsets of such that , and is a rooted tree whose node set is , such that:

1. For every edge , there is an , such that ; and

2. for all , if the node lies on the path between the nodes and in the tree , then .

The width of the tree decomposition is defined to be . The treewidth of the graph is the minimum width over all tree decompositions of .

A path decomposition of a graph is a tree decomposition of , where is a path. The pathwidth of a graph is the minimum width over all path decompositions of .

A tree decomposition is nice if it satisfies the following conditions:

1. Each node in the tree has at most two children.

2. If a node has two children and in the tree , then ; in this case node is called a join node.

3. If a node has only one child in the tree , then either and , and in this case is called an insert node; or and , and in this case is called a forget node.

4. If is a leaf node or the root, then .

#### Boolean Circuits and Parameterized Complexity.

A circuit is a directed acyclic graph. The vertices of indegree are called the (input) variables, and are labeled either by positive literals or by negative literals . The vertices of indegree larger than are called the gates and are labeled with Boolean operators and or or. A special gate of outdegree is designated as the output gate. We do not allow not gates in the above circuit model, since by De Morgan’s laws, a general circuit can be effectively converted into the above circuit model. A circuit is said to be monotone if all its input literals are positive. The depth of a circuit is the maximum distance from an input variable to the output gate of the circuit. A circuit represents a Boolean function in a natural way. The size of a circuit , denoted , is the size of the underlying graph (i.e., number of vertices and edges). An occurrence of a literal in is an edge from the literal to a gate in . Therefore, the total number of occurrences of the literals in is the number of outgoing edges from the literals in to its gates.

We say that a truth assignment to the variables of a circuit satisfies a gate in if makes the gate have value , and that satisfies the circuit if satisfies the output gate of . A circuit is satisfiable if there is a truth assignment to the input variables of that satisfies . The weight of an assignment is the number of variables assigned value by .

A parameterized problem is a subset of , where is a fixed alphabet. Each instance of the parameterized problem is a pair , where is called the parameter. We say that the parameterized problem is fixed-parameter tractable (FPT, if there is a (parameterized) algorithm, also called an FPT-algorithm, that decides whether an input is a member of in time , where is a computable function. Let FPT denote the class of all fixed-parameter tractable parameterized problems.

A parameterized problem is FPT-reducible to a parameterized problem if there is an algorithm, called an FPT-reduction, that transforms each instance of into an instance of in time , such that and if and only if , where and are computable functions. By FPT-time we denote time of the form , where is a computable function and is the input instance size.

Based on the notion of FPT-reducibility, a hierarchy of parameterized complexity, the W-hierarchy , where for all , has been introduced, in which the -th level W is the class FPT. The hardness and completeness have been defined for each level W[] of the W-hierarchy for . It is commonly believed that (see ). The W-hardness has served as the main working hypothesis of fixed-parameter intractability.

The class W[SAT] contains all parameterized problems that are FPT-reducible to the weighted satisfiability of Boolean formulas. It contains the classes W[t], for every . Boolean formulas can be represented (in polynomial time) by Boolean circuits that are in the normalized form (see ). In the normalized form every (nonvariable) gate has outdegree at most 1, and the gates are structured into alternating levels of ors-of-ands-of-ors…. Therefore, the underlying undirected graph of the circuit with the input variables removed is a tree; the input variables can be connected to any gate in the circuit, including the output gate. The class W[P] contains all parameterized problems that are FPT-reducible to the weighted satisfiability of Boolean circuits of polynomial size, and contains the class W[SAT].

Let be a parameterized minimization problem, and a computable function such that for every . A decision algorithm is an FPT cost approximation algorithm for with approximation ratio  , if for every input , its output satisfies the following:

• If , then rejects , and

• if , then accepts .

Furthermore, runs in FPT-time.

The Exponential Time Hypothesis (ETH) states that the satisfiability of -cnf Boolean formulas, where , is not decidable in subexponential-time , where is the number of variables in the formula. ETH has become a standard hypothesis in complexity theory for proving hardness results that is closely related to the computational intractability of a large class of well-known NP-hard problems, measured from a number of different angles, such as subexponential-time complexity, fixed-parameter tractability, and approximation.

The asymptotic notation suppresses a polynomial factor in the input length.

#### Colored Path and Colored Path-Con.

For a set , we denote by the power set of . Let be a graph, let be a finite set of colors, and let . A vertex in is empty if . A color appears on, or is contained in, a subset of vertices if . For two vertices , , a - path in is -valid if ; that is, if the total number of colors appearing on the vertices of is at most . A color is connected in , or simply connected, if induces a connected subgraph of . The graph is color-connected, if for every , is connected in .

For an instance of Colored Path or Colored Path-Con, if and are nonempty vertices, we can remove their colors and decrement by because their colors appear on every - path. If afterwards becomes negative, then there is no -valid - path in . Moreover, if and are adjacent, then the path is a path with the minimum number of colors among all - paths in . Therefore, we will assume:

###### Assumption 2.2.

For an instance of Colored Path or Colored Path-Con, we can assume that and are nonadjacent empty vertices.

###### Definition 2.3.

Let be two designated vertices in , and let be two adjacent vertices in such that . We define the following operation to and , referred to as a color contraction operation, that results in a graph , a color function , and two designated vertices in , obtained as follows:

• is the graph obtained from by contracting the edge , which results in a new vertex ;

• (resp. ) if (resp. ), and (resp. ) otherwise; and

• is the function defined as if , and .

is irreducible if there does not exist two vertices in to which the color contraction operation is applicable.

###### Lemma 2.4.

Let be a color-connected plane graph, a color set, , , and . Suppose that the color contraction operation is applied to two vertices in to obtain , , , as described in Definition 2.3. Then is a color-connected plane graph, and there is a -valid - path in if and only if there is a -valid - path in .

###### Proof.

Let and be the two adjacent vertices in to which the color contraction operation is applied, and let be the new vertex resulting from this contraction. It is clear that after the contraction operation the obtained graph is a plane color-connected graph.

Suppose that there is a -valid - path in , and let be such a path. We can assume that is an induced path. If no vertex in is on , then is a -valid - path in . If exactly one vertex in , say , is on , then since the color set of every vertex other than on is the same before and after the contraction operation, and since , the path obtained from by replacing with is a -valid - in . (Note that if then , and replacing with on is obsolete in this case.) Finally, if both and are on , then since is induced, and must appear consecutively on . Without loss of generality, assume and , for some . Since the color set of every vertex other than and on is the same before and after the operation, and since , the path is a -valid - path in .

Conversely, suppose that there is a -valid - path in , and let , where , be such a path. If does not appear on then is a -valid - path in . Otherwise, for some . If and consists only of vertex , then since , either , and in which case there is a trivial -valid - path in , or , and in this case is a -valid - path in . Otherwise, when we must have or , for , and ; without loss of generality, assume that . Since is adjacent to , either or (or both) is adjacent to . Since , if is adjacent to then is a -valid - path in , and if is adjacent to then is a -valid - path in . The case is similar if . Suppose now that and . If (resp. ) is adjacent to both and , then the path (resp.  is a -valid --path in ; otherwise, one vertex in , say , must be adjacent to , and the other vertex must be adjacent to . In this case the path is a -valid --path in . ∎

## 3 Hardness Results

In this section, we study the complexity and the parameterized complexity of Colored Path and Colored Path-Con and their geometric counterparts Obstacle Removal and Connected Obstacle Removal. We start by showing that both problems are NP-hard, even when restricted to graphs of small outerplanarity and pathwidth. Figure 2: Illustration of the construction in the proof of Theorem 3.1. The left figure shows the geometric instance of Colored Path, and the right figure the graph associated with it.
###### Theorem 3.1.

Colored Path, restricted to outerplanar graphs of pathwidth at most 2 and in which every vertex contains at most one color, is NP-complete.

###### Proof.

It is clear that Colored Path is in NP. To show its NP-hardness, we reduce from the NP-hard problem Vertex Cover . Let be an instance of Vertex Cover, where and . In the rest of the proof, when we write for an edge in , we assume that and such that (i.e., the vertex of smaller index always appears first). Although not necessary for the proof, we first describe an instance of Obstacle Removal whose associated graph is the desired instance of Colored Path. The regions of are , depicted in Figure 2 (left figure). The obstacles of are defined as follows. For each vertex , the obstacle corresponding to is the polygon whose boundary is the boundary of the region formed by the union of , each such that , and each such . More formally, the obstacle corresponding to is . The graph associated with , , is defined as follow. Each (empty) region , , corresponds to a vertex , where corresponds to and to . Each region , , corresponds to a vertex , and each region , , corresponds to a vertex . The set of edges is . The color function , where , is defined as follows: , for ; and , where , for . This completes the construction of ; see Figure 2 (right figure) for illustration. It is easy to see that is outerplanar and has pathwidth at most 2.

Define the reduction from Vertex Cover to Colored Path that takes an instance to the instance . Clearly, this reduction is polynomial-time computable. Suppose that , where , is a vertex cover of . Consider the - path in , where if edge is covered by , and otherwise, for . Clearly this is a -valid - path in since each edge is covered by a vertex in , each is colored by the index of one of the vertices in , and each vertex in (and hence each ) contains at most one color. Conversely, suppose that is a -valid - path in . By construction of , has to contain at least one vertex from , for each . If contains both and , for some , then clearly, from the construction of , must contain either or , as a subpath, and we can shortcut this subpath by removing one of , to obtain another -valid - path in . Therefore, without loss of generality, we may assume that contains exactly one vertex from , for . Now define the set of vertices in as the vertices in whose indices are the colors appearing on (the ’s in) . More formally, define . Since is a -valid path in , the total number of colors appearing on is at most . Notice that the color of each of is the index of a vertex in that covers edge . It follows that the set of vertices in , that are the indices of the colors on , form a -vertex cover of . ∎

###### Corollary 3.2.

Colored Path-Con, restricted to 2-outerplanar graphs of pathwidth at most 3, is NP-complete.

###### Proof.

This follows directly from the NP-hardness reduction in the proof of Theorem 3.1 by observing the following. The graph resulting from the reduction is outerplanar. We can add a new vertex to the outer face of (see Figure 3) containing all colors that appear on , and add edges between the new vertex and all vertices in . The obtained graph is color-connected and has pathwidth at most 3. ∎

Assuming ETH, the following corollary rules out the existence of subexponential-time algorithms for Colored Path-Con (and hence for Colored Path), even for restrictions of the problem to graphs of small outerplanarity, pathwidth, and maximum number of occurrences of each color:

###### Corollary 3.3.

Unless ETH fails, Colored Path-Con, restricted to 2-outerplanar graphs of pathwidth at most 3 and in which each color appears at most 4 times, is not solvable in time, where is the number of vertices in the graph.

###### Proof.

It is well known, and follows from  and the standard reduction from Independent Set to Vertex Cover, that unless ETH fails, Vertex Cover, restricted to graphs of maximum degree at most 3, denoted VC-3, is not solvable in subexponential time. Starting from an instance of VC-3 with vertices, and observing that the reduction in the proof of Theorem 3.1 results in an instance of Colored Path-Con whose number of vertices is , of pathwidth at most 3, and in which each color appears at most 4 times, proves the result. ∎ Figure 4: Illustration of the construction of the gadget Gi,j in the proof of Lemma 3.5. Figure 5: Illustration of the construction of G′ in the proof of Lemma 3.5.

Next, we shift our attention to studying the parameterized complexity of Colored Path and Colored Path-Con. The reduction from Set Cover showing the NP-hardness of Colored Path, given in several works [3, 18, 32], is in fact an FPT-reduction implying the W-hardness of Colored Path. We will strengthen this result, and show in the remainder of this section that Colored Path is W[SAT]-hard. We will also prove the membership of the problem in W[P], which adds a natural W[SAT]-hard problem to this class. The W[SAT]-hardness result shows that the problem is hopeless in terms of it having FPT-algorithms. We start by showing that the problem remains W-hard, even when restricted to instances of small pathwidth (and hence small treewidth) and maximum number of occurrences of each color. We then show that the problem remains W-hard even when parameterized by both and the length of the sought path.

###### Remark 3.4.

Before we prove our parameterized hardness results for Colored Path, we remark that we can obtain equivalent hardness results for Obstacle Removal using the following generic realization of instances of Colored Path as instances of Obstacle Removal. Given an instance of Colored Path, we define an equivalent instance of Obstacle Removal as follows. We start by fixing a straight-line plane embedding of , which always exists by Fáry’s theorem . Moreover, we can compute such an embedding in linear time . We define the starting and finishing positions of the path as the images of vertices and under , respectively. To force the path to go along the edges of , we correspond with every edge a “corridor” by putting on both sides of the image of the edge trapezoids as shown in Figure 6. The only possible way to move along the vertices of the graph without intersecting more than obstacles is to move within these corridors. Finally, for each color and every vertex such that , we create a rectangle around the image of the vertex under that intersects all the trapezoids corresponding to the edges incident to . We define the obstacle corresponding to the color in the geometric instance to be the union of these rectangles. This disallows the use of less than trapezoid obstacles to go through a vertex of without intersecting all the obstacles representing the color set . Note that the only thing that is affected by this geometric realization is the number of obstacles that overlap at a region, which corresponds to the number of colors on the vertex in the graph that corresponds to the region; this number might increase by at most 2. Figure 6: Illustration of the realization of an instance of Colored Path as an instance of Obstacle Removal.
###### Lemma 3.5.

Colored Path, restricted to instances of pathwidth at most 4 and in which each vertex contains at most one color and each color appears on at most 2 vertices, is W-hard parameterized by .

###### Proof.

We reduce from the W-hard problem Multi-Colored Clique . Let be an instance of Multi-Colored Clique, where is partitioned into the color classes . Let . We describe how to construct an instance of Colored Path. For an edge , associate a distinct color , and define . To simplify the description of the construction, we start by defining a gadget that will serve as a building block for this construction.

For a vertex in color class , we define the gadget as follows. Create a copy of each color class , , and remove from each all copies of vertices that are not neighbors of in . Let the resulting copies of the color classes be . We define the color of a copy of a neighbor of as , where . Next, we introduce empty vertices , . For , we connect all vertices in to , and connect to all vertices in . This completes the construction of gadget ; we refer to and as the first and last color classes in gadget , respectively. See Figure 4 for illustration of . Observe that every path from a vertex in to a vertex in contains exactly one vertex from each , , and contains all vertices , . Therefore, any such path contains the colors of exactly distinct edges that are incident to .

We finish the construction of by introducing new empty vertices , and connecting them as follows. For each color class , , and each vertex , we create the gadget , connect to each vertex in the first color class of , and connect each vertex in the last color class of to . Let be the resulting graph. Finally, we set , , and . See Figure 5 for illustration. This completes the construction of the instance of Colored Path. Observe that each vertex in contains at most one color, and that each color of an edge in , appears on exactly two vertices in : the copy of in the gadget of , and the copy of in the gadget of .

Clearly, the reduction that takes an instance of Multi-Colored Clique and produces the instance of Colored Path is computable in FPT-time. To show its correctness, suppose that is a yes-instance of Multi-Colored Clique, and let be a -clique in . Then contains a vertex from each , for . For a vertex , let be its gadget, and define the path as follows. In each color class in , pick the unique vertex that is a copy of a neighbor of in ; define to be the path in induced by the picked vertices, plus the empty vertices , , that appear in . Finally, define to be the - path in whose edges are: the (unique) edge between and an endpoint of , , and the (unique) edge between an endpoint of and , for . To show that is -valid, observe that all the nonempty vertices in are vertices whose color is the color of an edge between two vertices in . This shows that the number of colors that appear on is at most , and hence, is -valid. It follows that is a yes-instance of Colored Path.

Conversely, suppose that is a -valid - path in . Then must start at , visit the gadgets of exactly vertices , for , and end at . We claim that is a clique in . Recall that the subpath of that traverses a gadget of contains the colors of exactly edges that are incident to . Therefore, the total number of occurrences of colors (counting multiplicities) on is precisely . Since is -valid, and each color of an edge in appears exactly twice in , it follows that each color that appears on appears exactly twice on . This is only possible if the gadgets corresponding to the two endpoints of the edge are traversed by , and hence, both endpoints of the edge are in . Therefore, contains the colors of edges, whose both endpoints are in . Since , it follows that is a -clique in , and that is a yes-instance of Multi-Colored Clique. ∎

###### Lemma 3.6.

Colored Path, parameterized by both and the length of the path , is in W.

###### Proof.

To prove membership in W, we use the characterization of the class W given by Chen et al. :

A parameterized problem is in W if and only if there is a computable function and a nondeterministic FPT algorithm for a nondeterministic-RAM machine deciding , such that, for each instance of ( is the parameter), all nondeterministic steps of take place during the last steps of the computation.

Therefore, to show that Colored Path is in W, it suffices to exhibit such a nondeterministic FPT algorithm . works as follows: It guesses a set of colors and guesses a sequence of internal vertices of the path. Then it verifies that is a path in , and that , for . It is not difficult to see that this verification can be implemented in steps, where is a computable function. ∎

By Lemma 2.4, we can assume that in an instance of Colored Path, no two adjacent vertices are empty. With this assumption in mind, if the instance satisfies that each vertex contains at most one color and that each color appears on at most 2 vertices, then any -valid - path has length at most . It follows from Lemma 3.5 and Lemma 3.6 that:

###### Theorem 3.7.

Colored Path, parameterized by both and the length of the path , is W-complete.

###### Theorem 3.8.

Colored Path, restricted to instances of pathwidth at most 4 and in which each vertex contains at most one color and each color appears on at most 2 vertices, is W-complete parameterized by .

Next, we show that Colored Path sits high up in the parameterized complexity hierarchy. We start by showing its membership in W[P]:

###### Theorem 3.9.

Colored Path, parameterized by , is in W[P].

###### Proof.

We give an FPT-reduction from Colored Path to Weighted Boolean Circuit Satisfiability (WBCS) on polynomial size (monotone) circuits. Given an instance of Colored Path, we construct an instance of WBCS, where is a circuit whose output gate is an or-gate, as follows. By Assumption 2.2, we can assume that and are nonadjacent empty vertices. By Lemma 2.4, we can also assume that no two adjacent vertices are empty. For each color , we create a variable ; those are the input variables to . In addition to the output gate, contains layers of gates, where each layer, except the first, consists of two rows of gates, , for , and the first layer consists of one row of gates. The layers of are defined as follows.

Each gate in is an and-gate that corresponds to a neighbor of ; the input to is the set of input variables corresponding to the colors in . Suppose that row in layer , , has been defined, and we describe how and are defined. For every vertex with a neighbor such that has a corresponding and-gate in , we create an or-gate in and an and-gate in corresponding to ; we connect the output of each and-gate in corresponding to neighbor of to the input of or-gate in , and connect the output of the or-gate and each input variable such that to the and-gate in . If , then we connect the output of the and-gate to the output gate of the circuit. This completes the description of . Clearly, the reduction that takes to runs in polynomial time, and hence in FPT-time. Next, we prove its correctness.

First observe that the only gates in that are connected to its output gate are the and-gates that correspond to . Second, every gate in corresponds to a vertex that is reachable from in . Moreover, for every and-gate corresponding to a vertex , and every - path in , the truth assignment that assigns 1 to the variables corresponding to the colors of this path satisfies .

Suppose now that is a yes-instance of Colored Path. Then there is an - -valid path in . Based on the above observations, the assignment that assigns if and only if is a satisfying assignment to of weight at most . Conversely, suppose that has a satisfying assignment of weight at most . Then there is an and-gate corresponding to that is satisfied by , and there is a path in from a gate corresponding to neighbor of in to , all of whose gates are satisfied by . It is easy to verify that this path in corresponds to an - path all of whose colors correspond to the input variables assigned 1 by , and hence this path is -valid. ∎ Figure 7: Illustrations of the construction of the gadgets for an or-gate (top) and an and-gate (bottom) in the proof of Theorem 3.10.
###### Theorem 3.10.

Colored Path, parameterized by , is W[SAT]-hard.

###### Proof.

We give an FPT-reduction from the W[SAT]-complete problem Monotone Weighted Boolean Formulas Satisfiability (M-WSAT) .

Recall that a Boolean formula corresponds to a circuit in the normalized form. Therefore, we can assume that the input instance of M-WSAT is , where is a monotone Boolean circuit in which each (non-variable) gate has fan-out at most 1, and the gates of are structured into alternating levels of ors-of-ands-of-ors. We construct an instance of Colored Path as follows.

First, we let , where color will represent input variable in . We define from by defining a gadget for each gate in recursively, starting the recursive definition at the output gate of . For a gate in , its gadget is defined by distinguishing the type of as follows.

If is an and-gate, let be the or-gates, and be the input variables that feed into . The gadget of is defined as follows. First, create two empty vertices and , which will serve as the “entry” and “exit” vertices of the gadget for , respectively. For each , , create a vertex colored with color and an entry vertex and an exit vertex ; form a path consisting of the vertices . For each or-gate , , recursively construct the gadget for . Connect all these gadgets serially in arbitrary order, starting by identifying with the entry vertex of the first gadget, the exit vertex of the first gadget with the entry of the second, …, and the exit vertex of the last gadget with . See Figure 7 (bottom) for illustration.

If is an or-gate, let be the and-gates, and be the input variables that feed into . The gadget of is defined as follows. First, create two empty vertices and , which will serve as the “entry” and “exit” vertices of the gadget for , respectively. For each , , create a vertex colored with color , and connect each to and . For each and-gate , , recursively construct the gadget for . Connect all these gadgets in parallel by identifying all the entry vertices of with and all their exit vertices with . This complete the description of . It is not difficult to see that since with its input variables removed is a tree, the above construction runs in polynomial time and results in a planar graph . See Figure 7 (top) for illustration.

Finally, set and to be the entry and exit vertices of the gadget corresponding to the output gate of . Clearly, the reduction that takes and produces runs in FPT-time. Next, we prove its correctness.

We will prove the following statement: For any gate in , and any assignment to that assigns variables the value 1, and all other variables the value 0, satisfies if and only if there is a path in from the entry vertex to the exit vertex of the gadget corresponding to such that uses a subset of the colors . Clearly, proving the aforementioned statement implies that there is a -valid - path in if and only if there is an assignment of weight at most that satisfies the output gate of , and hence satisfies .

We prove the above statement by induction on the depth of the gate in . The base case is when has depth 1. In this case the input to consists only of input variables. Suppose first that is an or-gate, and let be an assignment that assigns exactly variables the value 1. Then satisfies if and only if is an input variable to , for some , which is true if and only if there is a path from the entry vertex of the gadget for to its exit vertex that uses color . Suppose now that is an and-gate, and let be an assignment that assigns exactly variables the value 1. Then satisfies if and only if the input variables to form a subset of ; let be the indices of the variables in . Since the gadget for consists of a path between the entry and exit vertices of the gadget for such that , the statement follows.

Suppose, by the inductive hypothesis, that the statement we are proving is true for any gate of depth , and let be a gate of depth . Let be the input variables to , and be the input gates to . We again distinguish two cases based on the type of .

Gate is an or-gate. Let be an assignment that assigns exactly variables the value 1. Suppose first that satisfies . Then either satisfies an input variable , , or satisfies an input and-gate , . If satisfies then there is a path between the entry and exit vertices of the gadget for that uses color . Otherwise, satisfies , , and by the inductive hypothesis applied to , there is a path between the entry and exit vertices of the gadget for such that . From the way the gadget for was constructed, it follows that is also a path between the entry and exit vertices of the gadget for . To prove the converse, suppose that there is a path between the entry and exit vertices of the gadget for that uses a subset of colors in . Either is a path whose only internal vertex corresponds to an input variable, and in such case the input variable is in , and is satisfied; or is a path between the entry and exit vertices of the gadget for an and-gate that feeds into , and by the inductive hypothesis, satisfies and also .

Gate is an and-gate. Let be an assignment that assigns exactly variables