A Graph Width Perspective on Partially Ordered Hamiltonian Paths and Cycles II
Abstract
We consider the problem of finding a Hamiltonian path or cycle with precedence constraints in the form of a partial order on the vertex set. We study the complexity for graph width parameters for which the ordinary problems Hamiltonian Path and Hamiltonian Cycle are in . In particular, we focus on parameters that describe how many vertices and edges have to be deleted to become a member of a certain graph class. We show that the problems are -hard for such restricted cases as vertex distance to path and vertex distance to clique. We complement these results by showing that the problems can be solved in time for vertex distance to outerplanar and vertex distance to block. Furthermore, we present some algorithms, e.g., for edge distance to block. Additionally, we prove para--hardness when considered with the edge clique cover number.
Keywords and phrases:
Hamiltonian path, Hamiltonian cycle, partial order, graph width parameter, parameterized complexityFunding:
Fabienne Ratajczak: The research was funded by the Federal Ministry for Digital and Transport Germany through the research project MoVeToLausitz (grant number 19FS2032C).Copyright and License:
2012 ACM Subject Classification:
Mathematics of computing Paths and connectivity problems ; Mathematics of computing Graph algorithms ; Theory of computation Parameterized complexity and exact algorithms ; Theory of computation Problems, reductions and completenessEditors:
Akanksha Agrawal and Erik Jan van LeeuwenSeries and Publisher:
Leibniz International Proceedings in Informatics, Schloss Dagstuhl – Leibniz-Zentrum für Informatik
1 Introduction
Hamiltonian Paths and Cycles with Precedence.
For some applications of the well-known Traveling Salesman Problem (TSP) it is necessary to add additional precedence constraints to the vertices which ensure that some vertices are visited before others in a tour. Examples are Pick-up and Delivery Problems [42, 43] or the Dial-a-Ride problem [45], where goods or people have to be picked up before they can be brought to their destination.
The generalization of TSP with this type of constraint is known as Traveling Salesman Problem with Precedence Constraints (TSP-PC) and has been studied, e.g., in [1, 9]. If we are looking for a path instead of a cycle, this is known as the Sequential Ordering Problem (SOP) or the Minimum Setup Scheduling Problem and has been studied, e.g., in [2, 11, 22, 23].
As TSP is already -complete without the precedence constraints, research on these problems has mainly focused on the practical applications and solution methods are restricted to heuristic algorithms and integer programming. When moving to the structurally different Hamiltonian path (cycle) problem, only very restricted precedence constraints have been studied, e.g., where one or both endpoints of the Hamiltonian path are fixed. For these problems, polynomial-time algorithms have been presented for several graph classes including (proper) interval graphs [3, 4, 38, 39] and rectangular grid graphs [33].
In [7], Beisegel et al. introduce the Partially Ordered Hamiltonian Path Problem (POHPP), where we are given a graph together with a partial order and search for a Hamiltonian path that is a linear extension of the partial order. Additionally, they introduced the edge-weighted variant Minimum Partially Ordered Hamiltonian Path Problem (MinPOHPP). The authors show that POHPP is already -hard for complete bipartite graphs and complete split graphs – graph classes where Hamiltonian Path is trivial. They also show that POHPP is -hard when parameterized by the width of the partial order, i.e., the largest number of pairwise incomparable elements. Furthermore, they show that the algorithm for that parameterization presented in the 1980s by Coulbourn and Pulleyblank [11] is asymptotically optimal – assuming the Exponential Time Hypothesis (ETH). They improve the algorithm to time if the problem is parameterized by the partial order’s distance to linear order. Finally, the authors present a polynomial-time algorithm for MinPOHPP on outerplanar graphs.
Graph Width Parameters and Hamiltonicity.
In [7], Beisegel et al. imply that their result for outerplanar graphs might be extended to series parallel graphs, otherwise known as the graphs of treewidth two. Furthermore, they suggest further research on the complexity of (Min)POHPP for graphs of bounded treewidth as well as other graph width parameters. Just as for specific graph classes, the prerequisite to solving (Min)POHPP for some graph parameter is the tractability of the base problems Hamiltonian Path and Hamiltonian Cycle. These belong to the most famous -complete graph problems and, hence, have been studied for a wide range of graph classes and graph width parameters.111In general, Hamiltonian Path seems to lead a shadowy existence since many positive and negative algorithmic results are only given for its more popular sibling Hamiltonian Cycle.
One of the first results for width parameters were polynomial-time algorithms for Hamiltonian Cycle and TSP on graphs of bounded bandwidth [31, 40]. Since both Hamiltonian Cycle and Hamiltonian Path are expressible in , Courcelle’s theorem [12, 13] implies algorithms for these problems when parameterized by treewidth. The running time bounds depending on the treewidth given by Courcelle’s theorem are quite bad. However, there are also algorithms with single exponential dependency on [10, 14, 15]. Probably, these results cannot be transferred to cliquewidth: In contrast to , both Hamiltonian Cycle and Hamiltonian Path are not expressible in [21, Corollary 5.3.5]. In fact, Hamiltonian Cycle is -hard when parameterized by cliquewidth [27] and – unless – it is not solvable in time. Furthermore, it was shown that – unless the ETH fails – the problem cannot be solved in time where is the cliquewidth and is the number of vertices [28]. This lower bound is matched by an algorithm given by Bergougnoux et al. [8]. algorithms for cliquewidth with worse exponents have been presented earlier by Wanke [48] (for the equivalent NLC-width) and by Espelage et al. [24].
As algorithms for Hamiltonian Path and Hamiltonian Cycle parameterized by cliquewidth are highly unlikely, the research has focused on upper bounds of cliquewidth. algorithms were presented for neighborhood diversity [37], distance to cluster [19, 34], modular width [29] and split matching width [46, 47]. Besides this, parameterized algorithms have also been given for graph width parameters incomparable to cliquewidth and treewidth. Examples are algorithms for distance to proper interval graphs [32] and for two parameters that describe the distance to Dirac’s condition on the existence of Hamiltonian paths [35]. Most recently, algorithms for the independence number have been presented [26].
The parameters treewidth, pathwidth, and bandwidth in the context of (Min)POHPP have been studied in the companion paper [5], where we showed that POHPP is -hard for small constants. Furthermore, it follows directly from the NP-completeness of POHPP on complete bipartite graphs that it is also -complete on graphs of cliquewidth , neighborhood diversity , modular width and split matching width . As implied before, the next likely candidates to yield or algorithms are the parameters that consider the smallest number of vertices or edges that have to be removed such that the resulting graph is in some given graph class. We refer to these parameters as (vertex) distance to and edge distance to where is the respective graph class.222Alternative terms for these parameters are vertex deletion number and edge deletion number. Here, we will also consider a special variant of these distance parameters that is motivated by the parameter twin-cover number introduced by Ganian [30]. We say a graph has distance to module(s)333If the class contains only connected graphs, then we use distance to module otherwise we use distance to modules. if there is a set of vertices such that is in and every component of forms a module in . Using this terminology, the twin-cover number is equal to the distance to cluster modules.
Our Contribution.
We study the complexity of (Min)POHPP and its cycle variant for graph width parameters where Hamiltonian Path and Hamiltonian Cycle can be solved in time (see Figure 1 for an overview). We will show that the computational complexity of the path and cycle problems are essentially equivalent (see Observations 2.1 and 2.2) and therefore all proofs will focus on the path version.
Section 3 is dedicated to sparse parameters, i.e., graph parameters that are unbounded for complete graphs. We show that POHPP is -hard for distance to path and distance to linear forest modules. We present simple arguments why MinPOHPP can be solved in time for feedback edge set number and treedepth. Furthermore, we present an algorithm for distance to outerplanar. We also give an algorithm for plane graphs parameterized by the number of vertices that lie in the interior of the outer face.
In Section 4, we consider graph width parameters that are bounded for cliques. We show that POHPP is -complete for graphs of edge clique cover number 3 and clique cover number 2. Furthermore, we prove -hardness for distance to clique and distance to cluster modules aka twin cover number. On the positive side, we present an algorithm for POHPP when parameterized by distance to block and algorithms when parameterized by edge distance to block or distance to clique module.
Due to space constraints, we omit some of the proofs and sketch the others. The detailed proofs can be found in the full version [6].
2 Preliminaries
General Notation and Partial Orders.
For , the notation refers to the set . A partial order on a set is a reflexive, antisymmetric and transitive relation on . The tuple is then called a partially ordered set. We also denote by if . If it is clear which partial order is meant, then we sometimes omit the index. A minimal element of a partial order on is an element for which there is no element with .
A linear ordering of a finite set is a bijection . We will often refer to linear orderings simply as orderings. Furthermore, we will denote an ordering by a tuple which means that . Given two elements and in , we say that is to the left (resp. to the right) of if (resp. ) and we denote this by (resp. ). A linear extension of a partial order is a linear ordering of that fulfills all conditions of , i.e., if , then .
Graphs and Graph Classes.
All the graphs considered here are finite. For the standard notation of graphs we refer to the book of Diestel [18].
For a subgraph of , we say that two vertices are -neighbors if . A vertex of a connected graph is a cut vertex if is not connected. If does not contain a cut vertex, then is 2-connected. A block of a graph is an inclusion-maximal 2-connected induced subgraph. The block-cut tree of is the bipartite graph that contains a vertex for every cut vertex of and a vertex for every block of and the vertex of block is adjacent to the vertex of a cut vertex in if contains .
A graph is a linear forest if its connected components are paths. A graph is a cluster graph if its components are cliques. A graph is a block graph if its blocks are cliques.
A graph is planar if it has a crossing-free embedding in the plane, and together with this embedding it is called a plane graph. For a plane graph we call the regions of the faces of . Every plane graph has exactly one unbounded face which is called the outer face. Note that we will use the face and the closed walk of that forms the border of that face interchangeably. A graph is called outerplanar if it has a crossing-free embedding such that all of the vertices belong to the outer face and such an embedding is also called outerplanar.
Graph Width Parameters.
An (edge) clique cover of a graph is a set of cliques of that cover all vertices (all edges) of the graph. The (edge) clique cover number of is the minimal size of an (edge) clique cover of .
Let be a graph class. The distance to of a graph is the minimal number of vertices that need to be removed from so that the resulting graph belongs to . Similarly, the edge distance to of a graph is the minimal number of edges that need to be removed from so that the resulting graph belongs to . A non-trivial module of a graph is a strict subset such that for all vertices it holds that every neighbor of outside of is also a neighbor of . The distance to module(s) is the minimal number of vertices that need to be removed from so that the resulting graph is in and every component of the resulting graph is a non-trivial module in . Several of the distance parameters have their own name. Vertex cover number is equivalent to distance to edgeless, feedback vertex (edge) set number is equivalent to (edge) distance to tree and twin-cover number [30] is equivalent to distance to cluster modules.
Hamiltonian Paths and Cycles.
A Hamiltonian path (cycle) of a graph is a path (cycle) that contains all the vertices of . A graph is traceable if it has a Hamiltonian path and Hamiltonian if it has a Hamiltonian cycle. Here, we only consider ordered Hamiltonian paths, i.e., one of the two possible orderings of the path is fixed. Given a partial order on a graph’s vertex set, an ordered Hamiltonian path is a -extending Hamiltonian path if its order is a linear extension of . Using this definition we can generalize the classical Hamiltonian Path using precedence constraints.
Problem 1.
Partially Ordered Hamiltonian Path Problem (POHPP)
- Instance:
-
A graph , a partial order on the vertex set of .
- Question:
-
Is there an ordered Hamiltonian path in such that for all it holds that if , then ?
A similar definition can be derived for Hamiltonian Cycle.
Problem 2.
Partially Ordered Hamiltonian Cycle Problem (POHCP)
- Instance:
-
A graph , a partial order on the vertex set of .
- Question:
-
Is there an ordered Hamiltonian path in such that and are adjacent and for all it holds that if , then ?
The problems Hamiltonian Path and Hamiltonian Cycle without precedence constraints are independent from each other, i.e., there exist graph classes where one of the problems is trivial while the other is -hard. It is easy to show that Hamiltonian Path is -complete on the graphs that are not Hamiltonian. In contrast, Hamiltonian Cycle is -complete on traceable graphs [36, Lemma 21.18]. Using the same arguments as in [5] for graph classes, we can show that for POHPP and POHCP the status of being in or is equivalent for many graph width parameters.
To this end, let be the family of all graphs. Let be a graph width parameter. A graph operation is a function . We say that is closed under graph operation if there is a computable function such that for all graphs , it holds that .
Observation 2.1 (see Observation 2.4 [5]).
Let be a graph width parameter that is closed under the addition of a universal vertex. Then there is a polynomial-time -reduction from the POHPP parameterized by to the POHCP parameterized by .
For the converse direction, we are not able to give a (many-one) -reduction. Nevertheless, we can give an -Turing reduction. Furthermore, we do not need to restrict the parameter in any form.
Observation 2.2 (see Observation 2.3 [5]).
Let be a graph width parameter. If we can solve (Min)POHPP in time on a graph , then we can solve (Min)POHCP in time on .
Note that Observation 2.1 does also hold for the classical problems Hamiltonian Path and Hamiltonian Cycle. In contrast, Observation 2.2 does not hold for the classical problems since Hamiltonian Cycle is -complete on traceable graphs [36, Lemma 21.18].
These two observations allow us to restrict our proofs to the path case. Whenever we prove -hardness for POHPP, the respective width parameter is closed under the addition of a universal vertex. Therefore, Observation 2.1 also implies -hardness for the cycle case. If we present some or algorithm for (Min)POHPP, then Observation 2.2 also implies an or algorithm for (Min)POHCP.
3 Sparse Width Parameters
We start with parameters that are unbounded for cliques. As we have shown in [5], both the POHPP and the POHCP are para--hard when parameterized by treewidth. Therefore, we focus on parameters that form upper bounds of treewidth.
3.1 Hardness
We start by showing that even for very restricted distance to parameters, there is no hope for algorithms.
Theorem 3.1.
POHPP and POHCP are -hard when parameterized by either distance to path or distance to linear forest modules.
Proof.
We sketch the reduction for distance to path from the -hard Multicolored Clique Problem (MCP) [25, 44]. In MCP the input is a graph whose vertex set is partitioned into color classes with for all . MCP asks whether there is a clique in containing exactly one vertex per color class. Given an instance of MCP, we construct a graph using the following gadgets (see Figure 2):
- Selection Gadget
-
For every color class , we have a selection gadget consisting of a vertex and a path that contains for every a vertex . These vertices are ordered by their index and after every vertex (and, thus, before ) there is a vertex in that path. The vertex is adjacent to all vertices in the path .
- Verification Gadget
-
For each pair with , we have a verification gadget consisting of a vertex and a path containing for every edge a vertex in arbitrary order. The vertex is adjacent to all vertices in the path .
We order the subpaths described in the selection and verification gadgets as follows:
The last vertex of one of the paths is adjacent to the first vertex of the succeeding path and, thus, they form one large path in . Furthermore, contains vertices and that are adjacent to all vertices in . For every with , contains vertices and that are adjacent to all vertices in and . For all with , the graph contains vertices and that are adjacent to all vertices in and to all vertices in the path preceding in the ordering described above. Finally, contains a vertex that is adjacent to all vertices in and to . As there are vertices in that are not part of the path , the distance to path of is .
We define as the set containing all the vertices defined above that have a hat in their name, i.e., . The partial order is the reflexive and transitive closure of the following constraints:
-
(P1)
for all ,
-
(P2)
for all ,
-
(P3)
for all with and all with
-
(P4)
for all with and all with
Every -extending Hamiltonian path has to visit exactly one vertex in each and on its way from to as all the vertices with hats cannot be visited before . Due to the constrains (P3) and (P4), a vertex of corresponding to an edge can only be visited if both and have already been visited. Therefore, we only can reach if the visited vertices of the selection gadgets form a a multicolored clique of .
Conversely, a multicolored clique implies that we can reach from using such a path. We can visit the remaining vertices by traversing the path and using and outside of to jump over vertices that have already been visited. For details see the full version [6]. For distance to linear forest modules we can adapt the construction by deleting the edges between consecutive gadgets since these edges have not been used in the proof. The resulting graph has distance to linear forest modules .
3.2 Algorithms
We start this section with some easy observations about width values of traceable graphs. A traceable graph with vertex cover number has at most vertices. Therefore, MinPOHPP and MinPOHCP parameterized by vertex cover number allow kernels with a linear number of vertices and, thus, algorithms. It follows from Lemma 6.2 and Equation 6.2 by Nešetřil and de Mendez [41] that a traceable graph of treedepth has less than vertices. As both MinPOHPP and MinPOHCP can be solved in exponential time [7], there are simple double-exponential algorithms for treedepth. For the feedback edge set number we can give a single-exponential algorithm. As was shown in [16], an -vertex graph of feedback edge set number has at most different paths.444Note that the result is only given in the arXiv version of the paper. Enumerating these paths leads to the following result.
Theorem 3.2.
MinPOHPP and MinPOHCP can be solved in time on an -vertex graph of feedback edge set number .
Unless , this result cannot be extended to feedback vertex set number since POHPP and POHCP are -hard for this parameter, due to Theorem 3.1. However, we can give an algorithm for MinPOHPP when parameterized by distance to outerplanar, a more general parameter than feedback vertex set number. Before we present this algorithm, we first focus on a more restricted case that allows an algorithm.
It has been shown by Beisegel et al. [7] that MinPOHPP can be solved in time on outerplanar graphs. The key ingredient of that algorithm is the observation that the vertices of the outer face contained in a prefix of a Hamiltonian path must be an interval of the outer face, i.e., a consecutive part of the closed walk that forms the face (see Lemma 5.2 in [7]). This observation does not only hold for outerplanar graphs but for all plane graphs and all faces. It is important to note that this does not mean that the prefix contains this interval as a subpath. In fact, there can be vertices in between that are not part of the boundary of the face. This general result allows us to extend the polynomial-time algorithm for outerplanar graphs to an algorithm for plane graphs parameterized by the number of vertices that are not on the outer face. Note that our algorithm uses ideas similar to those of [17].
Theorem 3.3.
Given a plane graph with vertices not on the outer face, we can solve MinPOHPP on in time and MinPOHCP on in time.
Proof.
We only sketch the idea of the algorithm as it is a quite straightforward adaption of Algorithm 2 in [7]. For details, we refer to that publication. First note that an induced subgraph does not have more inner vertices for a fixed embedding. Hence, it suffices to deal with 2-connected graphs (Theorem 5.1 in [7]). Let be the outer face of the planar embedding and let be the set of vertices that are not on the outer face. Since is 2-connected, the face forms a cycle. Furthermore, let be the cost function on the edges of .
The idea of Algorithm 2 in [7] is to use a dynamic programming approach. To this end, the authors consider tuples , which represent prefixes of Hamiltonian paths. Here, and are the indices of the endpoints of the interval on associated with that prefix (see Lemma 5.2 in [7]) and is either 1 or 2 depending on whether the prefix ends in or . For the problem considered here, we simply need to adjust these to tuples of the form , where and again represent the indices of the endpoints of the interval on associated with the prefix, is the set of inner vertices in the prefix and forms the endpoint of the prefix. There are at most intervals and at most subsets of . The endpoint either has to be a vertex of or one of the vertices and . Therefore, there are at most endpoints and the total number of tuples is bounded by . Similar as in Algorithm 2 of [7], we compute for every tuple the minimal cost of an ordered path of fulfilling the following properties (or if no such path exists):
-
(i)
consists of the vertices in the interval between and of and in the set ,
-
(ii)
is a prefix of a linear extension of ,
-
(iii)
ends in .
This is done inductively by the size of . Let , , and be the updated values if is removed from the potential prefix. We first have to check whether is minimal in if all the vertices of and have been visited. This costs time. If this is not the case, we set the -value to . Otherwise, we check the -values for all possible vertices that are before in the prefix. Note that can only be an element of or one of the two vertices and , due to Lemma 5.2 in [7]. For each choice of we compute the value and set the -value of to the minimum of these values. Note that this can be done in time using an adjacency matrix.
Summing up, for each of the tuples we need time which leads to the overall running time of . The proof of the correctness of the algorithm follows along the lines of the proof of Theorem 5.3 in [7].
The idea of that algorithm can also be used to give an algorithm for distance to outerplanar. The crucial difference in the complexity is based on the fact that there is not only one interval of the outer face used by a prefix of a Hamiltonian path but at most . To prove this, we need the following definitions.
Let be a closed walk of a plane graph . A subgraph lies inside of if all vertices and edges of are elements of or are placed in a bounded region of . The subgraph lies strictly inside of if it lies inside of and does not contain a vertex of . A subgraph lies outside of if all vertices and edges of are elements of or are placed in the unbounded region of .
Lemma 3.4.
Let be a graph with a set of size such that is planar. Let be a face of a planar embedding of and let be the vertices on the boundary of . Let be a prefix of a Hamiltonian path of . Then there exists a partition of into at most intervals of .
Proof.
We use induction over the number of vertices of . For one vertex the statement is trivial. Assume that the statement holds for all graphs with less than vertices. Let be a graph with vertices and a set of size such that is planar. Let be a face of a planar embedding of . Note that could be a closed walk with repeating vertices, for example, the outer face of a graph that is not 2-connected. To simplify the notation, we assume that does not repeat vertices. By tweaking the definitions, the other case can be proven analogously.
Let be a prefix of a Hamiltonian path of that does not contain all vertices of . Let be the smallest partition of into intervals of , i.e., the intervals are inclusion-maximal. See Figure 3 for an illustration. Let . If we remove the elements of from , we get pairwise disjoint subpaths of and the endpoints of these subpaths have neighbors on that lie on . We ignore the subpath that contains all vertices before the first vertex of on if it exists and the subpath containing all vertices after the last vertex of on if it exists. We also ignore all subpaths where the neighbor of the first and the last vertex lie on the same interval of . Thus, we only consider subpaths that connect two intervals of . As all intervals of have to be connected via such paths, there are at least of these subpaths. If each of these subpaths contains a vertex of , then and we are done. Otherwise, consider a subpath that does not contain vertices of . We define the crest induced by as the subpath of containing and the -neighbors of its endpoints. Let be such a crest. Let be the first vertex and be the last vertex of with regard to the ordering of . By definition, both and lie on . We define as the part of between and in the cyclic ordering and as the part of between and in the cyclic ordering. Further note that and lie in different intervals of . Therefore, there are vertices not in , both in and in . Let be the end vertex of or, in case this end vertex is , let be the successor of in the Hamiltonian path . Note that exists as does not contain all vertices of . W.l.o.g. we may assume that lies outside of . If this is not the case, then we define one face inside of as outer face without changing the faces of the embedding. Then, we can consider as .
Let be a minimal crest inside of , i.e., there is no crest that lies inside of , where and are the endpoints of and is the part of between and that is inside of . Note that contains vertices that are not part of as the crest connects two intervals, say and where and .
We will now show that we can always find either a vertex to delete or an edge to contract in order to apply the induction hypothesis.
Assume that there is an edge such that w.l.o.g. is strictly inside of . We contract the edge in and . The resulting graph and resulting path fulfill the induction hypothesis, i.e., , is a prefix of a Hamiltonian path of and is a face of an embedding of . Therefore, we can partition into at most intervals of . These intervals map bijectively to intervals of . Hence, we can assume that does not contain any vertices strictly inside of .
Suppose there is an interval that is contained completely in . As separates from the vertices outside of and no vertices in are strictly inside of , all -neighbors of vertices of are either in or in . As lies outside of , the interval has at least one -neighbor in . If has exactly one -neighbor – i.e. starts with – then we delete and the whole interval and connect the neighbors of on with an edge. This gives a graph with one less vertex in and one less interval. The suffix of that starts at the successor of is a prefix of a Hamiltonian path in . The statement follows by induction.
Suppose has more than one -neighbor in . We connect these neighbors to form a clique. Furthermore, we sort them by their appearance in and contract the last and the penultimate vertex of these neighbors. As lies outside of , the last neighbor of cannot be used to enter . Therefore, all vertices visited in between these two neighbors lie in . We now delete and connect its neighbors on with an edge. We can transform into by replacing a sequence of -vertices between two -neighbors of by one of the clique edges. The statement follows by induction as there is one vertex less in and one interval less, see Figure 4.
If there is no interval that is contained completely in , then all vertices on are either in , or not in . In this case, we can apply similar arguments to contract the vertices that are not in and, thus, join and to reduce the number of intervals. The details can be found in the full version [6].
Using this lemma, we can adapt the algorithm given in Theorem 3.3 such that it solves the MinPOHPP in time for distance to outerplanar. This adaption is rather straightforward. In the dynamic program, we replace the vertices representing the single interval on by a set of at most intervals. It is not difficult to observe that the number of those sets is bounded by . This leads to the following running time bound.
Theorem 3.5.
Given an -vertex graph with distance to outerplanar , we can solve MinPOHPP and MinPOHCP on in time.
4 Non-Sparse Width Parameters
All parameters considered so far are sparse, i.e. unbounded for cliques. As POHPP and POHCP are trivial on cliques, it makes sense to consider also non-sparse parameters. Both MinPOHPP and MinPOHCP are -hard on cliques as they form generalizations of (Path) TSP. Thus, we only consider the unweighted problems in this section.
4.1 Hardness
As mentioned in the introduction, Hamiltonian Path and Hamiltonian Cycle can be solved in time when parameterized by the independence number, that is the size of the largest independent set [26]. For traceable graphs with at least two vertices, this parameter is a lower bound on the edge clique cover number.555This does not only hold for traceable graphs but for all graphs that do not contain isolated vertices. An edge clique cover of such a graph is also a clique cover of the graph and an independent set can contain at most one vertex of every clique in that clique cover. Thus, both problems can also be solved in time for this parameter. Here, we show that these results cannot be extended to POHPP or POHCP unless .
Theorem 4.1.
POHPP and POHCP are -complete on graphs of edge clique cover number 3.
Proof.
We reduce from a special case of the Alternating Linear Extension Problem that was introduced and shown to be -complete in [7]. In this case of the problem, we are given two non-empty disjoint sets and with and a partial order and we ask for a linear extension of that alternates between elements of and starting in some vertex of .
Let be an instance of this problem with and . We build a graph as follows (see Figure 5 for an illustration). The vertex set of is the disjoint union of , , , , and . The graph contains all edges except for those between and , between and as well as those between and . In other words, the edges of can be covered by the three cliques , , and .
The partial order contains all tuples of . Additionally, it fixes as start vertex and contains the following chain of constraints: .
Assume the instance has an alternating linear extension . W.l.o.g. we may assume that . Inserting before and after leads to a -extending Hamiltonian path and cycle of .
Conversely, assume we have a -extending Hamiltonian path in . We observe that uses one vertex of and one vertex of between and as all vertices with are to the left of and all vertices with are to the right of . Since and have the same size as and , we have to use exactly one vertex of and one of between every and . Thus, contains an alternating linear extension of .
We have to leave open the case of edge clique cover number 2. However, we can observe that the graph constructed in the proof of Theorem 4.1 has clique cover number 2 since the cliques and cover all vertices. This implies the following result.
Corollary 4.2.
POHPP and POHCP are -complete on graphs of clique cover number 2.
Note that for graphs of clique cover number 1 (i.e., cliques), POHPP and POHCP are trivial as every linear extension of induces a Hamiltonian cycle.
It follows from Theorem 3.1 that POHPP and POHCP are -hard when parameterized by distance to block. Here, we extend this result to distance to clique.
Theorem 4.3.
POHPP and POHCP are -hard when parameterized by either distance to clique or distance to cluster modules also known as twin-cover number.
Proof.
As for Theorem 3.1, we use a reduction from Multicolored Clique to POHPP and then use Observation 2.1 to derive -hardness also for POHCP. Let be an instance of MCP with color classes where . The construction works similar as for Theorem 3.1. The main difference is how we encode the selection of a vertex from a color class. While in the proof of Theorem 3.1 the representative of the selected vertex was visited, here we visit all representatives except from the one of the selected vertex.
We construct a graph using the following gadgets:
- Selection Gadget
-
For every color class , we have a clique that contains for every a vertex .
- Verification Gadget
-
For each pair with , we have a clique containing for every edge a vertex .
Next we describe how these gadgets are connected to each other (see Figure 6). The union of the selection gadgets and the verification gadgets forms one large clique. We order the subcliques described in the selection and verification gadgets as follows:
We have the following additional vertices in . First, we have , , and that are adjacent to all vertices in . For every with , we have vertices , and . For , we have only and . Vertex is adjacent to all vertices in and and the vertices and are adjacent to all vertices in . Furthermore, is adjacent to . For all with , there are vertices and that are adjacent to all vertices in and to all vertices in the clique to left of in the ordering described above. Finally, we have vertices and that are adjacent to all vertices in . Furthermore, is adjacent to . Observe that the graph without the selection and verification gadgets contains vertices. Therefore, the distance to clique of is .
The partial order is the reflexive and transitive closure of the following constraints.
-
(P1)
for all ,
-
(P2)
for all ,
-
(P3)
,
-
(P4)
,
-
(P5)
for all with or and ,
-
(P6)
,
-
(P7)
for all with and all ,
-
(P8)
for all with and all with ,
-
(P9)
for all with and all with .
First assume that there is a multicolored clique in . Then we claim that there is -extending Hamiltonian path in . We start our path in and then we visit all the vertices in except for the vertex . Then we visit . We repeat this for all . Next we visit . Now we visit . Note that this is possible since all the vertices that have to be to the left of by (P8) and (P9) are already visited. Next we visit and afterwards which is possible for the same reason as mentioned above. We repeat this procedure until we reach . Next, we visit . The same procedure works until we reach . Next we visit . Now, starting with , we visit for all the vertices , followed by and until we reach . Then, we visit followed by all remaining vertices which is possible as all the left vertices in the constraints (P8) and (P9) have already been visited. We repeat this for all with in the lexicographic order and eventually we have visited all vertices in . Finally, we visit . It is easy to check that this Hamiltonian paths fulfills all constraints of .
Now assume that there is a -extending Hamiltonian path in . Let be arbitrary. By (P4), is to the right of . By (P2), is not the last vertex of and, thus, it has two neighbors in . One of these two neighbors has to be in . Therefore, for each , there is at least one vertex in that is to the right of in .
Using the constraints (P8) and (P9), we can observe that there can be at most one vertex of to the left of for every choice of and with . Otherwise, all vertices of and would be to the left of contradicting our observation above. This also implies that there is exactly one vertex of to the left of since has two neighbors in and one of these neighbors has to be an element of . The constraints (P8) and (P9) imply now that there can be at most one vertex of every to the right of . Combining this with the existence of such a vertex shown above, we see that in every there is exactly one vertex to the right of . Since there is a vertex of every to the left of , it is not difficult to see that the set forms a multicolored clique in .
The arguments above show that the graph is a valid reduction. Since the distance to clique of is it also a proper reduction from MCP to POHPP parameterized by the distance to clique.
Similar as in Theorem 3.1, we can adapt the construction to show that POHPP is also -hard for distance to cluster modules. To this end, we delete all the edges in between different gadgets. This works since these edges have not been used in the proof and since the resulting graph has distance to cluster modules .
4.2 Algorithms
We start with an algorithm for edge distance to block when given a respective edge set.
Theorem 4.4.
POHPP and POHCP can be solved in time on an -vertex graph when given a set with and is a block graph.
Proof.
We consider all possible options for the start vertex of the Hamiltonian path and how the path traverses through the edges of , i.e., we fix the set of edges that are used and also fix in which direction and in which order they are used. There are at most many of these options. Let be the set of vertices incident to edges of . Note that we only continue if every vertex in has at most two incident edges in . Furthermore, the ordering on implies a vertex ordering on .
First, we check whether is valid for . If so, in the rest of the procedure for that option, we try to fill in all the other vertices of . Whenever there are two consecutive vertices and in that are not adjacent via an edge of , we have to use edges of . Since the path between the blocks of these vertices in the block-cut tree of is unique, we know which cut vertices have to be used on that path and we reserve these cut vertices for that path. The algorithm now traverses the ordering and, if necessary, uses paths in . These paths visit all vertices of a block that are possible due to except those that are reserved for later paths. The details can be found in the full version [6].
Note that Dumas et al. [20] present a quadratic kernel for deciding whether the edge distance to block of a graph is at most . This implies an algorithm with running time that decides whether the edge distance to block is at most . Calling this algorithm times, we can also construct the respective set . This implies the following.
Corollary 4.5.
POHPP and POHCP can be solved in time on an -vertex graph with edge distance to block .
Next we give an algorithm for the (vertex) distance to block . We can compute a set of size such that is a block graph in time. For each vertex of , the algorithm fixes its predecessor and successor in a potential Hamiltonian path. This choice can be transferred to an instance of POHPP with edge distance to block with a fixed edge choice . Then, it is sufficient to apply the subroutine of Theorem 4.4.
Theorem 4.6.
If the distance to block of a graph with vertices is , then POHPP and POHCP can be solved in time.
As we have seen in Theorem 4.3, there is no algorithm for distance to cluster modules unless . However, we can give such an algorithm for distance to clique module.
Theorem 4.7.
Given an -vertex graph with distance to clique module , POHPP and POHCP can be solved in time .
Proof.
Let be a set of size such that is a clique module of . Note that such a set can be computed in polynomial time since the largest clique module is equivalent to the largest set of vertices with the same closed neighborhood. We now consider every ordering of the vertices in that fulfills the constraints of . To decide whether is an eligible choice, we have to check whether we can insert the vertices of into in such a way that the result is a -extending Hamiltonian path. Some of the vertices of may be secluded, i.e., they are not adjacent to any vertices in . As secluded vertices have to induce subpaths in , we can contract them and only consider non-secluded vertices of in the following. By adapting the partial order, we prevent that some vertex of is added between the vertices of the edge that results from that contraction.
We try to insert vertices of into the ordering as rightmost as possible, i.e., we try to only insert such a vertex into the gap between and if it is a predecessor of in . However, it might be that and are not adjacent and all predecessors of in are already visited. Then we have to take some other vertex from between and . For all , we define as the minimum index such that is to the left of in the partial order. Among all remaining vertices of that are allowed to be to the left of , we take a vertex with minimal value. The details of the algorithm and the proof of correctness can be found in the full version [6].
5 Conclusion
We have presented a comprehensive classification of the parameterized complexity of finding Hamiltonian paths or cycles with precedence constraints from the perspective of graph width parameters (see Figure 1). We were able to prove that all our algorithms cannot be extended to algorithms (unless ). Nevertheless, our -hardness proofs cannot be used to show – under the assumption of the Exponential Time Hypothesis – that the algorithms’ exponents are asymptotically optimal since these proofs increase the parameter value quadratically. Therefore, one may ask whether there are also -reductions where the parameter increases only linearly.
So far, our work has focused on the existence of parameterized algorithms. As a next step, one could also consider the question whether the results could be extended to kernels of polynomial size. As mentioned, there is a trivial polynomial kernel for vertex cover number. We are rather optimistic that such a kernel can also be given for feedback edge set number.
One could also try to generalize or algorithms to distance parameters for more general graph classes. One option are the series-parallel graphs, a generalization of outerplanar graphs. These graphs are exactly the graphs of treewidth 2. Note that a generalization to distance to treewidth 3 is hopeless as POHPP and POHCP are already para--hard for edge distance to bandwidth 3 [5]. Another option would be to consider graph width parameters not on all graphs but only on some subclass. In particular, the planar case of distance to outerplanar could be interesting as it lies between the general -hard case and the -case where the deleted vertices all lie in the interior of the outer face.
As POHPP and POHCP are already hard for very restricted graphs, one may ask how their complexity behaves if we restrict both the graph and the partial order. It has been shown [7] that POHPP is in and -hard when parameterized by the partial order’s width. Using similar arguments as for Observations 2.1 and 2.2, we can show that the same holds for POHCP. However, it is open what happens if the problems are parameterized by both the partial order’s width and some graph width parameter such as treewidth or distance to clique.
References
- [1] Zakir Hussain Ahmed and S. N. Narahari Pandit. The travelling salesman problem with precedence constraints. Opsearch, 38(3):299–318, 2001. doi:10.1007/BF03398638.
- [2] Norbert Ascheuer, Laureano F. Escudero, Martin Grötschel, and Mechthild Stoer. A cutting plane approach to the sequential ordering problem (with applications to job scheduling in manufacturing). SIAM Journal on Optimization, 3(1):25–42, 1993. doi:10.1137/0803002.
- [3] Katerina Asdre and Stavros D. Nikolopoulos. The 1-fixed-endpoint path cover problem is polynomial on interval graphs. Algorithmica, 58(3):679–710, 2010. doi:10.1007/s00453-009-9292-5.
- [4] Katerina Asdre and Stavros D. Nikolopoulos. A polynomial solution to the -fixed-endpoint path cover problem on proper interval graphs. Theoretical Computer Science, 411(7):967–975, 2010. doi:10.1016/j.tcs.2009.11.003.
- [5] Jesse Beisegel, Katharina Klost, Kristin Knorr, Fabienne Ratajczak, and Robert Scheffler. A graph width perspective on partially ordered Hamiltonian paths and cycles I: Treewidth, pathwidth, and grid graphs, 2025. arXiv:2506.23790.
- [6] Jesse Beisegel, Katharina Klost, Kristin Knorr, Fabienne Ratajczak, and Robert Scheffler. A graph width perspective on partially ordered Hamiltonian paths and cycles II: Vertex and edge deletion numbers, 2025. arXiv:2510.08378.
- [7] Jesse Beisegel, Fabienne Ratajczak, and Robert Scheffler. Computing Hamiltonian paths with partial order restrictions. ACM Transactions on Computation Theory, 17(1), 2025. doi:10.1145/3711844.
- [8] Benjamin Bergougnoux, Mamadou Moustapha Kanté, and O-joung Kwon. An optimal XP algorithm for Hamiltonian cycle on graphs of bounded clique-width. Algorithmica, 82(6):1654–1674, 2020. doi:10.1007/S00453-019-00663-9.
- [9] Lucio Bianco, Aristide Mingozzi, Salvatore Ricciardelli, and Massimo Spadoni. Exact and heuristic procedures for the traveling salesman problem with precedence constraints, based on dynamic programming. INFOR: Information Systems and Operational Research, 32(1):19–32, 1994. doi:10.1080/03155986.1994.11732235.
- [10] Hans L. Bodlaender, Marek Cygan, Stefan Kratsch, and Jesper Nederlof. Deterministic single exponential time algorithms for connectivity problems parameterized by treewidth. Information and Computation, 243:86–111, 2015. doi:10.1016/J.IC.2014.12.008.
- [11] Charles J. Colbourn and William R. Pulleyblank. Minimizing setups in ordered sets of fixed width. Order, 1:225–229, 1985. doi:10.1007/BF00383598.
- [12] Bruno Courcelle. The monadic second-order logic of graphs. I. Recognizable sets of finite graphs. Information and Computation, 85(1):12–75, 1990. doi:10.1016/0890-5401(90)90043-H.
- [13] Bruno Courcelle. The monadic second-order logic of graphs III: Tree-decompositions, minors and complexity issues. Informatique Théorique et Applications/Theoretical Informatics and Applications, 26(3):257–286, 1992. doi:10.1051/ITA/1992260302571.
- [14] Marek Cygan, Stefan Kratsch, and Jesper Nederlof. Fast Hamiltonicity checking via bases of perfect matchings. Journal of the ACM, 65(3):12:1–12:46, 2018. doi:10.1145/3148227.
- [15] Marek Cygan, Jesper Nederlof, Marcin Pilipczuk, Michał Pilipczuk, Johan M. M. van Rooij, and Jakub Onufry Wojtaszczyk. Solving connectivity problems parameterized by treewidth in single exponential time. ACM Transactions on Algorithms, 18(2):17:1–17:31, 2022. doi:10.1145/3506707.
- [16] Erik D. Demaine, David Eppstein, Adam Hesterberg, Kshitij Jain, Anna Lubiw, Ryuhei Uehara, and Yushi Uno. Reconfiguring undirected paths. In Zachary Friggstad, Jörg-Rüdiger Sack, and Mohammad R. Salavatipour, editors, Algorithms and Data Structures – 16th International Symposium, WADS 2019, volume 11646 of LNCS, pages 353–365. Springer, 2019. arXiv:1905.00518, doi:10.1007/978-3-030-24766-9_26.
- [17] Vladimir G. Deĭneko, Michael Hoffmann, Yoshio Okamoto, and Gerhard J. Woeginger. The traveling salesman problem with few inner points. Operations Research Letters, 34(1):106–110, 2006. doi:10.1016/j.orl.2005.01.002.
- [18] Reinhard Diestel. Graph Theory, volume 173 of GTM. Springer, fourth edition, 2012. doi:10.1007/978-3-662-70107-2.
- [19] Martin Doucha and Jan Kratochvíl. Cluster vertex deletion: A parameterization between vertex cover and clique-width. In Branislav Rovan, Vladimiro Sassone, and Peter Widmayer, editors, Mathematical Foundations of Computer Science 2012 – 37th International Symposium, MFCS 2012, volume 7464 of LNCS, pages 348–359. Springer, 2012. doi:10.1007/978-3-642-32589-2_32.
- [20] Maël Dumas, Anthony Perez, Mathis Rocton, and Ioan Todinca. Polynomial kernels for edge modification problems towards block and strictly chordal graphs. Discrete Mathematics & Theoretical Computer Science, 27(2), 2025. doi:10.46298/DMTCS.12998.
- [21] Heinz-Dieter Ebbinghaus and Jörg Flum. Finite Model Theory. Perspectives in Mathematical Logic. Springer, 1995. doi:10.1007/978-3-662-03182-7.
- [22] Laureano F. Escudero. An inexact algorithm for the sequential ordering problem. European Journal of Operational Research, 37(2):236–249, 1988. doi:10.1016/0377-2217(88)90333-5.
- [23] Laureano F. Escudero. On improving a solution to the ATSP with fixed origin and precedence relationships. Trabajos de Investigacion Operativa, 3:117–140, 1988. doi:10.1007/BF02888669.
- [24] Wolfgang Espelage, Frank Gurski, and Egon Wanke. How to solve NP-hard graph problems on clique-width bounded graphs in polynomial time. In Andreas Brandstädt and Van Bang Le, editors, Graph-Theoretic Concepts in Computer Science, 27th International Workshop, WG 2001, volume 2204 of LNCS, pages 117–128. Springer, 2001. doi:10.1007/3-540-45477-2_12.
- [25] Michael R. Fellows, Danny Hermelin, Frances Rosamond, and Stéphane Vialette. On the parameterized complexity of multiple-interval graph problems. Theoretical Computer Science, 410(1):53–61, 2009. doi:10.1016/j.tcs.2008.09.065.
- [26] Fedor V. Fomin, Petr A. Golovach, Nikola Jedličková, Jan Kratochvíl, Danil Sagunov, and Kirill Simonov. Path cover, Hamiltonicity, and independence number: An FPT perspective, 2025. arXiv:2403.05943.
- [27] Fedor V. Fomin, Petr A. Golovach, Daniel Lokshtanov, and Saket Saurabh. Intractability of clique-width parameterizations. SIAM Journal on Computing, 39(5):1941–1956, 2010. doi:10.1137/080742270.
- [28] Fedor V. Fomin, Petr A. Golovach, Daniel Lokshtanov, Saket Saurabh, and Meirav Zehavi. Clique-width III: Hamiltonian cycle and the odd case of graph coloring. ACM Transactions on Algorithms, 15(1), 2018. doi:10.1145/3280824.
- [29] Jakub Gajarský, Michael Lampis, and Sebastian Ordyniak. Parameterized algorithms for modular-width. In Gregory Z. Gutin and Stefan Szeider, editors, Parameterized and Exact Computation – 8th International Symposium, IPEC 2013, volume 8246 of LNCS, pages 163–176. Springer, 2013. doi:10.1007/978-3-319-03898-8_15.
- [30] Robert Ganian. Improving vertex cover as a graph parameter. Discrete Mathematics & Theoretical Computer Science, 17(2):77–100, 2015. doi:10.46298/dmtcs.2136.
- [31] Paul C. Gilmore, Eugene L. Lawler, and David B. Shmoys. Well-solved special cases. In Eugene L. Lawler, Jan Karel Lenstra, Alexander H. G. Rinnooy Kan, and David B. Shmoys, editors, The traveling salesman problem. A guided tour of combinatorial optimization, pages 87–143. Wiley, Chichester, 1985.
- [32] Petr A. Golovach, R. Krithika, Abhishek Sahu, Saket Saurabh, and Meirav Zehavi. Graph Hamiltonicity parameterized by proper interval deletion set. In Yoshiharu Kohayakawa and Flávio Keidi Miyazawa, editors, LATIN 2020: Theoretical Informatics – 14th Latin American Symposium, volume 12118 of LNCS, pages 104–115. Springer, 2020. doi:10.1007/978-3-030-61792-9_9.
- [33] Alon Itai, Christos H. Papadimitriou, and Jayme Luiz Szwarcfiter. Hamilton paths in grid graphs. SIAM Journal on Computing, 11(4):676–686, 1982. doi:10.1137/0211056.
- [34] Bart M. P. Jansen. The Power of Data Reduction. Kernels for Fundamental Graph Problems. PhD thesis, Utrecht University, 2013. URL: https://hdl.handle.net/1874/276438.
- [35] Bart M. P. Jansen, László Kozma, and Jesper Nederlof. Hamiltonicity below Dirac’s condition. In Ignasi Sau and Dimitrios M. Thilikos, editors, Graph-Theoretic Concepts in Computer Science – 45th International Workshop, WG 2019, volume 11789 of LNCS, pages 27–39. Springer, 2019. doi:10.1007/978-3-030-30786-8_3.
- [36] Bernhard Korte and Jens Vygen. Combinatorial Optimization: Theory and Algorithms. Springer, 6th edition, 2018. doi:10.1007/978-3-662-56039-6.
- [37] Michael Lampis. Algorithmic meta-theorems for restrictions of treewidth. Algorithmica, 64(1):19–37, 2012. doi:10.1007/S00453-011-9554-X.
- [38] Peng Li and Yaokun Wu. A linear time algorithm for the 1-fixed-endpoint path cover problem on interval graphs. SIAM Journal on Discrete Mathematics, 31(1):210–239, 2017. doi:10.1137/140981265.
- [39] George B. Mertzios and Walter Unger. An optimal algorithm for the -fixed-endpoint path cover on proper interval graphs. Mathematics in Computer Science, 3(1):85–96, 2010. doi:10.1007/s11786-009-0004-y.
- [40] Burkhard Monien and Ivan Hal Sudborough. Bounding the bandwidth of NP-complete problems. In Hartmut Noltemeier, editor, Graphtheoretic Concepts in Computer Science – International Workshop, WG 80, volume 100 of LNCS, pages 279–292. Springer, 1980. doi:10.1007/3-540-10291-4_20.
- [41] Jaroslav Nešetřil and Patrice Ossona de Mendez. Sparsity. Graphs, Structures, and Algorithms, volume 28 of Algorithms and Combinatorics. Springer, 2012. doi:10.1007/978-3-642-27875-4.
- [42] Sophie N. Parragh, Karl F. Doerner, and Richard F. Hartl. A survey on pickup and delivery problems. Part I: Transportation between customers and depot. Journal für Betriebswirtschaft, 58(1):21–51, 2008. doi:10.1007/s11301-008-0033-7.
- [43] Sophie N. Parragh, Karl F. Doerner, and Richard F. Hartl. A survey on pickup and delivery problems. Part II: Transportation between pickup and delivery locations. Journal für Betriebswirtschaft, 58(2):81–117, 2008. doi:10.1007/s11301-008-0036-4.
- [44] Krzysztof Pietrzak. On the parameterized complexity of the fixed alphabet shortest common supersequence and longest common subsequence problems. Journal of Computer and System Sciences, 67(4):757–771, 2003. doi:10.1016/S0022-0000(03)00078-3.
- [45] Harilaos N. Psaraftis. A dynamic programming solution to the single vehicle many-to-many immediate request dial-a-ride problem. Transportation Science, 14(2):130–154, 1980. doi:10.1287/trsc.14.2.130.
- [46] Sigve Hortemo Sæther and Jan Arne Telle. Between treewidth and clique-width. Algorithmica, 75(1):218–253, 2016. doi:10.1007/S00453-015-0033-7.
- [47] Sigve Hortemo Sæther. Solving Hamiltonian Cycle by an EPT algorithm for a non-sparse parameter. Discrete Applied Mathematics, 228:88–97, 2017. doi:10.1016/j.dam.2016.02.008.
- [48] Egon Wanke. -NLC graphs and polynomial algorithms. Discrete Applied Mathematics, 54(2):251–266, 1994. doi:10.1016/0166-218X(94)90026-4.
