Manuscript Offprint
arXiv:2610.22010Parameterized Complexity of Isometric Path Cover: Treewidth and Diameter
Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.
Abstract
We study the fixed-parameter tractability of the ISOMETRIC PATH COVER problem where, given an integer k and a simple, undirected, and unweighted graph G, the objective is to decide whether G admits a set of k isometric paths (i.e., shortest paths between their endpoints) whose union is the entire vertex set of G.
We show that ISOMETRIC PATH COVER is NP-hard on graphs of pathwidth (and thus treewidth) at most 287. This is an interesting contrast with the closely related problems ISOMETRIC PATH PARTITION and PATH COVER, which are both known to be XP for treewidth, see [Chakraborty et al., WG 2026] and [Foucaud et al., TCS 2026].
On the positive side, we show, by a suitable dynamic programming scheme, that ISOMETRIC PATH COVER admits an XP algorithm w.r.t. the parameter combination of treewidth and diameter, running in time where diam, tw, and n denote the diameter, the treewidth, and the number of vertices of the input graph, respectively.
However, we also prove that ISOMETRIC PATH COVER becomes W[1]-hard for pathwidth on graphs of diameter 7, showing that an XP algorithm is the best one can hope for w.r.t. this parameterization, under standard complexity theory assumptions.
Keywords: ISOMETRIC PATH COVER, parameterized complexity, parameterized reductions, treewidth, diameter.
Contents
1 Introduction 3
1.1 Our results 3
1.2 Related works. 5
1.3 Organisation of this paper 6
2 Preliminaries 6
3 ISOMETRIC PATH COVER Hardness with Respect to Pathwidth 7
3.1 The source problem: constrained perfect matching 7
3.2 Construction of the graph 7
3.3 Pathwidth and size of the construction 10
3.4 Constructing a cover from a constrained perfect matching 11
3.5 Recovering a constrained perfect matching from a cover 12
4 Algorithm Parameterized by Treewidth plus Diameter 15
4.1 Objects of the dynamic programming 15
4.2 Computation of the values 18
4.2.1 Leaf Node 18
4.2.2 Introduce Vertex Node 19
4.2.3 Forget Vertex Node 23
4.2.4 Join Node 25
4.3 Correctness and complexity of the algorithm 29
5 ISOMETRIC PATH COVER W[1]-Hardness with Respect to Pathwidth on Graphs of Diameter 7 31
5.1 Overview of the reduction 31
5.2 The anti-split gadget 31
5.3 Construction of the graph 32
5.4 Forward direction 36
5.5 Backward direction 36
6 Conclusion 39
Covering graphs with paths with special properties is central to (algorithmic) graph theory. For example, decades of research have been devoted to the algorithmic and structural study of Hamiltonian graphs, i.e., whose vertex set can be covered with only one path. HAMILTONIAN PATH, i.e., the algorithmic task of deciding whether a graph is Hamiltonian, is a classic NP-complete problem [GJ02], and the study of its fixed-parameter tractability gave rise to the famous cut-and-count technique [CNP 22], leading to single-exponential FPT algorithms for many algorithmic problems parameterized by treewidth. A natural generalization of HAMILTONIAN PATH is PATH COVER where, given a graph G and an integer k, the objective is to decide whether there exists a collection of k paths that covers the vertex set of G. PATH COVER derives motivation from the Gallai-Millgram Theorem [GM60]. The parameterized complexity of PATH COVER has recently been studied [FGJ 26, FMMRT26]. While PATH COVER admits an FPT algorithm w.r.t. the combined parameters treewidth and solution size (via Courcelle's Theorem [Cou90]), it is a challenging open problem whether it is FPT for treewidth alone [FMMRT26].
A path is isometric if it is a shortest path between its endpoints. We consider a variant of PATH COVER known as ISOMETRIC PATH COVER, defined as follows.
ISOMETRIC PATH COVER
Input: A graph G and an integer k.
Output: Is there a collection of at most k isometric paths in G, such that each vertex of G belongs to at least one of the paths?
ISOMETRIC PATH COVER was introduced in the context of the Cops and Robber game on graphs [FF01] and cop-decompositions [AGG 19], that are tree-decomposition where the vertices of any bag can be covered by a bounded number of isometric paths in a suitably chosen subgraph. ISOMETRIC PATH COVER serves a natural simplified model for network design problems of covering transportation networks by traffic routes. ISOMETRIC PATH COVER has also been applied to machine learning on graphs [TG21]. Recently, the study of the approximability of ISOMETRIC PATH COVER led to the discovery of the graph parameter isometric path complexity [CCFV26, CF25], which connects graph hyperbolicity to aspects of coarse graph theory, an area that recently garnered considerable attention [GP25, NSS25, Hic25]. Moreover, graphs that can be covered with a bounded number of isometric paths have been shown to have bounded treewidth [BDG 26, DFPT24]; other results related to ISOMETRIC PATH COVER are surveyed in Section 1.2.
1.1 Our results
Despite growing interest for ISOMETRIC PATH COVER, a thorough study on its parameterized complexity is missing from the literature. The problem has been shown to be FPT w.r.t. parameters vertex cover and neighborhood diversity [FFM 25]. Our first result shows that these results cannot be extended to pathwidth or treewidth, unless P=NP (even with an XP algorithm). This negatively answers open questions from [CDD 22, DFPT24].
Theorem 1.1. ISOMETRIC PATH COVER is NP-complete for graphs of pathwidth (and thus treewidth) at most 287.
The reduction is from an NP-complete variant of perfect matching in cubic graphs which we call CONSTRAINED PERFECT MATCHING: the edges of the input graph are grouped into groups of size 3, and the matching must choose exactly one edge from each group. Each vertex is incident with one selected edge and two unselected edges. Informally, our construction represents these three choices by one primary slot and two dummy slots on the element side, and one slot for each incidence on the incidence side. Potential solution paths pair the incidence slots with the corresponding primary or dummy slots of the same element. Blocking vertices force the unselected sets to use dummy paths. The two sides communicate through a constant number of gates; retaining these gates in the decomposition gives bounded pathwidth.
Theorem 1.1 adds ISOMETRIC PATH COVER to the growing list of distance-based graph optimization problems which are NP-complete on graphs of constant pathwidth. Typically, in a distance-based graph optimization problem, the objective is to choose a solution sub-structure of the input graph satisfying some metric constraints while optimising the solution size. Some of these problems e.g., (STRONG) METRIC DIMENSION [LP22, Tal26] and GEODETIC SET [Tal25], are known to be NP-complete on graphs of constant pathwidth, while others are W[1]-hard for pathwidth but XP for treewidth, like ISOMETRIC PATH PARTITION [CDF 26], DISTANCE-d-DOMINATING SET [KLP19], DISTANCE-d-INDEPENDENT SET [KLP22]. To complement such hardness results, researchers have provided FPT algorithms for distance-based optimization problems w.r.t. cyclomatic number, vertex cover number, treedepth, the combination of treewidth and diameter etc. [CDF 26, Epp15, FGK 24, FGK 27, KK22, KLP19, KLP22, KS23]. The treewidth and diameter parameterization is particularly suitable for such problems, as it constrains both the structure and the distances in the graph. We prove the following.
Theorem 1.2. ISOMETRIC PATH COVER admits an algorithm running in time where diam, tw, and n denote the diameter, the treewidth, and the number of vertices of the input graph, respectively.
We prove Theorem 1.2 by providing a dynamic programming algorithm. In this algorithm, the states describe the “traces” of paths on the bags of the decomposition, which consist of how paths meet a bag, which connections should be realized outside the bag, and some additional distance information of their endpoints. Together with these traces, we store multiplicities indicating how many paths from the solution yield a given trace. Let us point that, although this approach appears to follow standard techniques, it requires special effort to achieve the claimed time bound. Most notably, instead of storing the exact endpoints of the traces, we must limit ourselves to the distance profiles of these endpoints, which are vectors indicating their distances to the vertices of a given bag of the decomposition. Handling these require particular attention for the compatibility of states, introducing some complexity in proving the correctness of our algorithm.
In the light of the above result, a natural question is whether the dependence on treewidth and diameter can be confined to a multiplicative factor of the input size, that is, whether ISOMETRIC PATH COVER admits an FPT algorithm for this combination of parameters. Under standard complexity theoretic assumptions, we rule out such a possibility by showing that ISOMETRIC PATH COVER is W[1]-hard when parameterized by the parameter combination of pathwidth and diameter.
Theorem 1.3. ISOMETRIC PATH COVER is W[1]-hard when parameterized by pathwidth even when the input graph has diameter 7.
The reduction is from a variant of UNARY BIN PACKING, where, given a positive integer k, item sizes and a bin capacity b where the total item size is kb, all encoded in unary, the objective is to decide whether the items fit into at most k bins of capacity b.
In our reduction, the constructed graph has (among others) vertices that correspond to the items, and vertices that correspond to the bins. Each vertex has leaves attached to it that encode the size of the corresponding item, and each vertex has leaves that encode the capacity of the corresponding bin. Then, each pair is connected by a structure called an anti-split gadget that essentially consists of parallel paths plus some other edges and vertices. If the -th item is placed into the -th bin, then we create paths from the leaves of to distinct leaves of that traverse that gadget. A potential problem here is that, in order to cover the graph, one could be tempted to “split” the items by having some paths starting from the same item but finishing in different bins. Our anti-split gadget prevents such a split by inducing a “penalty” for each gadget that is only partially traversed.
1.2 Related works.
ISOMETRIC PATH COVER is known to be NP-complete on chordal graphs [CDD22] and bipartite graphs with bounded degeneracy and diameter [FFM25]. On the other hand, ISOMETRIC PATH COVER admits polynomial time algorithms on restricted graph classes like chain graphs, cographs [CMO26], trees [FMMRT26], block graphs [PC05]. ISOMETRIC PATH COVER has also been studied from a structural point of view: the optimal solution sizes have been determined for square grids [FF01], hypercubes [FNHC01], complete -partite graphs [PC06] and Cartesian products of complete graphs [PC06]. It was proved that if the vertex set of a graph can be covered with isometric paths, then its pathwidth is in [DFPT24]; if also the edge set of the graph can be covered, then its pathwidth is in [BDG26]. The former result was used in [DFPT24] to obtain an XP algorithm for the problem when parameterized by solution size. Approximation algorithms for ISOMETRIC PATH COVER were proposed, such as an -factor algorithm for general graphs [TG21] and constant factor approximation algorithms for interval graphs, chordal graphs, and more generally on graphs with bounded hyperbolicity [CCFV26, CF25, CDD22].
Contrast with ISOMETRIC PATH PARTITION. Chakraborty et al. [CDF26] recently studied the ISOMETRIC PATH PARTITION problem through the lens of parameterized complexity. This problem has a similar definition as ISOMETRIC PATH COVER, but the paths are required to be pairwise vertex-disjoint. It was proved in [CDF26] that ISOMETRIC PATH PARTITION is W[1]-hard w.r.t. pathwidth but admits an XP algorithm w.r.t. treewidth. Moreover, ISOMETRIC PATH PARTITION is fixed-parameter tractable w.r.t. the combined parameter of treewidth and diameter. The results in this paper along with the ones in [CDF26] establish that ISOMETRIC PATH COVER is significantly harder than ISOMETRIC PATH PARTITION from the perspective of parameterized complexity. These differences are summarized in Table 1. These are reminiscent with the (supposed) difference between PATH COVER and PATH PARTITION when parameterized by treewidth: for the former, only an XP algorithm is known, while the latter is FPT [FMMRT26].
| parameter | ISOMETRIC PATH PARTITION [CDF26] | ISOMETRIC PATH COVER (this paper) |
|---|---|---|
| treewidth | XP for treewidthW[1]-hard for pathwidth | NP-hard for pathwidth 287 |
| treewidth and diameter | FPT | XPW[1]-hard for pathwidth on diameter 7 graphs |
Table 1: Summary of our results on ISOMETRIC PATH COVER and comparison with known results for ISOMETRIC PATH PARTITION.
1.3 Organisation of this paper
In Section 2, we introduce some definitions used throughout the paper. In Sections 3, 4, and 5 we prove Theorems 1.1, 1.2, and 1.3, respectively. We conclude in Section 6.
2 Preliminaries
A graph has vertex set and edge set . We denote edge with endpoints as . The length of a path is the number of edges in . An isometric path is a shortest path between its endpoints. An IP-cover of a graph is a collection of isometric paths that covers all the vertices in . The size of an IP-cover of a graph is the cardinality of . In the rest of the paper, we may denote an isometric path by the natural ordering of its vertices obtained by traversing from one endpoint to the other.
For a graph and a set , the graph (resp. ) is the graph obtained by adding (resp. removing) the edges in to (resp. from) . For an induced subgraph of a graph , and a set , (resp. ) is the subgraph of obtained by adding (resp. removing) the vertices in to (resp. from) . When performing these operations, we ignore multiplicity, i.e., we keep a simple graph. For a graph and a set , the graph is the subgraph of induced by the vertices in . For convenience, we extend these notations to paths that we see as graphs, i.e., for some path and denotes the (possibly disconnected) graph consisting of subpaths of that are induced by .
The notation of identifying two vertices u and v in a graph G is defined as follows: The operation construct a simple graph H by deleting vertices u and v from G, adding a new vertex w and making it adjacent with every vertex in G that were adjacent with u or v.
For a positive integer q, we denote the set by .
For sake of completeness we recall the well-known definitions of tree-decompositions, treewidth and nice tree-decompositions below.
Definition 2.1 ([CFK 15]). A tree-decomposition of a graph G is a rooted tree T where each node v is associated to a subset of called bag, such that
- The set of nodes of T containing a given vertex of G forms a nonempty connected subtree of T; and
• Any two adjacent vertices of G appear in a common node of T.
The width of T is the maximum cardinality of a bag minus one. The treewidth of G is the minimum integer k such that G has a tree-decomposition of width k.
Definition 2.2 ([CFK 15]). A nice tree-decomposition of a graph G is a rooted tree-decomposition such that each internal node has one or two children, with the following properties.
• Each node of T belongs to one of the following types: introduce, forget, join or leaf.
• A join node v has two children and such that .
• An introduce node v has one child such that , where .
• A forget node v has one child such that , where .
• A leaf node v is a leaf of T with .
• The tree T is rooted at a node r called root node with .
For a node t in a nice tree-decomposition T of a graph G, we let denote the subgraph of G induced by the vertices in the union of bags of the nodes that belong to the subtree of T rooted at t.
3 ISOMETRIC PATH COVER Hardness with Respect to Pathwidth
In this section, we prove that ISOMETRIC PATH COVER remains NP-hard on graphs of pathwidth at most 287 (Theorem 1.1). We first define the source problem and show its hardness, then we construct the graph of the reduction, and finally we analyze the reduction.
3.1 The source problem: constrained perfect matching
Definition 3.1 (Constrained Perfect Matching). An instance consists of a finite universe U, a family S of distinct two-element subsets of U, and a partition S of S into groups. We impose the following restrictions:
(i) every element belongs to exactly three sets of S;
(ii) every group contains exactly three sets;
(iii) the three sets in a group are pairwise disjoint.
The question is whether there is a subfamily such that for every and is a partition of .
CONSTRAINED PERFECT MATCHING can be reformulated as a constrained form of perfect matching in a cubic graph, since the sets in § can be seen as edges, and where each group consists of three disjoint edges. Nevertheless, we prefer to use the above set formulation in order to avoid confusion with the constructed graph instance for ISOMETRIC PATH COVER.
Throughout the graph construction, members of U are called elements, members of S are called sets, and members of G are called groups. Vertices and edges refer to objects in the constructed graph, except for the auxiliary source graph used in the following proof.
Lemma 3.2. CONSTRAINED PERFECT MATCHING is NP-complete.
Proof. Membership in NP is immediate. For hardness, reduce from proper three-edge-colorability of simple cubic graphs, which is NP-complete by Holyer [Hol81].
Given a simple cubic graph , put . For every and , introduce
Let and . Simplicity of ensures that all sets are distinct. Each belongs to precisely the three sets corresponding to edges incident with . Each group consists of three pairwise disjoint two-element sets.
If is a proper edge-coloring, select for each . Exactly one edge of each color is incident with each vertex of , so every element is covered exactly once. Conversely, a feasible subfamily selects a unique for every ; give color . Exact coverage of says that precisely one edge incident with has color , so the coloring is proper. The construction has polynomial size and is computable in polynomial time.
Fix a nonempty instance and let . Counting incidences gives and ; in particular, is even. The empty instance is handled separately.
3.2 Construction of the graph
The graph has an element side, consisting of primary and dummy vertices with leaves and a spine, and an incidence side, consisting of one set gadget for each set, combined into group gadgets. For each color of elements, two interchanges connect these sides by element arms and incidence arms. Figure 1 illustrates the whole construction.
Lemma 3.3 (Coloring the elements). In polynomial time, the elements can be colored with at most 16 colors so that the six elements occurring in any one group have distinct colors.
Proof. Form the conflict graph on in which two distinct elements are adjacent if they occur in the union of some group. An element belongs to three sets and, because sets in a group are disjoint, to three different groups. In each group it has at most five other elements as neighbors. Therefore the conflict graph has maximum degree at most 15. A greedy coloring uses at most 16 colors. Both the graph and its coloring can be computed in polynomial time.
For each element , let be its color. We use only nonempty color classes and write for the number of elements of color .
Independently, choose an arbitrary bijection . Set
We use a row index and an interchange sign . A bar reverses a row or a sign. Write and .
Interchanges. For each color , construct two disjoint, identically structured interchanges and . Interchange has six gates:
These are, respectively, its group gates, primary element gates, and dummy element gates. Join the two group gates by an edge, and make the four element gates a clique. There are no edges directly joining a group gate to an element gate.
The interchange also contains three mutually disjoint sets of internal vertices. Their union is independent, and their neighborhoods are:
| Internal set | Size | Neighborhood of each vertex |
|---|---|---|
Thus there are internal vertices per interchange.
Element vertices and element leaves. For every , introduce four vertices
Attach two private leaves to each primary vertex , and four private leaves to each dummy vertex . These twelve leaves are the element leaves of . The element vertices carry a row index but no sign index: each is connected to both signed interchanges of its color.
Element arms. For each and each , add one primary element arm from to and two dummy element arms from to . The two dummy arms have the same endpoints but disjoint internal vertices; they are distinct paths, not parallel edges. Every one of these arms has
An arm incident with on the element side has sign . There are four primary and eight dummy element arms for , with six top arms and six bottom arms.
The spine. Write for the elements in increasing index order. List the element vertices as
Join each consecutive pair by a path of edge length , with new internal vertices. All these interiors are mutually disjoint and disjoint from the arms and gadgets. Their union is the spine, of length . Attach a new leaf to its first vertex and a new leaf to its last vertex. These are the two auxiliary leaves. Let be the path from to along the spine, of length . The element leaves and the auxiliary leaves are collectively called spine-side leaves; the spine together with all these leaves is the spine component when arm interiors are deleted. Spine segments are not called arms.
Set gadgets. Choose an ordering of the two elements of every set . The set gadget contains eight vertex-disjoint paths
each of edge length two. The vertices , , and are its first, middle, and last vertices. The row labels are fixed by the following table:
| j | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
|---|---|---|---|---|---|---|---|---|
| element u(S,j) | u | u | u | u | v | v | v | v |
| row α(j) | t | b | t | b | t | b | t | b |
| interchange β(j) | + | + | - | - | + | + | - | - |
Thus odd-numbered paths are top paths and even-numbered paths are bottom paths. Introduce gathering vertices and attach four private leaves to each. Join to whenever . The eight new leaves are the group leaves belonging to .
Group gadgets. For , form the group gadget from and the following vertices and edges. Introduce sixteen blocking vertices
Let for and ; likewise let denote the cyclic predecessor. For every and every , add
Finally, for every ordered pair of distinct sets , add all edges
Thus has 94 nonleaf vertices and 24 group leaves.
Incidence arms. For each and row , put , , , and . Connect to by an incidence arm with
Its sign is , the opposite of its interchange sign. Each occurrence has four incidence arms, one for each . Since belongs to three sets, it has twelve incidence arms in total.
All arms have mutually disjoint internal vertices, and these vertices have no other neighbors. No edges are added beyond those specified above.
For reference, the sign convention is summarized by
| Arm | Interchange | Number of internal vertices |
|---|---|---|
| positive element arm | ||
| negative element arm | ||
| positive incidence arm | ||
| negative incidence arm |
In particular, the two arms of a route through , from an occurrence of to an element vertex of , contribute
This is when .
This completes the simple unweighted graph . The output instance is with .

Figure 1: The group gadget for , its connections to the interchanges, and the element side with the spine . Only the interchanges for are detailed; the other incidence arms are labeled by their destinations. Blue dashed arms are negative and orange dotted arms are positive. The yellow part represents the biclique between the first vertices of the first set, and the last vertices of the two other sets. The two other bicliques are not shown. The highlighted green and red paths respectively illustrate a primary and a dummy path emerging from . Blue numbers give distances from the group leaf marked 0. The brown spine joins to through the element vertices.
3.3 Pathwidth and size of the construction
Lemma 3.4 (Pathwidth and construction time). The graph has pathwidth at most 287 and can be constructed in polynomial time. It has vertices and edges.
Proof. Keep all gates in every bag; there are at most . Process internal interchange vertices individually. Then scan the spine in order, retaining each element vertex while processing its leaves and scanning its arms with two consecutive arm vertices. These steps need at most three vertices in addition to the gates.
Finally, process each group gadget separately. Retain its 94 nonleaf vertices, introduce its leaves one at a time, and scan each incidence arm using two consecutive arm vertices. The largest bag has at most vertices. Every edge is covered and each vertex occurs in an interval of bags, proving the pathwidth bound.
There are 24n arms, each of length . The group gadgets, interchange vertices, and element vertices contribute vertices and edges, and the spine contributes . The construction therefore has vertices and edges. All steps, including the coloring, take polynomial time.
3.4 Constructing a cover from a constrained perfect matching
Primary and dummy paths. For an occurrence , choose a row for and put , , and . An -primary path starts at a leaf of , follows
then follows to , a vertex of to , and the primary element arm to , where . It ends at an element leaf of . The forward construction uses . An example is shown in green in Figure 1.
An -dummy path starts at a leaf of , follows
where contains , then follows to , a vertex of to , and a dummy element arm to . It ends at an element leaf there. The label refers to the exit row : at the transitions and , the preceding first vertex belongs to the other element of . The detour nevertheless stays in the same set gadget. An example is shown in red in Figure 1.
Remark 3.5. Primary paths avoid the blocking vertices; each dummy path covers exactly one. This distinction enforces the choice of one set per group.
Lemma 3.6 (Distances from a group leaf). Let and let be a leaf of . Then
Proof. Cross edges reach a last vertex of another set in three steps; a direct row reaches a last vertex of with matching parity in four; and the blocking detour reaches the opposite parity in five. These routes are shortest in : the vertices reached in three steps are middle vertices of the starting parity, blockers, and last vertices of other sets, none adjacent to an opposite-parity last vertex of . A path leaving and returning uses at least two arms, of total length at least , so it cannot improve these distances.
Lemma 3.7 (The prescribed paths are isometric). Every primary path has length , and every dummy path has length . These paths and are isometric in G.
Proof. The two arms have total length . A primary path additionally uses four edges from its group leaf to the last vertex, two inside the interchange, and one final leaf edge. A dummy path uses five, two, and one such edges, respectively.
A competing shortest path uses an even number of arms, and at least two. Four arms already cost at least , so it uses exactly two. If it reaches the spine at an element vertex different from the target leaf's neighbor, it traverses at least one spine segment of length B. Its arms have total length at least by (5). Its group prefix has length at least three, its interchange segment at least two, and its final leaf edge has length one. Consequently its length is at least
which is too long. Thus a shortest competitor uses no spine edge and its element arm is incident with the prescribed target element vertex.
The interchange has color . Since is the unique element of that color in the source group, its incidence arm belongs to . For a primary endpoint, the minimum group-prefix and interchange lengths are four and two. For a dummy endpoint of parity starting at h_S^\bar{\alpha}, exiting through parity costs edges, while exiting through parity costs . The group distances follow from Lemma 3.6; the gate distances follow directly from the interchange. Either sign gives arm sum . The stated path lengths therefore attain the endpoint distances.
Finally, has length . Any competing path that leaves the spine uses at least two arms, of total length at least . Thus is isometric as well.
The cover. Let be a constrained perfect matching. For every occurrence and each of its four rows, take a primary path if and a dummy path otherwise. Primary paths use the element gate of their exit row. In each group, use the -blockers for one unselected set and the -blockers for the other. Assign leaves, parallel dummy arms, and internal interchange vertices bijectively to the paths using them, and add .
Lemma 3.8 (Forward implication). If the source instance has a constrained perfect matching, then G has an isometric path cover of size .
Proof. Each element has one selected and two unselected occurrences, giving four primary and eight dummy paths. Thus the construction uses 12n paths plus , all isometric by Lemma 3.7.
The bijections are possible because each interchange has primary paths and dummy paths of each row, matching the sizes of its internal vertex classes; each element vertex likewise has one path per arm and leaf. In a selected set every row is covered directly. In an unselected set the path exiting row covers its middle and last vertices, while the path exiting row covers its first vertex. The two unselected sets cover the sixteen blockers using and , respectively. Every incidence arm is used once, and covers the spine and its auxiliary leaves. This accounts for all vertices.
3.5 Recovering a constrained perfect matching from a cover
Definition 3.9 (Nice paths and covers). A nice path is an isometric path from a group leaf to a spine-side leaf (an element leaf or one of ), using exactly one incidence arm, one internal interchange vertex, and one element arm. A nice cover consists of and 12n nice paths covering . This definition imposes no primary or dummy form inside the group gadget and no agreement of element indices.
Lemma 3.10 (Existence of a nice cover). If G has an isometric path cover of size at most k, it has a nice cover. The cover can be chosen so that its nice paths use no spine edges and cover every arm and internal interchange vertex exactly once.
Proof. There are leaves, so every path in such a cover has two leaf endpoints, each used once. Arm interiors have degree two, so an arm is always traversed completely.
We first bound arm usage. Two spine-side leaves have distance at most . From a group leaf, a direct row and two matching primary arms reach the spine in steps. Continuing along the spine gives distance bounds to a spine-side leaf and to a group leaf. Arm usage is even, and each arm has length at least . Our choice of therefore gives:
| Group endpoints | Arms used | Internal interchange vertices |
|---|---|---|
| 0 | 0 | 0 |
| 1 | 2 | at most 1 |
| 2 | at most 4 | at most 2 |
For the last column, observe that a shortest path cannot leave and re-enter an interchange: the gates have distance at most three, whereas an excursion uses at least two arms. A visit consequently has length at most three and contains at most one internal vertex; it uses two arms.
There are 12n internal interchange vertices to cover and 12n group endpoints. Equality is forced in the last column for every path. All internal vertices are therefore covered once, and the total arm usage is 24n. Since all 24n arms must be covered, each is used once. An interchange visit containing an internal vertex crosses between a group gate and an element gate; using two gates on the same side would have a clique shortcut. Hence each group endpoint leads through two arms and one internal vertex to the spine. The bounds leave only a spine portion between these branches, with no intervening group visit.
Cut the 12n branches at their first element vertices. Two arrive at each primary vertex and four at each dummy vertex, exactly matching the numbers of element leaves. Append these leaves bijectively and add . Each branch remains shortest, and extending it to a leaf preserves shortestness. The branches retain coverage away from the spine, while the reassigned leaves and cover the rest. This gives the asserted nice cover.
For the rest of the proof, fix a nice cover with the additional properties of Lemma 3.10. Its nice paths end at element leaves and visit only the group gadget containing their group endpoint.
Lemma 3.11 (The group prefixes). Each nice path has one of the following prefixes, for its endpoint leaf at :
where and contains . Call these primary and dummy prefixes, respectively. Every first, middle, and last row vertex is covered exactly once.
Proof. By Lemma 3.6, the prefix to the exit last vertex has length at most five. If it contains a middle vertex, that vertex is reached in three or four steps. In three steps it is reached through its own first vertex and must exit through its own last vertex. In four steps it must be reached through a blocker: entering from its last vertex would require repeating that vertex, and no first vertex has distance three from the starting leaf. Exiting through another set would have distance three and thus cannot use a middle vertex. These are precisely the displayed prefixes, each with one middle vertex.
There are 12n middle vertices and 12n nice paths, each covering at most one. Coverage forces each path to have one of these prefixes and each middle vertex to be covered once. In each group, its 24 paths then cover one first and one last vertex each. The 24 vertices of each kind must all be covered, so their coverage is also unique.
Lemma 3.12 (Path types and group selection). Each group has eight paths with primary prefixes and sixteen with dummy prefixes. Primary prefixes lead to primary element vertices, and dummy prefixes lead to dummy element vertices. Exactly one set of each group has eight primary prefixes, and each other set has eight dummy prefixes. Each blocking vertex is covered exactly once.
Proof. Only dummy prefixes cover blocking vertices, each covering one. The sixteen blockers in a group require at least sixteen dummy prefixes, leaving at most eight primary prefixes. Globally there are thus at most primary prefixes.
A dummy prefix cannot lead to a primary element endpoint. Switch its exit to the other parity for the same element and interchange sign. The prefix length decreases from five to four, while either group gate has distance two to the target primary gate. The arm lengths are unchanged, giving a strictly shorter route. Since there are 4n primary element arms to cover, and each nice path uses exactly one element arm, at least 4n prefixes are primary. Equality holds throughout: every group has eight primary and sixteen dummy prefixes, primary prefixes lead to primary endpoints, and dummy prefixes lead to dummy endpoints. Each blocker is consequently covered once.
For a fixed set , let indicate whether its unique exit through has a primary or dummy prefix. Unique coverage of last vertices gives . Unique coverage of gives , since a dummy prefix exiting row visits . Thus for every cyclic index. All eight prefixes of have the same type. The count of eight primary prefixes per group therefore selects exactly one of its three sets.
Lemma 3.13 (Index agreement by summation). Every nice path whose incidence arm belongs to has its element endpoint at u.
Proof. Let be a nice path whose incidence arm belongs to , and write for its endpoint element and for its interchange sign. Its two arms meet the same interchange, so .
A route through the opposite sign exists with the same endpoint leaves and the same local costs: choose the row for with the same exit parity and opposite sign, and copy the interchange segment in the identical opposite-sign interchange. The group prefix has the same length by Lemma 3.11; for a dummy prefix, use the corresponding predecessor blocker. The total arm length changes from to . Shortestness therefore gives
Fix . Every element u labels exactly six incidence arms entering interchanges of sign , and exactly six element arms incident with those interchanges. Every arm is used once by Lemma 3.10. Hence, summing over the nice paths through sign , with and denoting the incidence and endpoint elements of , respectively, we obtain
Every summand is nonpositive by (7), so every summand is zero. Since is injective, for every path through either sign.
Lemma 3.14 (Reverse implication). If G has an isometric path cover of size at most k, the source instance has a constrained perfect matching.
Proof. Use the cover obtained above and select the unique primary set of each group, supplied by Lemma 3.12. A selected set containing u supplies four primary paths for u, one per occurrence row, and all end at primary element vertices of u by Lemma 3.13. Conversely, all four primary element arms of u are used once and can only be used by these primary paths. Thus the number of selected sets containing u is exactly one. The selected sets partition U and contain exactly one set per group.
Combining Lemmas 3.8 and 3.14 gives the reduction. The source problem is NP-complete and the construction has polynomial size and pathwidth at most 287 (Lemmas 3.2 and 3.4). This proves Theorem 1.1.
4 Algorithm Parameterized by Treewidth plus Diameter
In this section, we give a dynamic programming algorithm solving ISOMETRIC PATH COVER in XP time parameterized by treewidth plus diameter.
As stated in Section 1, the states of our algorithm describe the “traces” of paths on the bags of the decomposition, which consist of how paths meet a bag, which connections should be realized outside the bag, and some distance information of their endpoints. Together with these traces, we store multiplicities indicating how many paths from the solution yield a given trace. Locally consistent traces that need not admit a global completion are allowed; however, it is guaranteed that at the root of the decomposition, every trace is an isometric path.
Let us also recall that, although this approach appears to follow standard techniques, it requires special effort to achieve the XP time bound. Most notably, instead of storing the exact endpoints of the traces, we must limit ourselves to the distance profiles of these endpoints, which are vectors indicating their distances to the vertices of a given bag of the decomposition. Handling these require particular attention for the compatibility of states, and is responsible for most of the complexity in proving the correctness of our algorithm.
4.1 Objects of the dynamic programming
We work with a finite, simple, connected, unweighted graph on vertices and diameter diam. Note that we may assume that and , as otherwise the instance is trivial. All distances are distances in , including when are considered within for some node .
Let be a rooted nice tree decomposition of width , with empty root and leaf bags and introduce vertex, forget vertex, and join nodes. The vertices of are labeled from 1 to . For a node , let be the graph induced by the vertices appearing in the subtree rooted at , and put and to be the interior and outside vertices w.r.t . The bag separates from .
Signed distance profiles. Suppose , and list its vertices as in increasing label order. For , its signed distance profile is
where , and where if and if . Every distance coordinate lies in , because . Consequently, there are at most signed profiles at .
Write for the set of profiles actually represented by vertices of . Write and for its positive and negative subsets. For a profile , write for its sign and for its ith distance coordinate. Its distance class is
In the following, we will only consider nonempty classes. For an empty bag, we set .
Lemma 4.1. Let and . For every and ,
In particular, the left-hand side is independent of the representative a.

Figure 2: A subtree-trace (left) and its bag projection (right) which yields a bag-trace. Dashed connections through the exterior are not part of the subtree-trace. In the bag-trace, links record whether the connecting portion is above (its value is +) or below (its value is -) the bag.
Proof. Every path meets . Taking a bag vertex on a shortest such path, and applying the triangle inequality in the opposite direction, gives . Using proves the equality.
We introduce common notation for distances from endpoints represented either explicitly or by their profiles.
For and , define
By Lemma 4.1, for every representative . In particular, for . For , set
For , its distance function on the bag is
The second definition also applies to negative profiles, but only at bag vertices.
Traces of paths on bags and subtrees. Traces describe portions of a path and its endpoints, together with the locations of the missing connections. See Figure 2. Throughout, intersecting a path with a vertex set means retaining its maximal contiguous subpaths on that set, with inherited order and orientation.
A subtree-trace at is a tuple , where and is a nonempty ordered family of oriented, nonempty, pairwise vertex-disjoint paths of . (We stress the fact that these vertex-disjoint paths are meant to represent the trace of a single isometric path on .) In addition, we require a number of conditions that we detail now; in the remaining, write and for the first and last vertices of . The first set of conditions, that we call distance conditions, consists of the following:
• Along every oriented edge of every path , increases by one and decreases by one.
• For ,
Then we require the following boundary conditions:
• For , both and lie in .
• If , then ; if , then .
• If , then ; if , then .
In particular, if , every meets . The conditions on and for positive endpoints are essential: any portion continuing outside must end at a bag vertex.
A subtree-trace is partial if it meets and complete otherwise. By the conditions above, a complete trace has and explicit endpoints , . The distance conditions then imply that represents a possible isometric path. These two cases exhaust all subtree-traces, including at an empty bag, where all traces are complete.
A trace needs not be the restriction of an actual isometric path: the missing connections are not required to exist. The dynamic program uses exactly the local conditions above. Conversely, the nonempty restriction of any oriented isometric path to is a subtree-trace, with any endpoint outside replaced by its positive profile. Indeed, distances from its endpoints are monotone along the path, and every crossing of the boundary uses .
A bag-trace at is a tuple , where , is a nonempty ordered family of oriented, nonempty, pairwise vertex-disjoint paths of , and is a function. In addition, we require a number of conditions that we detail now; in the remaining, write and for the first and last vertices of . The first set of conditions, we call distance conditions, consist of the following:
• Along each oriented edge, increases by one and decreases by one.
• For ,
Then we require the following boundary condition:
• if , then ; if , then .
Finally, we require some linking conditions that we detail now. The genuine link indices are the indices to which we add 0 if , and if . We note the set of these indices. We require that totally maps to , indicating whether the consecutive subpaths are aimed to be connected through (top) or through (bottom). Here, the index is considered for the connection from to ; index 0 connects the first endpoint to ; and index connects to the second endpoint. There is no endpoint link when that endpoint is itself a bag vertex. The function is called linking function, and by links we designate the pairs . We say that such a link is a top link if , and bottom link if . We say that a link is incident with a bag vertex if one of its attachment vertices is . Finally, we require that the link incident to a positive profile is a top link, and that the one incident to a negative profile is a bottom link.
In the remaining of the section, when considering a bag- or subtree-trace, by bag vertex (resp. bag edge) we mean a vertex (resp. edge) of its its ordered family of subpaths, and by gap we informally refer to the separations between consecutive subpaths of the family.
Partial solutions and states. A partial solution at is a pair , where is a finite set of subtree-traces and is a multiplicity function. The subpaths of these traces must cover , and must map complete subtree-traces to 1. Its order is . Equivalently, can be regarded as a finite multiset of trace occurrences.
A state at is a pair , where is a set of bag-traces and is a multiplicity function. Their subpaths must cover . Its order is
The empty state is , where the second empty set denotes the empty function. It is the unique state of an empty bag. Multiplicities are necessary because distinct path occurrences can have the same bag-trace and can later develop different traces; see Figure 3 (right). A set alone would lose the number of occurrences available for these extensions.
Projection, realizability, and values. The projection of a subtree-trace on (the bag of) is empty if it is complete. Otherwise, form by intersecting the subpaths of with , in their order and orientation. Replace each explicit endpoint in by its negative profile, retain bag endpoints and positive profiles, and define the links as follows. Consecutive bag portions have a bottom link if they are joined within the same , and a top link if they belong to different . Endpoint links are bottom for explicit endpoints in and top for positive endpoints. This gives .
This tuple is a bag-trace. For an explicit interior endpoint, conversion to its profile preserves its exact distance to every bag vertex. Thus all endpoint distance functions are unchanged on the bag. Along a subpath the required unit increments remain valid; across a removed interior portion or a gap, strict inequalities follow from the subtree-trace conditions. The endpoint and link conditions follow from the boundary conditions and the construction.
The projection of a partial solution is obtained by projecting its subtree-traces occurrence by occurrence, discarding empty projections, and aggregating multiplicities of equal bag-traces. Thus, the multiplicity function of the resulting state is
Coverage of implies coverage of , so this is a state. We say that P realizes S when its projection is S, and define
with value if no realization exists, or its order exceed n.
4.2 Computation of the values
We show how the values of states can be computed in bottom-up fashion.
4.2.1 Leaf Node
Let be a leaf node. Then . Recall that bag-traces are required to contain at least one vertex, by definition. Thus the only possible state for consists of an empty set of bag-traces, and an empty multiplicity function. Its only realizing partial solution is the empty multiset of subtree-traces. The optimal value of this state is 0 since is the empty graph.
We derive the next lemma.
Lemma 4.2. If t is a leaf node then for , and otherwise.
4.2.2 Introduce Vertex Node
Let have child with and . In particular, and has no neighbor in .
Before explaining how the value of an introduce vertex node is computed, we introduce a series of operations related to the deletion of vertex of the bag. While conducted in the natural way, these definition are lengthy due to the complex nature of these objects. These operations are better understood with Figures 3 and 4.
Restriction of profiles. If , define
For , this gives : the sign and all retained distance coordinates are unchanged. Restriction only deletes the coordinate corresponding to . The vertex , when converted to a child profile, has positive sign.
Introduce-admissibility A bag-trace at t is introduce-admissible if no bottom link is incident with x. A state is introduce-admissible if all its traces are. Every realizable state has this property, because a bottom connection at x would require an edge from x to .
Restriction of bag-traces. For an introduce-admissible bag-trace , its restriction is defined by deleting from its ordered, oriented subpaths and retaining the maximal nonempty contiguous pieces. If none remain, the restriction is empty. Otherwise , and the first endpoint becomes
Define symmetrically. Connections unaffected by deleting x are not changed. Those going through x are top: this includes the new link when a subpath splits, the merged link when a singleton x disappears, and the endpoint link when an endpoint x is replaced by its profile.
Note that every nonempty restriction is a bag-trace. Indeed, exact distances from retained endpoint profiles are unchanged on the remaining bag, and the same is true for distances from an endpoint x replaced by its profile. All edge and gap conditions therefore persist, and the endpoint and link rules are consistent with the new signs. If , every bag-trace restricts to the empty tuple and no profile conversion is performed.
For an admissible state , define by discarding empty restrictions and setting
The surviving traces cover , so this is a state. Set
Thus consists precisely of traces whose sole bag subpath is the singleton , and record how much they participate in the order of the state.

Figure 3: Deleting a bag vertex may remove a singleton subpath (top left), shorten a subpath (top middle), split a subpath (bottom left), or may have no incidence on subpaths (bottom middle). In any cases, the deletion of a vertex has implications on the distance profiles. Moreover, the restriction of two distinct bag-traces can give a same trace, and the count of the multiplicities is conserved in the restriction of a state (top right and bottom right). At an introduce restriction, every connection newly passing through the deleted vertex is top.
Restriction of subtree-traces. The restriction of subtree-traces is defined similarly as for the restriction of bag-traces, as follows. First delete from the subpaths, retaining the ordered maximal nonempty pieces. If no piece remains, discard the trace. Otherwise retain explicit endpoints in , replace an endpoint by , and restrict positive profiles with . When , a trace containing consists only of that singleton: has no neighbor in , and the boundary conditions prevent a second component or an interior endpoint attached to . All other traces are complete and remain unchanged.
For a partial solution , define by restricting subtree-traces occurrence by occurrence and discarding empty restrictions, and setting
It can be readily checked that the following properties hold.
Lemma 4.3. The restriction of an introduce-admissible state at t is a state at .
Lemma 4.4. The restriction of a partial solution at t is a partial solution at .
Lemma 4.5. If P realizes S at t, then its restriction realizes at .
Lifting a restricted trace. The following lemma supplies the converse to restriction which we will need in the proof of our recurrence.
Lemma 4.6. Let R be an introduce-admissible bag-trace at t.
-
If , then every subtree-trace at projecting to can be lifted to a subtree-trace at projecting to . The lift retains every vertex of and restricts back to .
-
If , then is the projection of a subtree-trace whose only subpath is the singleton .
Proof. For the first statement, retain all portions of inside and insert x, when prescribed by R, with the bag edges and position specified by R. Connections through the child interior are retained.
Explicit endpoints in are retained. An endpoint prescribed as x by R becomes the explicit vertex x. An endpoint prescribed as a positive profile by R is replaced by that profile.
We first verify the consistency of negative endpoint profiles. Suppose an explicit endpoint a of lies in . Since separates x from , we have
Thus the profile of a w.r.t. is determined by its profile w.r.t. . Since , it follows that . Thus retaining gives the required parent profile.
We next verify the distance conditions. On the retained vertices of , the endpoint exact distance functions are unchanged. This is immediate for retained explicit endpoints. For a positive parent profile, choose a representative outside and apply Lemma 4.1 at both nodes. For an endpoint changed from to , the same lemma gives
for every . Therefore all distance conditions within retained portions are preserved.
Every newly inserted edge has both endpoints in : has no neighbor in the child interior. The required increase by one along such an edge follows from the distance conditions of , using the endpoint-profile consistency established above. Likewise, inequalities across newly created gaps follow from the ordered bag vertices in . For gaps inherited from , they follow from the child distance conditions. The same argument applies to both endpoints.
The construction also preserves the boundary conditions. Component ends that still require an external continuation belong to , and explicit endpoints occupy the prescribed ends. The resulting components are vertex-disjoint paths: the old components are vertex-disjoint, x is new, and it is inserted only once, in its prescribed position.
Thus the resulting tuple Q is a subtree-trace. Its projection is R, and restricting it to recovers .
For the second statement, the only bag subpath of R is . An explicit endpoint must therefore equal x. A profile endpoint cannot be negative, since its incident link would then be a bottom link at x. Consequently, both endpoints are either x or positive profiles. Using these endpoints and the singleton subpath defines the required subtree-trace.
If , every bag-trace at has empty restriction, so only the second statement applies; no profile at an empty bag is needed.
Recurrence. We are now ready to prove the following recurrence.
Lemma 4.7. Let t be an introduce vertex node with child , and let S be a state at t. If S is not introduce-admissible, then
Otherwise, letting , we have
Proof. If S is not introduce-admissible, one of its bag-traces requires a bottom connection incident with x. Since x has no neighbor in , no subtree-trace can realize that bag-trace. Thus .
Suppose now that S is introduce-admissible. This situation is depicted in Figure 4.
We first prove
If , the inequality is immediate. Otherwise, let be a minimum-order partial solution realizing , and be its restriction to . By Lemma 4.5, realizes .

Figure 4: A bag-trace (left) and its restriction (right) in the context of an introduce-node.
Recall that in the restriction to , an occurrence disappears precisely when its only subpath is the singleton . These are exactly the occurrences whose bag projections belong to . Consequently,
and so leading to the desired inequality.
For the converse, suppose that is finite and choose a minimum-order partial solution realizing .
We construct a partial solution for as follows. First, we retain every complete occurrence of unchanged. Then, for each bag-trace of , we collect all occurrences of projecting to . Their number is , and the definition of state restriction gives
We may therefore partition these occurrences among the parent bag-traces R restricting to , allocating exactly occurrences to each such R. We lift each allocated occurrence to its assigned parent bag-trace using Lemma 4.6. This replaces each allocated occurrence by exactly one occurrence and preserves all its covered vertices. For every , additionally insert occurrences of the singleton subtree-trace provided by the second statement of Lemma 4.6. This completes the construction of P.
Note that every vertex of remains covered. Moreover, S covers , so some prescribed parent bag-trace contains x. Its corresponding lifted or newly inserted occurrence covers x. Thus P covers .
By the allocation of occurrences, exactly occurrences project to each . Hence P realizes S. Its order is
Therefore,
This concludes the proof.
22
□
4.2.3 Forget Vertex Node
Let be a forget vertex node with child . Then and for some vertex . Moreover, has no neighbor in .
Unlike an introduce node, a forget node does not remove a vertex from the subtree graph. It only moves x from the bag to the interior of the subtree. Accordingly, subtree-traces retain their subpaths, whereas their bag projections must be updated.
Restriction of profiles. Assume that . For a signed distance profile at , define by
Thus, we delete the coordinate corresponding to and leave all remaining distance coordinates unchanged. Note that for every vertex , we have
Forget-admissibility. Let be a bag-trace at . We call forget-admissible if no top link is incident with x. This condition expresses that, after forgetting x, a subpath cannot leave the subtree graph through x.
Restriction of bag-traces. For a forget-admissible bag-trace
we define its forget-restriction, denoted by , as follows.
First, delete from the ordered and oriented subpaths of , possibly shortening or splitting a subpath of , and keeping the inherited order and orientation. Let be the obtained set. If , set
Otherwise, , and the first endpoint of the restricted trace is
In particular, is a negative profile. The second endpoint is defined symmetrically.
The linking function is obtained by retaining the inherited links if they did not involve x, and putting a bottom link otherwise. More explicitly:
-
If deleting x splits one subpath into two nonempty subpaths, the link between them is bottom;
-
If deleting the singleton subpath joins two consecutive links into one, the resulting link is bottom. Both original links are bottom by forget-admissibility;
-
If deleting x shortens a subpath at an end incident with a link, that link remains bottom, with its attachment moved to the new end;
-
If an endpoint equal to x is replaced by , its connection to the first or last surviving subpath, respectively, is bottom.
These rules apply symmetrically at the two ends of the ordered trace. We then put
All retained distance coordinates are unchanged, and an endpoint converted to its profile still has distance to each . Thus the distance conditions are preserved, and every nonempty forget-restriction is a bag-trace at . If , every bag-trace at consists of the singleton path , and its forget-restriction is therefore empty.
Compatibility of states. A state at is forget-admissible if all its bag-traces are forget-admissible. Its forget-restriction is the state
where
and, for every ,
Every vertex of remains covered, so this indeed defines a state at t.
For a state S at t, let
Transport of partial solutions. We establish the relationship between realizations on the two sides of a forget node. We regard partial solutions as multisets of subtree-trace occurrences.
Lemma 4.8. Let t be a forget vertex node with child . The following statements hold.
-
If is a forget-admissible state at and realizes , then there exists a partial solution P at t realizing and having the same order as .
-
If P realizes a state S at t, then there exist a state and a partial solution at realizing and having the same order as P.
Proof. We start with the first statement. Consider the tuples obtained by keeping the subpaths and explicit endpoints of every subtree-trace of , and, if , replacing each positive endpoint profile by .
We verify that the resulting tuples are subtree-traces at . If , choose a representative for each positive endpoint profile. By Lemma 4.1, for every ,
Distances from explicit endpoints are also unchanged. Hence all distance conditions are preserved.
As of the boundary conditions, two situations arise depending on whether a trace still intersects the bag, or no longer does so. In the first scenario, only the first and third boundary conditions could be violated, when is the endpoint of a subpath in a bag-trace, in which case it must be incident to a top link. This situation, however, is excluded by the forget-admissibility of bag-traces in . In the other scenario, the bag-trace may already be avoided by , and hence remains complete. Otherwise, its intersection with was exactly . The boundary conditions and forget-admissibility imply that it consists of a single subpath with both endpoints explicit in . It therefore becomes complete. In particular, when , all resulting occurrences are complete and no positive endpoint profile needs to be converted.
So far, we have retained every occurrence and every covered vertex. After aggregating equal resulting traces, summing the multiplicities, we obtain a partial solution P of the same order as P'. By construction, its bag projection is , as desired.
We now turn to the second statement. First retain every subpath and explicit endpoint of every bag-trace of P. For each positive endpoint profile at , choose a representative and replace the profile by . Such a representative remains outside because . If , all occurrences are complete, so no such replacement is necessary.
For a replaced endpoint, its exact distance function on is unchanged, by Lemma 4.1. Hence all distance conditions are preserved. The boundary conditions remain valid because . We obtain a partial solution at with the same order and coverage as P.
Let be its projection on . No top link of this projection can be incident with : such a link would correspond to a component end that must continue outside , whereas and the original subtree-trace satisfies the boundary conditions at . Thus is forget-admissible.
Finally, deleting x from these bag projections and restricting their endpoint profiles recovers the original projections on . After aggregating multiplicities, this gives
Therefore , as required.
Recurrence. We are now ready to prove our recurrence.
Lemma 4.9. If t is a forget vertex node with child and S is a state at t, then
Proof. Let . If is finite, choose a minimum-order partial solution realizing . By the first statement of Lemma 4.8, it yields a partial solution realizing with the same order. Hence
The inequality is immediate if the child value is infinite. Taking the minimum over gives
Conversely, suppose that is finite, and choose a minimum-order partial solution realizing . By the second statement of Lemma 4.8, there exist and a partial solution realizing with
Therefore,
This inequality is immediate when is infinite. Together, the two inequalities prove the desired equality.
4.2.4 Join Node
Let be a join node with children and ; then .

Figure 5: A join-compatible triple of bag-traces. The endpoint represented by has a negative profile at and , and a positive profile at . Its link to is a bottom link at and , and a top link at . The three traces agree on the profile of the other endpoint and on the link between and .
Compatibility of traces. We first define compatibility at the level of individual traces. Let
be bag-traces at , , and t, respectively. We say that the triple is join-compatible if the following conditions hold:
-
The three traces have the same subpaths, with a common ordering and orientation satisfying their distance conditions. In particular, .
-
The endpoints are either all equal to the same vertex of , or are all distance profiles with identical distance coordinates and signs satisfying
The same condition holds for .
• For every genuine link index in the common domain ,
Thus, an endpoint outside the bag may lie in the interior of at most one child subtree; it is interior to the parent subtree exactly when it is interior to one of the children. Similarly, a link may be a bottom link in at most one child, and it is a bottom link in the parent exactly when it is a bottom link in one of the children. See Figure 5 for an illustration.
Compatibility of states. We now extend this definition to states, taking multiplicities into account. Let be a state for , and let and be states for and , respectively. We say that is join-compatible with if there exist nonnegative integers
such that:
• whenever is not join-compatible;
• for every ,
• for every ,
• for every ,
Intuitively, counts how many occurrences of and are paired to produce occurrences of R. These conditions allow different occurrences of the same trace in one child to be paired with different traces in the other child. We call the last three conditions above the marginal constraints of the join-compatibility.
We denote by the family of pairs with which is join-compatible. Summing the above equalities shows that every satisfies
Lemma 4.10. If t is a join node with children and S is a state of t, then
Proof. To simplify the coming argument, we regard each partial solution as a multiset of subtrees: a trace of multiplicity r has r occurrences. Under this interpretation, projection retains one occurrence for each nonempty projected trace, and aggregates occurrences with the same projection.
We first explain how compatible occurrences can be merged. See Figure 6 for an illustration. Let be a join-compatible triple, and let and be subtree-traces at and projecting to and , respectively. Their subpaths have the same intersection with , with a common ordering and orientation. Take the union of their subpaths, identifying their common portions in .
For each link, at most one child trace supplies a connection through the interior of its subtree. Consequently, this union consists of vertex-disjoint paths, ordered according to the common ordering on the bag. Indeed, the interiors of the two child subtrees are disjoint, and the compatibility conditions prevent two interior connections from occupying the same link. A link remains unconnected precisely when it is a top link in both children, which is precisely when it is a top link in R.
The endpoints of the merged trace are chosen as follows. An endpoint represented by a vertex of is retained. An endpoint whose profile in R is negative is taken from the unique child in which the corresponding profile is negative; in that child, the subtree-trace specifies the actual endpoint. An endpoint whose profile in R is positive is represented by that positive profile.
We verify the distance conditions for the resulting tuple. Consider its first endpoint. If it is represented by a positive profile, the distance function on either child subtree is the same as in the parent, since the bags and the distance coordinates of the profiles coincide. If the endpoint is a vertex of , the same exact distance function is used throughout. Finally, suppose that

Figure 6: The merging of join-compatible partial solutions.
the endpoint is a vertex in . The first child uses distances from , while the second uses its positive profile. By Lemma 4.1, for every ,
Thus the distance functions agree exactly on the second child. The case where a belongs to the interior of the second child is symmetric.
It follows that distances from the first endpoint increase by one along every oriented edge of the merged subpaths. Between consecutive subpaths, the required strict inequality follows from their boundary vertices in the bag and the distance conditions of R. The same argument, with the orientation reversed, applies to the other endpoint. The explicit endpoints remain attached to the appropriate ends of the resulting subpaths. Moreover, every resulting subpath intersects . Hence the merged tuple is a subtree-trace at t, and its projection is exactly R.
We now prove the recurrence. First, let . If either child value is infinite, the inequality
is immediate. Otherwise, choose minimum-order partial solutions and realizing and , and fix nonnegative integers witnessing join-compatibility.
For every , there are exactly occurrences in projecting to . The first marginal constraint allows us to distribute these occurrences among the pairs , allocating occurrences to each pair. Do the analogous distribution in using the second marginal constraint. For each triple with positive multiplicity, pair the two allocated collections arbitrarily and merge corresponding occurrences by the construction above.
Retain all complete trace occurrences from both children. Together with the merged occurrences, they form a partial solution P at t. Indeed, merging preserves every vertex covered by either occurrence, and . The third marginal constraint ensures that exactly merged occurrences project to each . Thus P realizes S.
Each merge replaces two occurrences by one, and the number of merges is
Therefore,
Taking the minimum over proves the first inequality.
For the converse, assume that is finite, and let P be a minimum-order partial solution realizing S. Restrict each of its occurrences to each child subtree, discarding empty restrictions. When an explicit endpoint lies in the interior of the other child, replace it by its positive profile. Positive endpoint profiles retain their distance coordinates, since the bags coincide. Denote the resulting multisets by and .
These restrictions are valid subtree-traces. To see this, intersect each subpath with the corresponding child subtree and retain the inherited ordering. Every cut occurs at the common separator . The distance conditions are inherited from the parent: replacing an endpoint in the other child by its profile preserves its distance function, by Lemma 4.1. The endpoint attachment conditions are preserved as well. Since restriction preserves coverage of the corresponding child subtree, and are partial solutions. Let and be their projections.
Every occurrence of P meeting has a nonempty restriction to both children. Its two child projections and its parent projection form a join-compatible triple. Indeed, their bag subpaths coincide, and each endpoint outside the bag lies either in one child interior or outside the parent subtree. Likewise, each connection through the parent interior lies entirely in one child interior, since separates the two interiors.
Define to count the occurrences of P having these three projections. These integers satisfy all three marginal constraints, so .
Every complete occurrence of P lies entirely in one child interior and is counted once in , . Every occurrence meeting is counted twice. There are exactly occurrences of the latter kind. Consequently,
By minimality of the child values,
If is infinite, this inequality is immediate. Together, the two inequalities prove the recurrence, with the convention that the minimum over an empty family is .
4.3 Correctness and complexity of the algorithm
We now prove the correctness and complexity of the algorithm.
Lemma 4.11. If r is the root, the minimum size of an isometric path cover of G is .
Proof. Here and . Every subtree-trace is complete and hence consists of one isometric path with explicit endpoints. Thus a realization of is a set of isometric paths covering with no multiplicity. Its order thus coincides with its cardinal. We conclude to the claimed statement by minimality over the realizations of .
The algorithm computes the values of the states bottom-up, using Lemmas 4.2, 4.7, 4.9, and 4.10, and outputs . Lemma 4.11 proves correctness. An optimal cover can also be recovered by storing a minimizing transition for every finite entry, including the allocation integers at joins, and following the constructive proofs of the bottom-up computation of the values of the states.
We now evaluate the number of states.
Lemma 4.12. Let be a connected graph on vertices with diameter , and let be a node whose bag has size . The number of distinct bag-traces at is at most
Consequently, the number of states at t with multiplicities in is at most
Proof. We first count bag-traces. Each endpoint is either a vertex of or a signed distance profile. For a vertex , every coordinate of its profile belongs to . There are therefore at most signed profiles, and at most ordered choices of endpoints.
Fix such a choice . The distance conditions of a bag-trace imply that the distances from to the subpaths is strictly increasing along the entire ordered sequence of its selected bag vertices: it increases by one within each subpath, and strictly increases between consecutive subpaths. Consequently, once the set of selected vertices is fixed, their order is uniquely determined. There are at most choices for . Then, partitioning the order on into consecutive parts determines the ordered subpaths, and there are at most such partitions.
If a partition has subpaths, there are at most links: those between consecutive subpaths and those incident with the two endpoints. Each link has at most two possible values. Thus there are at most linking functions.
Multiplying these bounds, the number of bag-traces is at most
A state with positive multiplicities at most can be encoded by assigning a value in to every possible bag-trace, where zero means that the trace is absent. Hence there are at most states. Since and , and the second bound follows.
We now evaluate the computation of the transitions. All distances and actual profile classes can be computed in polynomial time per decomposition node, after an all-pairs shortest-path computation. Bag-traces can be enumerated using the encoding in the proof: choose endpoints, a nonempty selected vertex set, a partition of its forced order, and genuine link labels, then test the defining conditions. These tests use only graph adjacency, distances, profiles, and bag data.
At an introduce node, admissibility, restriction, and the additional cost are computed directly from each state. At a forget node, we enumerate the child states, test admissibility, and update the entry for their restriction. At a join node, we enumerate parent and child state triples, compute the marginal constraint and test compatibility. The number of such triples is at most , and the number of integer values for is . These operations take time, times a polynomial in the size of .
Theorem 4.13. Given a connected n-vertex graph of diameter diam and a nice tree decomposition of width w with N nodes, a minimum isometric path cover can be computed in time
Consequently, ISOMETRIC PATH COVER is in XP parameterized by treewidth plus the diameter of the graph; without a supplied decomposition, the running time is for .
Proof. Correctness and the bound for a supplied nice decomposition follow from the preceding arguments. For the second statement, Korhonen's algorithm [Kor21] produces a decomposition of width at most in time when . Trying successive values of until a decomposition is returned has the same asymptotic bound and may terminate earlier. A decomposition of width with linearly many bags can be put in nice form with nodes and empty root and leaves by the standard normalization [BBL13, Klo94]. The parameter-dependent preprocessing and the number of nodes are absorbed by .
5 ISOMETRIC PATH COVER W[1]-Hardness with Respect to Path-width on Graphs of Diameter 7
Theorem 1.3. ISOMETRIC PATH COVER is W[1]-hard when parameterized by pathwidth even when the input graph has diameter 7.
The reduction is from UNARY BIN PACKING: given positive integer item sizes and a bin capacity b, encoded in unary, decide whether the items fit into at most k bins of capacity b. This problem admits a pseudopolynomial dynamic program with running time , but is W[1]-hard parameterized by k [JKMS13]. We use the following variant.
SPECIAL UNARY BIN PACKING
Input: items of even sizes , a positive capacity , all encoded in unary, and a positive integer , with .
Question: Can we partition the items into bins, each of total size exactly ?
Lemma 5.1. SPECIAL UNARY BIN PACKING is W[1]-hard parameterized by k.
Proof. Start with an instance of UNARY BIN PACKING, and let T be its total item size. Instances with an item larger than b or T > kb are immediate no-instances; if and every item fits, the answer is yes. Map these cases to fixed instances with the corresponding answer. Otherwise, add kb - T items of size one, and multiply all sizes and b by four. The added items fill precisely the unused capacity of any packing. Conversely, deleting them from a solution gives a packing of the original instance. Outside the fixed cases, the transformation has polynomial size, preserves k, and enforces the stated size and total-sum conditions.
5.1 Overview of the reduction
In the reduction, we construct a graph G that is shown in Figure 8. Among the vertices of the graph there are n vertices that correspond to the items, and k vertices that correspond to the bins. Each vertex has leaves that encode the size of this item, and each vertex has b leaves that encode the capacity of the corresponding bin. Then, each pair is connected by a structure called an anti-split gadget that essentially consists of “parallel” paths plus some other edges and vertices. If the i-th item is placed into the j-th bin, then we create paths from the leaves of to distinct leaves of that traverse the corresponding anti-split gadget. A potential problem here is that, in order to cover the graph, one could be tempted to “split” the items by having some paths starting from the same item but finishing in different bins. Our anti-split gadget prevents such a split by inducing a “penalty” for each gadget that is only partially traversed.
Organisation. In Section 5.2, we introduce our anti-split gadget, and describe the reduction in Section 5.3, where we give some properties of the graph constructed. Finally, we prove the equivalence of the instances in Sections 5.4 and 5.5.
5.2 The anti-split gadget
An anti-split gadget has two connection vertices and internal vertices, where its capacity is even. Figure 7 shows the case . The repeated pattern is cyclic: indices below are taken modulo . For each , introduce the eight vertices , and add the paths
These are all the gadget edges. In particular, lines crossing without a marked vertex in the figures do not create adjacencies. The vertices and will belong to X and Y, respectively. In the final graph they also have neighbors and outside the gadget.
We will use the following two types of internal paths, shown in green and blue in Figure 7:
green at
blue at
Both have length seven. All green paths partition the internal vertices. After the vertical paths are used, the blue paths with even indices partition the remaining vertices. Their isometry in the final graph is verified below.


Figure 7: Two copies of an anti-split gadget of capacity . The left side shows the optimal way to cover the internal vertices with isometric paths (green). We refer to this type of isometric paths as internal green paths. The right side shows a situation where the gadget is traversed by isometric paths from to . In this case, the optimal way to cover the remaining vertices is to use isometric paths (blue). We refer to this type of isometric paths as internal blue paths.
5.3 Construction of the graph
Let , be an instance of SPECIAL UNARY BIN PACKING where denote the sizes of the items. Notice that .
We construct a graph as follows. Figure 8 illustrates the construction.
• For each , add a vertex and leaf vertices adjacent to .
• For each , add a vertex and leaf vertices adjacent to .
We denote , , , , and .
- For each pair , add an anti-split gadget of capacity whose connection vertices are and .
Let denote the set of all internal vertices of these gadgets. Let (resp. ) denote the set of internal vertices that are adjacent to for some (resp. that are adjacent to for some , respectively).
- Finally, add a path of length 7, then connect to all vertices in X and to all vertices in Y.
This completes the construction of . Set which will be the cardinality of the optimal isometric path cover when the input is an YES-instance..
Lemma 5.2. G has vertices.

Figure 8: The graph of the reduction from SPECIAL UNARY BIN PACKING. Orange paths are encoding paths that indicate in which bin each item is packed. The path W bounds the diameter and is forced to appear in every cover within the budget. Internal vertices (pink area) that are not covered by encoding paths are covered either by internal green paths (middle gadget) or internal blue paths (rightmost gadget).
Proof. The first two terms correspond to sets and respectively. The third term is the size of . Then we have , since a gadget associated to has internal vertices and for each , there are gadgets incident to . Thus, . Finally, the last term is the size of .
Lemma 5.3. G has diameter 7.
Proof. The proof uses Figures 9, 10, and 11, which show the distances from , an item leaf, and an internal vertex, respectively. These distances follow from the edges of the construction.
Suppose, for a contradiction, that two vertices satisfy . Let and . These sets are shown in yellow and green in Figure 9. If neither endpoint belonged to , the route through would have length at most six. Thus meets , and the same argument using shows that it meets . Since , we may assume that and .
We now consider the possible locations of . The set consists of , the vertices , and the vertices of the gadgets.
• If , Figure 9 shows that every vertex is at distance at most six from .
-
If , then is adjacent to , so every vertex is at distance at most seven from .
-
If , Figure 10 shows that every vertex is at distance at most seven from . The same bound holds for any choice of item leaf.

Figure 9: Distances from . Yellow vertices are at distance at least 4 from while green vertices are at distance at least 4 from .

Figure 10: Distances from a vertex in . The orange path is an encoding path from that vertex. Green vertices are at distance 7 from the highlighted leaf.

Figure 11: Distances from an internal vertex (red node). The highlighted green vertex is the only endpoint reachable from the red vertex by a length-seven isometric path contained in this gadget. There are two such paths, shown in green and blue.
-
If , choose a leaf adjacent to . Distances from to every other vertex are one less than the distances from that leaf. Thus every vertex is at distance at most six from .
-
The remaining possibility is that has type in a gadget. This is the type of the red vertex in Figure 11, which shows that every vertex is at distance at most seven. Cyclic symmetry gives the same conclusion for every index , in any gadget.
Each case contradicts , so the diameter is at most seven. Finally, : a route from to has at least five edges, whether it follows W or passes through the gadgets. Therefore the diameter is exactly seven.
Lemma 5.4. The graph G has pathwidth at most .
Proof. We construct a path decomposition by keeping in every bag and processing the remaining vertices one item at a time. First, introduce and forget the leaves of B one at a time. When processing item i, retain , process its leaves in the same way, and then process its k gadgets consecutively.
It remains to describe how to process one gadget without keeping all its vertices in a bag. Let consist of its eight internal vertices with index . Use the following bags, in the indicated order:
Every internal edge lies within one cell or joins two cyclically consecutive cells. The cells , cover the consecutive-cell edges, while retaining throughout covers the edges joining the last cell to the first. All edges incident with , , , or are covered because these vertices remain in the bags. Moreover, every internal vertex occurs in a consecutive sequence of bags. We can therefore concatenate these sequences for all gadgets and items to obtain a path decomposition of .
The largest bag contains at most vertices of , the vertex , and three cells of eight vertices. Its size is at most , giving pathwidth at most .
In Sections 5.4 and 5.5, we prove the following equivalence.
Lemma 5.5. The instance of SPECIAL UNARY BIN PACKING has a solution if and only if G can be covered by at most isometric paths.
Thanks to this lemma we can prove Theorem 1.3.
Proof of Theorem 1.3. The construction has polynomial size in the unary input, diameter seven, and pathwidth at most by Lemma 5.4. Lemma 5.5 establishes equivalence of the instances. This is a parameterized reduction from SPECIAL UNARY BIN PACKING, proving the claimed pathwidth hardness.
5.4 Forward direction
Suppose the instance of SPECIAL UNARY BIN PACKING has a solution, with item i packed into bin . The green and blue paths listed above are isometric in G: tracing their internal routes gives distance seven between their endpoints, and a route leaving the gadget meets one of , , , , whose distances to these endpoints sum to seven. These distances are illustrated in Figure 11.
We construct a cover P of G with isometric paths as follows.
• add a path of length 7 that covers W. Figure 9 shows that this is an isometric path.
-
For each , add encoding paths, each one starting in a different leaf of and finishing in a different leaf of . Such a family is shown on Figure 8 by the orange paths (on the figure we have ). These encoding paths go through the anti-split gadget with connection vertices and , and each uses a different vertical path . Assign bin leaves bijectively to the incoming paths; the packing guarantees exactly paths per bin. Figure 10 shows that encoding paths are isometric. There are encoding paths.
-
For each , add the internal blue paths with even indices that cover the uncovered vertices of the anti-split gadget connecting and . These paths are shown on Figure 8 (on the gadget between and ), and on Figure 7 (right). Figure 11 shows that these paths are isometric. In total, uses internal blue paths.
-
For each such that , add internal green paths to cover the gadget between and . These paths are shown on Figure 8 (in the gadget between and ), and on Figure 7 (left). Figure 11 shows that these paths are isometric. In total, the number of internal green paths is .
This defines . Observe that, has size . This concludes the proof of the forward direction. Notice that all paths in have length exactly 7, the diameter of the graph, and that the only vertices of the graph that are covered by several paths are vertices of .
5.5 Backward direction
Fix an isometric path cover P of G with at most paths. We first establish the properties that will allow us to recover a packing.
Lemma 5.6. The cover P has the following properties.
-
Every path has length seven.
-
Every vertex outside is covered exactly once.
-
Apart from W, every path either consists entirely of internal vertices of one anti-split gadget, or joins a leaf of to a leaf of through a vertical path of their gadget, as the orange paths in Figure 8. In particular, every path meeting has this latter form.
Proof. Here denotes the number of vertices of a path . Let and . For each vertex , let be the number of paths of containing . For a vertex set , put . Thus counts coverage with multiplicity, and double counting gives
We first give a lower bound on the coverage of . Let be the leaves not covered by any path in . There are 2kb leaves in , and a path can cover at most two leaves. Hence
Every leaf of must be covered by a path in . Now consider any such path . If it contains a leaf of , it also contains its neighbor in . Furthermore, it cannot contain two leaves with the same neighbor: those leaves would be its endpoints and the path would have only three vertices. Therefore , and summing gives
(9)
We now compare the coverage required by the graph with the coverage provided by the paths. On the one hand, every vertex outside must be covered at least once. Using the vertex count and the preceding bound, we obtain
(10)
(11)
On the other hand, an isometric path has at most eight vertices by Lemma 5.3, so
(12)
where the last inequality uses . Comparing the two bounds forces . The bounds then coincide, so and all the displayed inequalities are equalities. In particular, equality in (12) means that every path has eight vertices, and equality in (10) means that no vertex outside is covered twice. This proves the first two properties.
Moreover, equality in (11) gives , and the coverage bounds above are tight. In particular, equality in (9) gives for every . Every leaf of has its neighbor on , and these neighbors are distinct because has eight vertices. They therefore account for all vertices of . Consequently, if belongs to , one of its leaves belongs to as well.
We next show that belongs to the cover. This will exclude paths that use or to move between gadgets. Refer to Figure 9. Let denote the isometric path that contains , and suppose for a contradiction that . Since , either it uses an edge between and a vertex in , or it uses an edge between and a vertex in . Notice that the second case cannot happen since is an isometric path, and the distance between and any vertex of is 5. Thus, , and let be the path that contains . Since is covered only once, is an endpoint of . Its length is seven, so we must have and . But then, the path that contains must intersect in which contradicts the fact that this vertex is covered only once.
We now show that a path meeting must end in , and conversely. Refer to Figure 10. Let be a path in that intersects . The other case is symmetric. We show that has to connect to a leaf in like the orange path shown in the Figure. Since , the other endpoint must be one of the (green) vertices labeled with 7 on Figure 10.
Since and are already covered by the preceding argument and are covered only once, we know that . Then, cannot be one of the green internal vertices that are not in since all the corresponding isometric paths contain which would again contradict unique coverage.
Suppose now that . Then, either passes by which would again be a contradiction, or passes by a vertex in ( on the figure). This contradicts the fact proved above that a covered connection vertex must have a leaf on the same path, because would then contain a vertex , for some , without containing a leaf in .
Thus, the only remaining option is . This establishes the required endpoint pairing.
Consider such a path, with endpoints in and . It cannot meet another connection vertex, since that would force a third leaf onto the path. It also avoids , by unique coverage. Its internal segment therefore stays in the gadget between and . Four of its seven edges connect its endpoint leaves to and , leaving three edges within the gadget. From the gadget edges, this segment is either or .
We can exclude the second possibility using the vertices . Each of these vertices is at distance at most six from every vertex of . Indeed, their distances to are and , respectively; the distances in Figure 9 give the bound six in both cases. Neither can therefore be an endpoint of a length-seven isometric path. Since they have degree two, the path covering must contain the entire segment . An encoding path using cannot also contain . It would therefore share with the path covering , contradicting unique coverage. Thus every path meeting is an orange encoding path.
Finally, any path that meets also meets , as proved above. Every remaining path other than avoids both the connection vertices and , so it is contained in the internal vertices of a single gadget. This proves the third property and completes the proof.
By Lemma 5.6, the unique path covering a leaf ends in for some . We call the destination of . We say that item is split if there exist two vertices in with different destinations. Otherwise, we say that item is packed in bin .
Lemma 5.7. No item is split.
Proof. Fix a gadget between and , of capacity . We will show that it carries either no encoding path or exactly encoding paths. Since there are only leaves at , this will exclude splitting item between several bins.
By Lemma 5.6, every path meeting the gadget is either an encoding path from to or consists entirely of its internal vertices. Encoding paths follow vertical segments ; in particular, they never cover a vertex of type or .
We first classify paths contained in the gadget. They have length seven. The distances of its vertex types to are
| (1,4) | (2,3) | (3,2) | (4,1) | (2,3) | (3,2) | (4,3) | (3,4). |
For endpoints at distance seven, the sums of their distances to each connection vertex are at least seven. Since all distances in the table are at most four, one endpoint must be at distance four from and at least three from . It therefore has type . The other endpoint must then be at distance four from and at least three from , so it has type . Starting from and stopping at a vertex of type , the neighbor lists give short internal routes to of lengths one, three, and five, respectively. The only other simple internal routes of length at most seven are
This enumeration follows by choosing one of the two neighbors , of and continuing without repeating a vertex. Thus a length-seven geodesic must be the green path at or the blue path at .
We can now use unique coverage to compare consecutive cells. Let be one if the green path at belongs to the cover, and zero otherwise; define in the same way for the blue path at . The vertex belongs to the green path at and to the blue paths at and . Likewise, belongs to the green path at and to those same two blue paths. Neither vertex can be covered by an encoding path. Since each is covered exactly once, we have
Subtracting gives . As the indices are cyclic, all the have the same value.
If this value is one, the green paths cover every vertex of in the gadget, and unique coverage excludes any encoding path through it. If the value is zero, no green path is used. Blue paths do not meet , so all vertices of must be covered by encoding paths. Each encoding path contains exactly one such vertex, and hence there are exactly encoding paths through the gadget.
Finally, choose any gadget used by a path from a leaf of . It carries encoding paths, which already account for all leaves of . Thus every leaf of has the same destination, and item is not split.
We can use the encoding paths to construct a valid solution to SPECIAL UNARY BIN PACKING: for each , put item in the bin , where is the destination of any vertex in . Exactly vertices of are covered by paths from and since all the vertices are covered, the sum of the sizes of the items placed in each bin is exactly , as expected.
This concludes the backward direction and completes the proof of Lemma 5.5.
6 Conclusion
In this article, we studied the parameterized complexity of ISOMETRIC PATH COVER. We proved that the problem does not admit an XP-algorithm w.r.t. pathwidth or treewidth, unless P=NP. On the contrary, ISOMETRIC PATH COVER admits an XP-algorithm w.r.t. treewidth plus diameter. However, it is W[1]-hard w.r.t. the combined parameters diameter and pathwidth.
We mention two future research directions. First, we wonder whether ISOMETRIC PATH COVER and ISOMETRIC PATH PARTITION are FPT or W[1]-hard when parameterized by the solution size k. Both problem are known to be in XP [DFPT24]. Arguably, these are the most important open questions on these problems from the perspective of parameterized complexity.
In the same direction, other interesting questions are whether ISOMETRIC PATH PARTITION or ISOMETRIC PATH COVER become FPT for treewidth on planar graphs. We note that this question has been raised (and is still open) for other distance-based optimization problems such as METRIC DIMENSION [BP21].
Disclosure on generative AI usage. This paper was initially written solely by the authors. AI tools were then used to run preliminary checks of the correctness, to obtain the arguments of some minor lemmas, to revise, and to enhance the presentation of the manuscript. We detail this usage for each of the sections where it was used.
Section 3. The authors designed and wrote the initial reduction. Discussions with AI tools helped identify a flaw, which the tools could not resolve. The authors developed a revised approach using a different source problem; ChatGPT Astra supplied the proof of its NP-hardness (Lemma 3.2). Further discussions revealed a missing component, leading the authors to add the “spine” construction. AI tools drafted the current proof from the authors’ detailed construction and arguments, and the authors revised it for clarity and readability and created the figure. In addition to our own proofreading, ChatGPT Astra subsequently reviewed the reduction without identifying further errors.
Section 4. A first version of the dynamic programming was written by the authors. AI tools were used to verify the approach and enhance the presentation.
Section 5. AI tools reviewed the reduction for possible errors and reported none.
Acknowledgments. The authors would like to thank the organizers of the 2024 Workshop of the AGC team of LIMOS at Saint-Jacques-d'Ambur, where this research was initiated.
Florent Foucaud was supported by the ANR project GRALMECO (ANR-21-CE48-0004), the French government IDEX-ISITE initiative 16-IDEX-0001 (CAP 20-25), the International Research Center “Innovation Transportation and Production Systems” of the I-SITE CAP 20-25, and the CNRS IRL ReLaX.
Dibyayan Chakraborty received funding from the London Mathematical Society (Scheme 7, SC7-2526-02).
References
[AGG 19] Ittai Abraham, Cyril Gavoille, Anupam Gupta, Ofer Neiman, and Kunal Talwar. Cops, robbers, and threatening skeletons: Padded decomposition for minor-free graphs. SIAM Journal on Computing, 48(3):1120–1145, 2019.
[BBL13] Hans L. Bodlaender, Paul Bonsma, and Daniel Lokshtanov. The fine details of fast dynamic programming over tree decompositions. In International Symposium on Parameterized and Exact Computation, pages 41–53. Springer, 2013.
[BDG 26] Julien Baste, Lucas De Meyer, Ugo Giocanti, Etienne Objois, and Timothé Picavet. A polynomial bound on the pathwidth of graphs edge-coverable by k shortest paths. In 43rd International Symposium on Theoretical Aspects of Computer Science (STACS 2026), volume 364 of Leibniz International Proceedings in Informatics (LIPIcs), pages 10:1–10:17. Schloss Dagstuhl – Leibniz-Zentrum für Informatik, 2026.
[BP21] Édouard Bonnet and Nidhi Purohit. Metric dimension parameterized by treewidth. Algorithmica, 83(8):2606–2633, 2021.
[CCFV26] Dibyayan Chakraborty, Jérémie Chalopin, Florent Foucaud, and Yann Vaxès. Isometric path complexity of graphs. Discrete Mathematics, 349(2):114743, 2026.
[CDD 22] Dibyayan Chakraborty, Antoine Dailly, Sandip Das, Florent Foucaud, Harmender Gahlawat, and Subir K. Ghosh. Complexity and algorithms for isometric path cover on chordal graphs and beyond. In Proceedings of the 33rd International Symposium on Algorithms and Computation, ISAAC, volume 248 of LIPIcs, pages 12:1–12:17. Schloss Dagstuhl - Leibniz-Zentrum für Informatik, 2022.
[CDF 26] Dibyayan Chakraborty, Oscar Defrain, Florent Foucaud, Mathieu Mari, and Prafullkumar Tale. Parameterized complexity of isometric path partition: Treewidth and diameter. In 52nd International Workshop on Graph-Theoretic Concepts in Computer Science (WG 2026), volume 376 of LIPIcs, pages 11:1–11:18, 2026.
[CF25] Dibyayan Chakraborty and Florent Foucaud. Strong isometric path complexity of graphs: Asymptotic minors, restricted holes, and graph operations. arXiv:2501.10828, 2025.
[CFK 15] Marek Cygan, Fedor V. Fomin, Lukasz Kowalik, Daniel Lokshtanov, Dániel Marx, Marcin Pilipczuk, Michał Pilipczuk, and Saket Saurabh. Parameterized algorithms. Springer, 2015.
[CMO 26] Dibyayan Chakraborty, Haiko Müller, Sebastian Ordyniak, Fahad Panolan, and Mateusz Rychlicki. Covering and partitioning of split, chain and cographs with isometric paths. Theoretical Computer Science, page 115910, 2026.
[CNP 22] Marek Cygan, Jesper Nederlof, Marcin Pilipczuk, Michał Pilipczuk, Johan M. M. Van Rooij, and Jakub O. Wojtaszczyk. Solving connectivity problems parameterized by treewidth in single exponential time. ACM Transactions on Algorithms (TALG), 18(2):1–31, 2022.
[Cou90] Bruno Courcelle. The monadic second-order logic of graphs. I. recognizable sets of finite graphs. Information and Computation, 85(1):12–75, 1990.
[DFPT24] Maël Dumas, Florent Foucaud, Anthony Perez, and Ioan Todinca. On graphs coverable by k shortest paths. SIAM Journal on Discrete Mathematics, 38(2):1840–1862, 2024.
[Epp15] David Eppstein. Metric dimension parameterized by max leaf number. J. Graph Algorithms Appl., 19(1):313–323, 2015.
[FF01] David C. Fisher and Shannon L. Fitzpatrick. The isometric number of a graph. Journal of Combinatorial Mathematics and Combinatorial Computing, 38(1):97–110, 2001.
[FFM 25] Henning Fernau, Florent Foucaud, Kevin Mann, Utkarsh Padariya, and Rajath R. K. N. Parameterizing path partitions. Theoretical Computer Science, 1028:115029, 2025.
[FGJ 26] Fedor V. Fomin, Petr A. Golovach, Nikola Jedlicková, Jan Kratochvil, Danil Sagunov, and Kirill Simonov. Path cover, hamiltonicity, and independence number: An FPT perspective. In Aditya Bhaskara and Artur Czumaj, editors, Proceedings of the 58th Annual ACM Symposium on Theory of Computing, STOC 2026, Salt Lake City, UT, USA, June 22-26, 2026, pages 276–285. ACM, 2026.
[FGK 24] Florent Foucaud, Esther Galby, Liana Khazaliya, Shaohua Li, Fionn Mc Inerney, Roohani Sharma, and Prafullkumar Tale. Problems in NP can admit double-exponential lower bounds when parameterized by treewidth or vertex cover. In 51st International Colloquium on Automata, Languages, and Programming, ICALP 2024, volume 297 of LIPIcs, pages 66:1–66:19. Schloss Dagstuhl - Leibniz-Zentrum für Informatik, 2024.
[FGK 27] Florent Foucaud, Esther Galby, Liana Khazaliya, Shaohua Li, Fionn Mc Inerney, Roohani Sharma, and Prafullkumar Tale. Metric dimension and geodetic set parameterized by vertex cover. Journal of Computer and System Sciences, 164:103850, 2027.
[FMMRT26] Florent Foucaud, Atrayee Majumder, Tobias Mömke, and Aida Roshany-Tabrizi. Polynomial-time algorithms for path cover and path partition on trees and graphs of bounded treewidth. Theoretical Computer Science, 1086:116226, 2026.
[FNHC01] Shannon L. Fitzpatrick, Richard J. Nowakowski, Derek A. Holton, and Ian Caines. Covering hypercubes by isometric paths. Discrete Mathematics, 240(1-3):253–260, 2001.
[GJ02] Michael R. Garey and David S. Johnson. Computers and intractability, volume 29. wh freeman New York, 2002.
[GM60] Tibor Gallai and Arthur N. Milgram. Verallgemeinerung eines graphentheoretischen satzes von rédei. Acta Sc. Math, 21:181–186, 1960.
[GP25] Agelos Georgakopoulos and Panos Papasoglu. Graph minors and metric spaces. Combinatorica, 45(3):33, 2025.
[Hic25] Robert Hickingbotham. Graphs that are quasi-isometric to graphs with bounded treewidth. arXiv:2501.10840, 2025.
[Hol81] Ian Holyer. The NP-completeness of edge-coloring. SIAM Journal on Computing, 10(4):718–720, 1981.
[JKMS13] Klaus Jansen, Stefan Kratsch, Dániel Marx, and Ildikó Schlotter. Bin packing with fixed number of bins revisited. Journal of Computer and System Sciences, 79(1):39–49, 2013.
[KK22] Leon Kellerhals and Tomohiro Koana. Parameterized complexity of geodetic set. Journal of Graph Algorithms and Applications, 26(4):401–419, 2022.
[Klo94] Ton Kloks. Treewidth: computations and approximations. Springer, 1994.
[KLP19] Ioannis Katsikarelis, Michael Lampis, and Vangelis T. Paschos. Structural parameters, tight bounds, and approximation for (k, r)-center. Discrete Applied Mathematics, 264:90–117, 2019.
[KLP22] Ioannis Katsikarelis, Michael Lampis, and Vangelis T. Paschos. Structurally parameterized d-scattered set. Discrete Applied Mathematics, 308:168–186, 2022.
[Kor21] Tuukka Korhonen. A single-exponential time 2-approximation algorithm for treewidth. In 62nd IEEE Annual Symposium on Foundations of Computer Science (FOCS 2021), Denver, CO, USA, February 7-10, 2022, pages 184–192. IEEE, 2021.
[KS23] Martin Kucera and Ondřej Suchý. Minimum eccentricity shortest path problem with respect to structural parameters. Algorithmica, 85(3):762–782, 2023.
[LP22] Shaohua Li and Marcin Pilipczuk. Hardness of metric dimension in graphs of constant treewidth. Algorithmica, 84(11):3110–3155, 2022.
[NSS25] Tung Nguyen, Alex Scott, and Paul Seymour. Asymptotic structure. i. coarse tree-width. arXiv:2501.09839, 2025.
[PC05] Jun-Jie Pan and Gerard J. Chang. Isometric-path numbers of block graphs. Information Processing Letters, 93(2):99–102, 2005.
[PC06] Jun-Jie Pan and Gerard J. Chang. Isometric path numbers of graphs. Discrete mathematics, 306(17):2091–2096, 2006.
[Tal25] Prafullkumar Tale. Geodetic set on graphs of constant pathwidth and feedback vertex set number. In Akanksha Agrawal and Erik Jan van Leeuwen, editors, 20th International Symposium on Parameterized and Exact Computation (IPEC 2025), Warsaw, Poland, September 17-19, 2025, volume 358 of LIPIcs, pages 28:1–28:14. Schloss Dagstuhl - Leibniz-Zentrum für Informatik, 2025.
[Tal26] Prafullkumar Tale. On the hardness of strong metric dimension. In 21st International Symposium on Parameterized and Exact Computation (IPEC 2026), Leibniz International Proceedings in Informatics (LIPIcs), page (to appear), Dagstuhl, Germany, 2026. Schloss Dagstuhl – Leibniz-Zentrum für Informatik. https://arxiv.org/abs/2608.06747.
[TG21] Maximilian Thiessen and Thomas Gärtner. Active learning of convex halfspaces on graphs. In Proceedings of the 35th Conference on Neural Information Processing Systems, (NeurIPS 2021), volume 34, pages 23413–23425. Curran Associates, Inc., 2021.