A linear time algorithm for linearizing quadratic and higher-order shortest path problems

An instance of the NP-hard Quadratic Shortest Path Problem (QSPP) is called linearizable iff it is equivalent to an instance of the classic Shortest Path Problem (SPP) on the same input digraph. The linearization problem for the QSPP (LinQSPP) decides whether a given QSPP instance is linearizable and determines the corresponding SPP instance in the positive case. We provide a novel linear time algorithm for the LinQSPP on acyclic digraphs which runs considerably faster than the previously best algorithm. The algorithm is based on a new insight revealing that the linearizability of the QSPP for acyclic digraphs can be seen as a local property. Our approach extends to the more general higher-order shortest path problem.


Introduction
In this paper we consider the linearization problem for nonlinear generalizations of the Shortest Path Problem (SPP), a classic combinatorial optimization problem.An instance of the SPP consists of a digraph G = (V, A), a source vertex s ∈ V , a sink vertex t ∈ V , and a cost function c : A → R, which maps each arc a ∈ A to its cost c(a).The cost of a simple directed s-t-path P , is given by 4 SPP(P, c) := a∈P c(a) . ( The goal is to find a simple directed s-t-path in G which minimizes the objective (1).In general it is assumed that there are no circuits of negative weight in G. †Deceased in April 2022. 4We use the same notation for the path P and the set of its arcs.
Consider now a number d ∈ N. The Order-d Shortest Path Problem (SPP d ) takes as input a digraph G = (V, A), a source vertex s ∈ V , a sink vertex t ∈ V , and an order-d arc interaction cost function q d : {B ⊆ A : |B| ≤ d} → R. Thus q d assigns a weight to every subset of arcs of cardinality at most d.The cost of a simple directed s-t-path P is given by SPP d (P, q d ) := S⊆P : |S|≤d q d (S) . ( The goal is to find a simple directed s-t-path in G which minimizes the objective function (2).For d = 2 we obtain the Quadratic Shortest Path Problem (QSPP) which has already been studied in the literature [2,10,11,18].For notational convenience we write QSPP(P, q) for SPP d (P, q d ) if d = 2.
The QSPP arises in network optimization problems where costs are associated with both single arcs and pairs of arcs.This includes variants of stochastic and time-dependent route planing problems [15,20,21] and network design problems [14,9].For an overview on applications of the QSPP see [11,18].We are not aware of any publications for the case d > 2.
While the SPP can be solved in polynomial time, the QSPP is an NP-hard problem even for the special case of the adjacent QSPP where the costs of all pairs of non-consecutive arcs are zero [18].The QSPP is an extremely difficult problem also from the practical point of view.Hu and Sotirov [11] report that a state-of-the-art quadratic solver can solve QSPP instances with up to 365 arcs, while their tailor-made B&B algorithm can solve instances with up to 1300 arcs to optimality within one hour.Instances of the SPP can however be solved in a fraction of a second for graphs with millions of vertices and arcs.
Given the hardness of the QSPP, a research line on this problem has focussed on polynomially solvable special cases which arise if the input graph and/or the cost coefficients have certain specific properties.Rostami et al. [19] have presented a polynomial time algorithm for the adjacent QSPP in acyclic digraphs and in series-parallel graphs.Hu and Sotirov [10] have shown that the QSPP can be solved in polynomial time if the quadratic costs build a nonnegative symmetric product matrix, or if the quadratic costs build a sum matrix and all s-t-paths in G have the same number of arcs.
These two polynomially solvable special cases of the QSPP belong to the larger class of the linearizable SPP d instances defined as follows.
Definition 1.An instance of the SPP d with an input digraph G = (V, A), a source node s, a sink node t and a cost function q d is called linearizable if there exists a cost function c : A → R + such that for any simple directed s-t-path P in G the equality SPP(P, c) = SPP d (P, q d ) holds.A linearizable instance of the QSPP is defined analogously, just replacing SPP d (P, q d ) by QSPP(P, q).The recognition of linearizable QSPP (SPP d ) instances, also called the linearization problem for the QSPP (SPP d ), abbreviated by LinQSPP (LinSPP d ) arises as a natural question.In this problem the task consists of deciding whether a given instance of the QSPP (SPP d ) is linearizable and in finding the linear cost function c in the positive case.The notion of linearizable special cases of hard combinatorial optimization problems goes back to Bookhold [1] who introduced it for the quadratic assignment problem (QAP).For symmetric linearizable QAP instances a full characterization has been obtained while only partial results are available for the linearizability of the general QAP, see [3,6,7,8,13,16].The linearization problem has been studied for several other quadratic combinatorial optimization problems, see [4,22] for the quadratic minimum spanning tree problem, [17] for the quadratic TSP, [5] for the quadratic cycle cover problem and [12] for general binary quadratic programs.Linearizable instances of a quadratic problem can be used to generate lower bounds needed in B&B algorithms.For example, Hu and Sotirov introduce the family of the so-called linearization-based bounds [12] for the binary quadratic problem.Each specific bound of this family is based on a set of linearizable instances of the problem.The authors show that well-known bounds from the literature are special cases of the newly introduced bounds.Clearly, fast algorithm for the linearization problem are important in this context.
While LinSPP d has not been investigated in the literature so far (to the best of our knowledge), the LinQSPP has been subject of investigation in some recent papers.In [2] C ¸ela, Klinz, Lendl, Orlin, Woeginger and Wulf proved that it is coNP-complete to decide whether a QSPP instance on an input graph containing a directed cycle is linearizable.Thus, a nice characterization of linearizable QSPP instances for such graphs seems to be unlikely.In the acyclic case, Hu and Sotirov first described a polynomial-time algorithm for the LinQSPP on directed twodimensional grid graphs [10].Recently, in [12] they generalized this result to all acyclic digraphs and proposed an algorithm which solves the problem in O(nm 3 ), where n and m denote the number of vertices and arcs in G.
Finally, let us mention a related concept, the so-called universal linearizability, studied in [2,10].A digraph G is called universally linearizable with respect to the QSPP iff every instance of the QSPP on the input graph G is linearizable for every choice of the cost function q.In [10] it is shown that a particular class of grid graphs is universally linearizable.In [2] a characterization of universally linearizable grid graphs in terms of structural properties of the set of s-t-paths is given.Moreoever, for acyclic digraphs a forbidden subgraphs characterization of the universal linearizability is given in [2].
Contribution and organization of the paper.In this paper we provide a novel and simple characterization of linearizable QSPP instances on acyclic digraphs.Our characterization shows that the linearizability can be seen as a local property.In particular, we show that an instance of the QSPP on an acyclic digraph G is linearizable if and only if each subinstance obtained by considering a subdigraph of G consisting of two s-t-paths in G is linearizable.Our simple characterization also works for the SPP d and even for completely arbitrary cost functions, which assign some cost f (P ) to every s-t-path P without any further restrictions.The latter problem is referred to as the Generic Shortest Path Problem (GSPP) and is formally introduced in Section 2. Indeed, the characterization of the linearizable instances of the SPP d follows from the characterization of the linearizable instances of the GSPP, both on acyclic digraphs.
Further, we propose a linear time algorithm which can check the local condition mentioned above for the QSPP and the SPP d .We note that this is not straightforward, because the number of the subinstances for which the condition needs to be checked is in general exponential.As a side result our approach reveals an interesting connection between the LinQSPP and the problem of deciding whether all s-t-paths in a digraph have the same length.As a result, we obtain an algorithm which solves the LinQSPP linearization in O(m 2 ) time, thus improving the best previously known running time of O(nm 3 ) obtained in [12].Our approach yields an O(d 2 m d ) time algorithm for the LinSPP d , thus providing the first (polynomial time) algorithm for this problem.Note that the running time of the proposed algorithms is linear in the input size for both problems, LinQSPP and LinSPP d , respectively.
Finally, we also obtain a polynomial time algorithm that given an acyclic digraph G computes a basis of the subspace of all linearizable degree-d cost functions on G.Such a basis can be used to obtain better linearization-based bounds usable in B&B algorithms.
The paper is organized as follows.After introducing some notations and preliminaries in Section 2 we present the result on the characterization of the linearizable QSPP and SPP d instances on acyclic input digraphs in Section 3. The algorithms for the linearization problems LinQSPP and LinSPP d are presented in Section 4. Section 5 deals with computing a basis of the subspace of all linearizable d-degree cost functions on an acyclic digraph G.

Notations and preliminaries
Given a digraph G = (V, A), a simple directed s-t-path P in G is specified as a sequence of arcs P = (a 1 , a 2 , . . ., a p ) such that a 1 starts at s, a p ends at t, nonconsecutive arcs do not share a vertex and the end vertex of a i coincides with the start vertex of a i+1 for any i ∈ {1, . . ., p − 1}.The number p of arcs in P is called the length of the path.We sometimes use the same notation for a path P and the set of its arcs.We consider a single arc (x, y) as an x-y-path of length 1 and a single vertex x as a trivial x-x-path of length 0. Given an x-y-path P 1 and a y-z-path P 2 , we denote the concatenation of P 1 and P 2 by P 1 • P 2 .We also consider concatenations of paths and arcs, that is, terms of the form P • a for some x-y-path P and some arc a = (y, z).
In the linearization problem, we are concerned with acyclic digraphs G = (V, A) with a source vertex s and a sink vertex t.We denote by P st the set of all simple directed s-t-paths.We often assume that G is P st -covered, that is, every arc in G is traversed by at least one path in P st .It is easy to see that this assumption can be made without loss of generality.
Let d ≥ 2 be a natural number.The Order-d interaction costs are given by a mapping q d : {B ⊆ A : |B| ≤ d} → R, assigning a (potentially negative) interaction cost to every subset of at most d arcs.The cost SPP d (P, q d ) of some path P under interaction costs q d is defined as in equation ( 2).If d is unambiguously clear form the context, we use the more compact notation f q (P ) := SPP d (P, q d ).
In this paper we explicitly allow the case q(∅) = 0, because this simplifies the calculations.The linearization problem for the Order-d Shortest Path Problem (LinSPP d ) is formally defined as follows.
Problem: The linearization problem for the SPP d (LinSPP d ) Question: Find a linearizing cost function c : A → R such that SPP d (P, q d ) = SPP(P, c) for all P ∈ P st or decide that such a linearizing cost function does not exist.
In the special case d = 2, we obtain the linearization problem for the QSPP (LinQSPP).
Finally, let us consider the Generic Shortest Path Problem (GSPP) which takes as input a digraph G = (V, A) with a source vertex s, a sink vertex t, s = t, and a generic cost function f : P st → R assigning a cost f (P ) to every path P ∈ P st 5 We assume w.l.o.g. that G is P st -covered.The goal is to find an s-t-path which minimizes the objective function f (P ) over P st .A linearizable instance of the GSPP and the linearization problem for the GSPP (LinGSPP) are defined analogously as in the respective definitions for SPP d .

A characterization of linearizable instances of the GSPP on acyclic digraphs
The main result of this section is Theorem 1, our novel characterization of linearizable instances of the GSPP on acyclic digraphs defined as in Section 2.
Definition 2. Let G = (V, A) be a P st -covered acyclic digraph.For some vertex v, let P 1 , P 2 be two s-v-paths, and let The system is called linearizable with respect to the function f : See Figure 1 for an illustration of a two-path system.Note that P 1 and P 2 (as well as Q 1 and Q 2 ) can have common inner vertices and that the cases paths P i and Q j have only the vertex v in common for i, j ∈ {1, 2}.Further, observe that the linearizability of a two-path system is a local property, in the sense that it only depends on the four paths Indeed, the following simple characterization holds.
Proof.First, assume that (v, P 1 , P 2 , Q 1 , Q 2 ) is linearizable and let c be the corresponding linearizing cost function.Let M 1 (M 2 ) be the multiset resulting from the union of the sets of the arcs of the paths follows from the definition of the linearizability of (v, Assume now that Equation ( 3) is true.We show the linearizability of the two-path system with respect to f by constructing a linearizing cost function c.It is easy to find a suitable c if P 1 = P 2 or Q 1 = Q 2 .So let us consider the more general case where P 1 = P 2 and Q 1 = Q 2 .In this case, for each P ∈ {P 1 , P 2 , Q 1 , Q 2 } there exists a so-called representative arc a ∈ P such that a is not contained in any other path e 1 , e 2 be the representative arcs of P 1 , P 2 , Q 1 and Q 2 , respectively.Consider now a cost function c : A → R, such that c(a) = 0 if a ∈ {a 1 , a 2 , e 1 , e 2 }, and c(a 1 ), c(a 2 ), c(e 1 ), c(e 2 ) fulfill the following linear equations: Using basic linear algebra, one can see that this system indeed has a solution whenever Equation ( 3) holds (there is even a solution with c(e 2 ) = 0).Thus, c constructed as above is a linearizing cost function for (v, Now, consider an instance of the GSPP with a P st -covered acyclic digraph G, with a source vertex s, a sink vertex t and a generic cost function f : P st → R. When is this instance (G, s, t, f ) linearizable?Obviously, if G contains a twopath system which is not linearizable with respect to f , then (G, s, t, f ) is not linearizable.The following theorem shows that the linearizability of each twopaths system with respect to f is a sufficient condition for (G, s, t, f ) being linearizable.
Theorem 1.Let G be a P st -covered acyclic digraph with a source vertex s and a sink vertex t and let f : P st → R be a generic cost function.Then the instance (G, s, t, f ) of the GSPP is linearizable if and only if every two-path system contained in G is linearizable with respect to f .Before proving the theorem, we need some preparation.Let G = (V, A) be a P st -covered acyclic digraph with source vertex s and sink vertex t.First we introduce a topological arc order as a total order on A such that for any pair of arcs a, a ′ in A the following holds: if there exists a path P containing both a and a ′ such that a comes before a ′ in P , then a a ′ .It is easy to see that any acyclic digraph has a (in general non-unique) topological arc order.Moreover, a topological arc order can be obtained from a topological vertex order.
Further, we recall the definition of a system of nonbasic arcs introduced by Sotirov and Hu [12].Definition 3. Let G be a P st -covered acyclic digraph with a source vertex s and a sink vertex t.A set N ⊆ A is called a system of nonbasic arcs, iff for every vertex v ∈ V \ {s, t} exactly one of the arcs starting at v is contained in N .The latter arc is called the nonbasic arc of v.An arc a ∈ A \ N is called basic.Obviously, the system of nonbasic arcs is not unique.Any such system forms an in-tree rooted at t containing all the vertices in V except for s.For some system of nonbasic arcs N and some vertex v ∈ V \ {s}, we let N v denote the unique v-t-path consisting of nonbasic arcs (where N t is the trivial path).A cost function c : A → R is called in reduced form with respect to N , if c(a) = 0 for all nonbasic arcs a ∈ N .The following lemma is an easy adaption from [12], where an analogous statement was proven for the less general case of the QSPP instead of the GSPP (details are provided in the full version of this paper).
Lemma 1 (adapted from [12,Prop. 4]).Let G be a P st -covered acyclic digraph with a source vertex s and a sink vertex t.Let f : P st → R be a generic cost function and let N ⊆ A be a fixed system of nonbasic arcs.If (G, s, t, f ) is a linearizable instance of the GSPP, then there exists one and only one linear cost function c : A → R which is both a linearizing cost function and in reduced form.
Let (G, s, t, f ) be a linearizable instance of the GSPP with G = (V, A) and N ⊆ A be a fixed system of nonbasic arcs.For a linearizing cost function c : A → R, we denote by reduced(c) the unique linearizing cost function in reduced form (which exists due to Lemma 1).It follows from the arguments in the proof of Lemma 1 that for given c one can compute reduced(c) in O(n + m) time.We are now ready to sketch the proof of our main theorem.

Proof (Sketch of the proof of Theorem 1).
The necessity of the conditions for linearizability is trivial.Now we prove the sufficiency.Thus we assume that every two-path system is linearizable with respect to f and show that (G, s, t, f ) is linearizable.Let N be a system of nonbasic arcs.The main idea is to find a linearizing cost function which is in reduced form, i.e., which has value 0 on all nonbasic arcs.To this end we consider a topological arc order on the set A of arcs in G and inductively define a linearizing cost function c : A → R as follows.For any arc a = (u, v) set for some s-u-path P .Consider now the following claim the proof of which is omitted for brevity.Claim: If all two-path systems in G are linearizable with respect to f , then function c in Equation ( 4) is well-defined and independent of the concrete choice of P .Moreoever, the following equation holds for all s-u-paths P : Observe that the claim immediately implies that (G, s, t, f ) is linearizable.Indeed, let c be the cost function defined in Equation ( 4) and let Q be some s-t-path.Choose a = (x, t) to be the last arc on Q.Then N t is the trivial path from t to t, so by applying Equation ( 5) to the arc a, we have Since in general a graph contains exponentially many different two-path systems, Theorem 1 does not seem to lead to an efficient algorithm for the linearization problem LinGSPP at a first glance.However, we show in the next section that this is indeed the case.The arguments are based on a more technical version of Theorem 1 and involve the concept of so-called strongly basic arcs and their property (π) defined below.Definition 4. Let G = (V, A) be an acyclic P st -covered digraph with source vertex s and sink vertex t.Let f : P st → R be a generic cost function and let N ⊆ A be a system of nonbasic arcs in G.A basic arc (u, v) is called strongly basic, if it is not incident to the source vertex, that is if u = s.A strongly basic arc a = (u, v) has the property (π), if for any s-u-paths P the value val(a, Thus, if a strongly basic arc a = (u, v) has the property (π), we have val(a, P ) = val(a, Q) for any two s-u-paths P, Q and this implies the existence of a value val(a) := val(a, P ) for each s-u-path P and val(a) is well defined for each strongly basic arc.Finally, we set val(a) := f (a • N v ) for each basic arc a = (s, v).
Lemma 2. Let G = (V, A) be an acyclic P st -covered digraph with source vertex s and sink vertex t.Let f : P st → R be a generic cost function and let N ⊆ A be a system of nonbasic arcs in G. Then (G, s, t, f ) is linearizable if and only if every strongly basic arc has the property (π).In this case, the mapping c : A → R given by c(a) = val(a); a is basic 0; a is nonbasic is a linearizing cost function in reduced form Proof.Let a = (u, v) be a strongly basic arc.We claim that a has the property (π) iff for any two s-u-paths P , Q the two-path system (u, P, Q, N u , a • N v ) is linearizable with respect to f .Indeed, note that by Proposition 1, the two-path system above is linearizable with respect to The latter equation is equivalent to val(a, Q) = val(a, P ).
Recalling that the latter equality holds for every pair of P, Q iff a has the property (π) completes the proof of the claim.Now, assume that some strongly basic arc (u, v) does not have the property (π).Then, the corresponding two-path system (u, P, Q, N u , a • N v ) is not linearizable with respect to f and therefore, (G, s, t, f ) is not linearizable.
Finally, assume that every strongly basic arc has the property (π).In the proof of Theorem 1 we use the linearizability assumption only for specific twopath systems of the form (u, P, Q, N u , a • N v ), where a = (u, v) is some strongly basic arc.Thus, if the property (π) holds for all strongly basic arcs, then each such specific two-path system is linearizable with respect to f and the linearizability of (G, s, t, f ) follows.Furthermore, the value c(a) of the linearizing cost function in Equation ( 4) equals val(a) for any arc a which is either strongly basic or incident to s, while c(a) = 0 for any nonbasic arc a. ⊓ ⊔

A linear time algorithm for the LinSPP d
In this section, we describe an algorithm which solves the linearization problem for SPP d (LinSPP d ) in O(m d ) time, i.e., in linear time.The algorithm uses the relationship between the LinSPP d and the All-Paths-Equal-Cost Problem (APECP) which we introduce in Section 4.1.In Section 4.2 we describe the SPP d algorithm and discuss its running time.

The All Paths Equal Cost Problem of Order-d (APECP d )
The All Paths Equal Cost Problem of Order-d (APECP d ) is defined as follows.
Problem: ALL PATHS EQUAL COST of Order-d (APECP d ) Instance: An acyclic P st -covered directed graph G = (V, A) with a source vertex s and a sink vertex t, an integer d ≥ 1; an order-d cost function Question: Do all s-t-paths have the same cost, i.e. is there some β ∈ R such that SPP d (P, q d ) = β for every path P in P st ?
In the following we establish a connection between the LinSPP d and the APECP d−1 for d ≥ 2.More precisely, we show in Lemma 3 that an instance (G, s, t, q d ) of the LinSPP d with an acyclic P st -covered digraph G = (V, A) can be reduced to O(m) instances of APECP d−1 , each of them corresponding to exactly one strongly basic arc with respect to some fixed system of nonbasic arcs (see Definitions 3 and 4).The APECP d−1 instance corresponding to a strongly basic arc a = (u, v) is defined as follows.
Definition 5.The instance I (a) of the APECP d−1 corresponding to the strongly basic arc a = (u, v) takes as input the digraph G (a) = (V u , E u ) with source vertex s ′ = s, sink vertex t ′ = u, where V u is the set of vertices in lying on at least one s-u-path and A u is the set of arcs in A lying on at least one s-u-path.The order-(d − 1) cost function q (a) Lemma 3. Let d ≥ 2 and let (G, s, t, q d ) be an instance of the LinSPP d with a fixed system of nonbasic arcs N .The APECP d−1 instance I (a) corresponding to some strongly basic arc a is a YES-instance iff the arc a has the property (π) with respect to f : P st → R given by f (P ) = SP P d (P, q d ) for P ∈ P st .In this case, val(a) = β, where β is the common cost of all paths in the APECP d−1 instance.
Proof (Sketch).Let a = (u, v) ∈ A be a strongly basic arc and let P be some s-u-path in G. Then P is contained in the graph G a = (V u , A u ).It can be shown that val(a, P ) = f (P where f (a) (P ) = SP P d−1 (P, q (a) d−1 ) for any s-u-path P in G.We conclude that the value val(a, P ) is independent of P , if and only if for every path the quantity f (a) (P ) does not depend on P .The latter condition is equivalent to I (a) being a YES-instance.Furthermore, if this is the case, then val(a) = f (a) (P ) for any s-u-path P .
⊓ ⊔ Lemmas 2 and 3 imply that an instance (G, s, t, q d ) of the SPP d with an acyclic digraph G is linearizable iff each instance I (a) of the APECP d−1 corresponding to some strongly basic arc a (with respect to some fixed system of nonbasic arcs) is a YES-instance.Thus, an instance of the LinSPP d can be reduced to O(m) instances of the APECP d−1 .Next, in Lemma 4 we show that each instance of the APECP d−1 can be reduced to an instance of the LinSPP d−1 .First, we define a specific cost function as follows.
Definition 6.Let G = (V, A) be a P st -covered acyclic digraph and β ∈ R. The function source β : A → R assigns cost β to every arc incident to the source s, and 0 to all other arcs.
Lemma 4. Let G = (V, A) be a P st -covered acyclic digraph with source vertex s and sink vertex t and let N ⊆ A a fixed system of nonbasic arcs.Let q d be an order-d cost function.The instance (G, s, t, q d ) of the APECP d problem is a YES-instance iff the instance (G, s, t, q d ) of SPP d is linearizable and source β is its unique linearizing function in reduced form (with respect to N ).
Proof.Clearly, source β is a linearizing function iff all paths have the same cost β.Furthermore, observe that all arcs incident to the source do not belong to N .Therefore source β is in reduced form with respect to N .In fact, by Lemma 1 source β is the unique linearizing functions in reduced form, and reduced(c ′ ) = source β for all other linearizing functions c ′ .⊓ ⊔

The linear time LinSPP d algorithm
Our LinSPP d algorithm A works as follows.Consider an instance (G, s, t, q d ) of the LinSPP d with an acyclic P st -covered digraph G, with source vertex s, sink vertex t and order-d cost function q d .We first fix some system of nonbasic arcs N and construct the instance I (a) of the APECP d−1 problem given in Definition 5 for each strongly basic arc a.Then, we check each instance I (a) for being a YESinstance and do this by reducing I (a) to an instance of LinSPP d−1 according to Lemma 4. By iterating this process we eventually end up with APECP problems of degree 1 that can be easily solved by dynamic programming.The dynamic program is based on the fact that in a P st -covered acyclic digraph with a cost function f : P st → R all s-t-paths have the same cost iff for every vertex v all s-v-paths have the same cost.It is not hard to implement the algorithm described above in O(d 2 m d+1 ) time.With a careful implementation it is possible to achieve a better result.
Theorem 2. The LinSPP d on acyclic digraphs can be solved in O(d 2 m d ) time.
For the sake of brevity we refer to the full version of the paper for the proof of the theorem.Here we just point out the necessity of an efficient computation of the I (a) instances for all strongly basic arcs as defined in Definition 5.To this end we efficiently compute the values for all sets B ⊆ A of arcs with |B| ≤ d − 1 and all vertices x ∈ V \ {s}.These values are then used to efficiently compute the cost functions q (a) d−1 in Equation (6).Further, with a careful management of the quantities involved in the computation of the linearizing functions (see Lemma 4) we obtain a linear time algorithm.Note that the input size required to encode the cost function ) is linear in the input size and hence optimal if d is considered a constant, like for example in the QSPP.

The subspace of linearizable instances
Let d ∈ N, d ≥ 2, and a P st -covered acyclic digraph G = (V, A) with source vertex s and sink vertex t be fixed.Let H (d) := {B ⊆ H | |B| ≤ d} be the set of all subsets of at most d arcs in arc set H ⊆ A. Every order-d cost function q d : A (d) → R can be uniquely represented by a vector x ∈ R A (d) with q d (F ) = x F for all F ∈ A (d) , and vice-versa.Thus, each instance (G, s, t, q d ) can be identified with the corresponding vector x ∈ R A (d) and we will say that x ∈ R A (d) is an instance of the SPP d .It is straightforward to see that the linearizable instances of the SPP d on the fixed digraph G form a linear subspace L d of R A (d) .
Methods to compute this subspace are useful in B&B algorithms for the SPP d as they can be applied to compute better lower bounds along the lines of what Hu and Sotirov [12] did for general quadratic binary programs.Hu and Sotirov showed that for d = 2 a basis of L d can be computed in polynomial time [12,Prop. 5].We extend their result to the case d > 2.
Theorem 3. Let G = (V, A) be a P st -covered, acyclic digraph with source vertex s and sink vertex t and let d ∈ N be a constant.A basis of the subspace L d of the linearizable instances of the SPP d can be computed in polynomial time.
Proof (Sketch).The proof idea is to specify a k ∈ N and a matrix M of polynomially bounded dimensions, such that for f : R A (d) → R k with f (x) = M x, we have: f (x) = 0 iff x is a linearizable instance of the SPP d .Thus, the linearizable instances x of the SPP d form ker(M ) which can be efficiently computed.
The construction of M is done iteratively and exploits the relationship between SP P d and AP ECP d−1 similarly as in the algorithm A from Section 4.2.In particular we use the following two facts: (i) For each strongly basic arc a = (u, v), the function which maps x ∈ R A (d) to q Using (i) and (ii) iteratively as in algorithm A, we show by induction that for each strongly basic arcs a = (u, v) and each d ≥ 2 there exist k a ∈ N and a linear function g a : R A (d−1) u → R ka s.t.g a (x) = 0 iff if x corresponds to a YES-instance of APECP d−1 .Then we construct the linear function g ′ a on the same domain as g a , by setting g ′ a (x) = β whenever g a (x) = 0, where β is the common path cost of the corresponding instance x of APECP d−1 .Next we show that for each vertex u there exists a k u ∈ N and a linear function f u : R A (d−1) u → R ku such that f u (x) = 0 iff x is a linearizable instance of SPP d−1 corresponding to APECP d−1 (see Lemma 4).Then we construct the linear function f ′ u on the same domain as f u by setting f ′ u (x) equal to the linearizing cost function of the instance x of the SPP d−1 whenever x is linearizable (i.e. when f u (x) = 0).The construction of M is done be repeating these steps iteratively until d = 1.One can ensure that the size of the matrix representations of all involved functions stays polynomial.⊓ ⊔

→
R is linear (see Equation(6) and recall Definition 5 for A u ).(ii)The function c → reduced(c) (defined after Lemma 1) is linear.