Generalized Parametric Path Problems
Prerona Chatterjee, Kshitij Gajjar, Jaikumar Radhakrishnan, Girish Varma
GGeneralized Parametric Path Problems
Prerona Chatterjee * Kshitij Gajjar † Jaikumar Radhakrishnan ‡ Girish Varma § February 26, 2021
Abstract
Parametric path problems arise independently in diverse domains, ranging from trans-portation to finance, where they are studied under various assumptions. We formulate a gen-eral path problem with relaxed assumptions, and describe how this formulation is applicablein these domains.We study the complexity of the general problem, and a variant of it where preprocessing isallowed. We show that when the parametric weights are linear functions, algorithms remaintractable even under our relaxed assumptions. Furthermore, we show that if the weights areallowed to be non-linear, the problem becomes NP -hard. We also study the mutli-dimensionalversion of the problem where the weight functions are parameterized by multiple parameters.We show that even with 2 parameters, the problem is NP -hard. Parametric shortest path problems arise in graphs where the cost of an edge depends on a pa-rameter. Many real-world problems lend themselves to such a formulation, e.g., routing in trans-portation networks parameterized by time/cost [Car83, Dea04, FHS14], and financial investmentand arbitrage networks [HP14, Hau14, Moo03]. Path problems have been studied independentlyin these domains, under specific assumptions that are relevant to the domain. For example, theTime-Dependent Shortest Path (TDSP) problem used to model transportation problems assumesa certain FIFO condition (Definition 2.1). Arbitrage problems only model the rate of conversion * Tata Institute of Fundamental Research, Mumbai, India. Email: [email protected] . Research supported bythe Department of Atomic Energy, Government of India, under project number RTI4001. † Technion - Israel Institute of Technology, Haifa, Israel. Email: [email protected] . This project hasreceived funding from the European Union’s Horizon 2020 research and innovation programme under grant agreementNo. 682203-ERC-[Inf-Speed-Tradeoff]. ‡ Tata Institute of Fundamental Research, Mumbai, India. Email: [email protected] . Research supported bythe Department of Atomic Energy, Government of India, under project number RTI4001. § International Institute of Information Technology Hyderabad, India. Email: [email protected] . a r X i v : . [ c s . D S ] F e b c o s t o f s - t p a t h P P s t a x + b a x + b a x + b a x + b a x + b a x + b c x + d c x + d c x + d c x + d c x + d c x + d Figure 1: (Left) Graph of a GPP instance whose edge weights are linear functions of a parameter x . (Right) A plotof x versus the costs of all possible s - t paths P , . . . , P . All 6 cost functions are linear because the composition oflinear functions is linear. For example, the cost of P is a ( a ( c ( c x + d ) + d ) + b ) + b . The table for GPP withpreprocessing (PGPP) with L = − and are defined with respect to a single currency parameter. These assumptions reduce the appli-cability of such algorithms to other domains.We propose a generalized model for parametric path problems with relaxed assumptions, giv-ing rise to an expressive formulation with wider applicability. We also present specific instancesof real-world problems where such generalized models are required (see Section 2). Definition 1.1.
The input to a Generalized Path Problem (GPP) is a -tuple ( G , W , L , x ) , where • G = ( V ∪ { s , t } , E ) is a directed acyclic graph with two special vertices s and t; • W = (cid:8) w e : R k → R k : e ∈ E (cid:9) is a set of weight functions on the edges of G; • L ∈ R k is a vector used for computing the cost of a path from the k parameters; • x ∈ R k is a vector used to denote the initial values of the k parameters.Sometimes we ignore the x and denote the GPP instance as ( G , W , L ) . ♦ The aim in a GPP is to find an s - t path that maximizes the dot product of L with the composition of the weight functions along the path, evaluated at the initial parameter x . Problem 1.2 (Generalized Path Problem (GPP)) . Input:
An instance ( G , W , L , x ) of GPP. Output:
Find an s-t path P = ( e , · · · , e r ) which maximizes L · w e r ( w e r − ( · · · w e ( w e ( x )) · · · )) . Whenk = , we call the GPP a scalar GPP.
Scalar GPP models shortest paths by choosing weights w e ( x ) = a e · x + b e and fixing L = −
1, toconvert it to a minimization problem. Scalar GPP also models currency arbitrage problems [HP14,2LRS09], where the cost of a path is the product of its edge weights, by choosing weight functionsto be lines passing through the origin whose slope is equal to the rate of conversion.Further, GPP can model more general path problems which involve multiple parameters to beoptimized. For example, in transport networks, one needs to find a path that optimizes parame-ters like time traveled, cost of transportation, convenience, polluting emissions, etc. [KVP20]. Infinance problems, an entity can have investments in different asset classes like cash, gold, stocks,bonds, etc., and a transaction, modeled by an edge, can affect these in complex ways (see moreexamples in Section 2). The edge parameters could contribute additively or multiplicatively to thecost of the path. We study weight functions that are affine linear transformations, which allowsfor both of these.Note that the optimal path can vary based on the initial parameter x . We consider a versionof GPP with preprocessing (called PGPP), where we can preprocess the inputs ( G , W , L ) and storethem in a table which maps the initial values x to their optimal paths. Such a mapping is veryuseful in situations where the underlying network does not change too often and a large amountof computing power is available for preprocessing (e.g., the road map of a city typically does notchange on a day-to-day basis). If the size of the table is manageable, it can be saved in memory anda query for an optimal path for a given x can be answered quickly using a simple table lookup. Problem 1.3 (GPP with Preprocessing (PGPP)) . Input:
An instance ( G , W , L , ∅ ) of GPP. Output:
A table which maps x to optimal paths. We present an efficient algorithm for scalar GPP with linear weight functions. On the otherhand, we show that if the GPP instance is non-scalar or the weight functions are non-linear, algo-rithms with worst-case guarantees cannot be obtained, assuming P (cid:54) = NP .Our algorithm is based on the Bellman-Ford-Moore algorithm [Bel58, FJ56, Moo59] whereasour NP -hardness reductions are from two well-known NP -hard problems, namely S ET P ARTITION and P
RODUCT P ARTITION .The results for GPP with preprocessing (PGPP) are much more technical since they involveproving upper and lower bounds on the number of discontinuities of the cost of the optimalpath as a function of the initial parameter x . They generalize previously known results in Time-Dependent Shortest Paths (TDSPs) by Foschini et al. [FHS14]. Their work crucially uses the FIFOproperty (Definition 2.1), whereas our analysis does not make this assumption, giving a moregeneral result. We have five results. In Section 2, we give specific instances from transportation and finance wherethese results can be applied. 3. There is an efficient algorithm for scalar GPP with linear weight functions (see Section 3).2. Scalar PGPP with linear weight functions has a quasi-polynomial sized table, and thus tableretrieval can be performed in poly-logarithmic time (see Section 4).3. Scalar GPP with piecewise linear or quadratic weight functions is NP -hard to approximate(see Section 5).4. For scalar PGPP with piecewise linear or quadratic weight functions, the size of the tablecould be exponential (see Section 6).5. Non-scalar GPP (GPP with k >
1) is NP -hard (see Section 7). We relate scalar GPP to an extensively well-studied problem, known as Time-Dependent ShortestPaths (TDSPs) in graphs, which comes up in routing/planning problems in transportation net-works [Dea04, DOS12, FHS14].In the TDSP setting, the parameter x denotes time, and the weight w e ( x ) of an edge e = ( A , B ) denotes the arrival time at B if the departure time from A is x . If there is another edge e (cid:48) = ( B , C ) connected to B , then the arrival time at C along the path ( A , B , C ) is w e (cid:48) ( w e ( x )) , and so on. Thus,the cost of an s - t path is the arrival time at t as a function of the departure time from s . Definition 2.1.
We say that an edge e is FIFO if its weight is a monotonically increasing function, i.e.,x ≤ x ⇐⇒ w e ( x ) ≤ w e ( x ) ∀ x , x . We say that a graph has the FIFO property if every edge of the graph is FIFO. ♦ The study of TDSPs can be traced back to the work of Cooke & Halsey [CH66], where thequeries were made in discrete time steps (e.g., once every thirty minutes). Dreyfus [Dre69] gave apolynomial time algorithm for this setting when the graph satisfied the FIFO property. These re-sults were subsequently extended to non-FIFO networks by Orda & Rom [OR90], and generalizedfurther by Ziliaskopoulos & Mahmassani [ZM93].Dean [Dea04] summarised results on TDSPs for FIFO networks with linear edge weights.Dehne, Omran & Sack [DOS12] presented an algorithm for TDSPs in this setting whose runningtime was at most the table size of the PGPP instance (Problem 1.3). Soon thereafter, Foschini, Her-shberger & Suri [FHS14] showed that the table size is at most n O ( log n ) , and that this is optimal,conclusively solving the problem for FIFO networks. We show that their bounds also hold fornon-FIFO networks. 4 v Before 5 pm p qu B A v
After 5 pm p qu B
Departure time ( x ) from A A rr i v a lti m e ( w e ( x ) ) a t B Figure 2:
An illustration of how Braess’ paradox can lead to a non-FIFO edge weight function. The plot denotes w e ( x ) for a single edge e = ( A , B ) of a graph. There are three routes from A to B , namely A - p - v - B , A - u - q - B , and A - u - v - B . The roads A - p - v and u - q - B are quite lengthy, and thus the road linking u to v is preferable for a journey from A to B .Before 5 pm, the u - v link is available, which leads to traffic congestion on the route A - u - v - B . Once the u - v link closes at5 pm, the traffic splits equally on the two routes A - p - v - B and A - u - q - B , reducing the congestion. This leads to a drop inthe travel time just around 5 pm, in accordance with Braess’ paradox. During that brief interval, those departing from A after 5 pm can reach B earlier than those departing from A before 5 pm, as the plot indicates. Hence, e is not FIFO(Definition 2.1). Example: Braess’ Paradox.
The FIFO assumption makes sense because it seems that leavingfrom a source at a later time might not help one reach their destination quicker. However, some-what counter-intuitively, Braess [Bra68] observed that this need not always the case, in whatis now popularly known as Braess’ paradox (Figure 2 shows an example of Braess’ paradox).Steinberg & Zangwill [SZ83] showed that Braess’ paradox can occur with a high probability.Rapoport et al. [RKDG09] backed their claim with empirical evidence. There have been severalreal-world instances where shutting down a road led to a decrease in the overall traffic conges-tion. Some known examples are Stuttgart [Mur70] and Seoul [EK10, Page 71].
Financial domain problems have been modelled as graph problems before [DP14, KB09, Ebo13,BAA14, Att19]. We model the currency arbitrage problem [Ros77, SV97, DS06] as a GPP. In thecurrency arbitrage problem, we need to find an optimal conversion strategy from one currency toanother via other currencies, assuming that all the conversion rates are known.
Example: Multi-currency Arbitrage.
GPP can model generalized multi-currency arbitrage prob-lems. In currency arbitrage, an entity can have money available in different currencies and en-gage in transactions (modeled by edges) which changes the wealth composition in complicatedways [Moo03]. The transaction fees could have fixed as well as variable components dependingupon the amount used. This can be modelled by affine linear transformations. Eventually the5ntity might liquidate the money in all the currencies to a single currency, which can be mod-elled by the vector L in the GPP instance. The goal is to pick a sequence of transactions such thatmaximizes the cash after liquidation. Hence this naturally lends itself to a GPP formulation. Example: Investment Planning.
GPP can model investment planning, by considering the nodesof the graph to be the state of the individual which could be qualifications, contacts, experience,influence, etc. At any given state, the individual will have a set of investment opportunities whichare represented by directed edges. For every edge which represent an investment opportunity,there is a weight function, which models the return as a function of the capital invested. Sup-pose the individual had y money initially and he/she made investments with returns functions r ( x ) , r ( x ) , then he/she will have r ( r ( y )) money finally.Though a generic investment plan could allow multiple partial investments, there are caseswhere its not possible. For example, the full fees needs to be paid up front for attending a pro-fessional course or for buying a house, which motivates restricting to investment plans given bypaths. The vertices s , t denote the start and end of an investment cycle. Given this setting, theoptimal investment strategy is an s - t path in the graph, such that the composition of functionsalong the path, applied to the initial investment, is maximized. In this section, we present our algorithm (algorithm 1) for scalar GPP with linear weight functions.Formally, we show the following.
Theorem 3.1.
There exists an algorithm that takes as input a scalar GPP instance ( G , W , L , x ) (where Ghas n vertices, m edges, and w e ( x ) = a e · x + b e for every edge e of G), and outputs an optimal s-t path inG in O ( mn ) running time. Our algorithm is similar to the Bellman-Ford-Moore algorithm [Bel58, FJ56, Moo59]. The onlysubtlety in our case is that we need to keep track of both the minimum and maximum cost pathswith at most k edges from the start vertex s to every vertex v , as k varies from 1 to n . The variables p max , p min act as parent pointers for the maximum cost path and the minimum cost path treerooted at s . r max , r min stores the cost of the maximum and minimum cost path. The running time ofalgorithm 1 is clearly O ( mn ) , the same as the running time of the Bellman-Ford-Moore algorithm.Its correctness follows from the following observation. Observation 3.2.
If e = ( u , v ) is the last edge on a shortest (longest) s-v path, then its s-u subpath iseither a shortest s-u path or a longest s-u path, depending on whether a e (the coefficient of x in w e ) ispositive (negative) or negative (positive). LGORITHM 1:
GPP with linear weight functionsFor v ∈ V \ { s } , r max ( v ) = − ∞ , r min ( v ) = ∞ ; r max ( s ) = r min ( s ) = x ; for k ← to n − dofor e = ( u , v ) ∈ E doif a e ≥ thenif r max ( v ) < w e ( r max ( u )) then r max ( v ) ← w e ( r max ( u )) , p max ( v ) ← u ; endif r min ( v ) > w e ( r min ( u )) then r min ( v ) ← w e ( r min ( u )) , p min ( v ) ← u ; endelseif r max ( v ) < w e ( r min ( u )) then r max ( v ) ← w e ( r min ( u )) , p max ( v ) ← u ; endif r min ( v ) > w e ( r max ( u )) then r min ( v ) ← w e ( r max ( u )) , p min ( v ) ← u ; endendendendOutput : The sequence ( t , p max ( t ) , p max ( p max ( t )) , . . . , s ) in reverse is the optimal path with cost r max ( t ) . Then, the argument is similar to the proof of the Bellman-Ford-Moore algorithm, using theoptimal substructure property. Our algorithm can also handle time constraints on the edges whichcan come up in transport and finance problems. For example, each investment (modelled by anedge) could have a scalar value, which denotes the time taken for it to realize. The goal is to findan optimal sequence of investments (edges) from s to t , such that the sum of times along the pathis at most some constant T . We can reduce such a problem to a GPP with a time constraint asfollows.Replace each edge e by a path of length t e , where t e is the time value associated with e . Theweight function for the first edge is simply w e ( x ) and for the other t e − T instead of n − In this section, we study scalar PGPP (linear edge weights with L = − s - t paths (for different values of x ∈ ( − ∞ , ∞ ) ) is at most quasi-polynomial in n . In PGPP (Problem 1.3), we compute all possible shortest s - t paths in the graphand store them a table of quasi-polynomial size.More precisely, if ( G , W , L ) is a GPP instance (where G has n vertices and w e ( x ) = a e · x + b e e of G ), then we show that the number of shortest s - t paths in G is at most n O ( log n ) .(For the example in Figure 1, this number is 4.) Since the entries of this table can be sorted bytheir corresponding x values, a table lookup to retrieve the shortest path for a queried x can beperformed using a simple binary search in log ( n O ( log n ) ) = O (( log n ) ) , or poly-logarithmic time.In our proof, we will crucially use the fact that the edge weights of G are of the form w e ( x ) = a e · x + b e . Although our result holds in more generality, it is helpful and convenient for our proofto think of the edge weights from a TDSP perspetive. That is, when travelling along an edge e = ( u , v ) of G , if the start time at vertex u is x , then the arrival time at vertex v is w e ( x ) .Since the edge weights are linear and the composition of linear functions is linear, the arrivaltime at t after starting from s at time x and travelling along a path P is also a linear function of x , called the cost of the path and denoted by cost ( P )( x ) . We show that the piecewise linear lowerenvelope (denoted by cost G ( x ) , indicated in pink in Figure 1) of the cost functions of the s - t pathsof G has n log n + O ( ) pieces. Let p ( f ) denote the number of pieces in a piecewise linear function f . Theorem 4.1.
Let P be the set of s-t paths in G. Then, the cost function of the shortest s-t path, given by cost G ( x ) = min P : P ∈P cost ( P )( x ) , is a piecewise linear function such thatp ( cost G ( x )) ≤ n log n + O ( ) .Before we can prove Theorem 4.1, we need some elementary facts about piecewise linear func-tions. Given a set of linear functions F , let F ↓ and F ↑ be defined as follows. F ↓ ( x ) = min f : f ∈ F f ( x ) F ↑ ( x ) = max f : f ∈ F f ( x ) In other words, F ↓ and F ↑ are the piecewise linear lower and upper envelopes of F , respectively. Fact 4.2 (Elementary properties of piecewise linear functions) . (i) If F is a set of linear functions, then F ↓ is a piecewise linear concave function and F ↑ is a piecewiselinear convex function.(ii) If f ( x ) and g ( x ) are piecewise linear concave functions, then h ( x ) = min { f ( x ) , g ( x ) } is a piece-wise linear concave function such that p ( h ) ≤ p ( f ) + p ( g ) .(iii) If f ( x ) and g ( x ) are piecewise linear functions and g ( x ) is monotone , then h ( x ) = f ( g ( x )) is apiecewise linear function such that p ( h ) ≤ p ( f ) + p ( g ) .Proof. These facts and their proofs are inspired by (and similar to) some of the observations madeby Foschini, Hershberger & Suri [FHS14, Lemma 2.1, Lemma 2.2].(i) Linear functions are concave (convex), and the point-wise minimum (maximum) of concave(convex) functions is concave (convex). 8ii) Each piece of h corresponds to a unique piece of f or g . Since h is concave, different piecesof h have different slopes, corresponding to different pieces of f or g .(iii) A break point is a point where two adjoining pieces of a piecewise linear function meet. Notethat each break point of h can be mapped back to a break point of f or a break point of g . As g is monotone, different break points of h map to different break points of g .We now prove the following key lemma. Lemma 4.3.
Let F and G be two sets of linear functions, and let H = { f ◦ g (cid:12)(cid:12) f ∈ F , g ∈ G } . ThenH ↓ ( x ) = min { F ↓ ( G ↓ ( x )) , F ↓ ( G ↑ ( x )) } ; (4.4) H ↑ ( x ) = max { F ↑ ( G ↓ ( x )) , F ↑ ( G ↑ ( x )) } ; (4.5) p ( H ↓ ) ≤ p ( F ↓ ) + p ( G ↓ ) + p ( G ↑ ) ; (4.6) p ( H ↑ ) ≤ p ( F ↑ ) + p ( G ↓ ) + p ( G ↑ ) . (4.7) Proof.
We will first show Equation 4.4. Since F is the set of outer functions, it is easy to see that H ↓ ( x ) = min g : g ∈ G F ↓ ( g ( x )) . (4.8)To get Equation 4.4 from Equation 4.8, we need to show that the inner function g that minimizes H ↓ is always either G ↓ or G ↑ . Fix an x ∈ R . We will see which g ∈ G minimizes F ↓ ( g ( x )) . Notethat for every g ∈ G , we have G ↓ ( x ) ≤ g ( x ) ≤ G ↑ ( x ) . Thus, the input to F ↓ is restricted to theinterval [ G ↓ ( x ) , G ↑ ( x )] . Since F ↓ is a concave function (Fact 4.2 (i)), it achieves its minimum ateither G ↓ ( x ) or at G ↑ ( x ) within this interval. This shows Equation 4.4.We will now show Equation 4.6 using Equation 4.4. Since G ↓ is a concave function, it hastwo parts: a first part where it monotonically increases and a second part where it monotonicallydecreases. In each part, the number of pieces in F ↓ ( G ↓ ( x )) is at most p ( F ↓ ) + p ( G ↓ ) (Fact 4.2 (iii)),which gives a total of 2 ( p ( F ↓ ) + p ( G ↓ )) . Similarly, since G ↑ is a convex function, it has two parts: afirst part where it monotonically decreases and a second part where it monotonically increases. Ineach part, the number of pieces in F ↓ ( G ↑ ( x )) is at most p ( F ↓ ) + p ( G ↑ ) (Fact 4.2 (iii)), which gives atotal of 2 ( p ( F ↓ ) + p ( G ↑ )) . Combining these using Equation 4.4 and Fact 4.2 (ii), we obtain p ( H ↓ ) ≤ ( p ( F ↓ ) + p ( G ↓ )) + ( p ( F ↓ ) + p ( G ↑ ))= p ( F ↓ ) + p ( G ↓ ) + p ( G ↑ ) .We skip the proof of Equation 4.5 and its usage to prove Equation 4.7 because it is along similarlines.Using this lemma, we complete the proof of Theorem 4.1.9 roof of Theorem 4.1. It suffices to prove the theorem for all positive integers n that are powers of2. Let a , b , v be three vertices of G and let k be a power of 2. Let P v ( a , b , k ) be the set of a - b paths P that pass through v such that the a - v subpath and the v - b subpath of P have at most k /2 edgeseach ( k is even number since it is a power of 2). Let P ( a , b , k ) be the set of a - b paths that have atmost k edges. Note that P ( a , b , k ) = (cid:83) v ∈ V P v ( a , b , k ) . Let f v ( a , b , k ) be the number of pieces in thepiecewise linear lower envelope or the piecewise linear upper envelope of P v ( a , b , k ) , whicheveris larger. Similarly, f ( a , b , k ) is the number of pieces in the piecewise linear lower envelope orthe piecewise linear upper envelope of P ( a , b , k ) , whichever is larger. Note that every path thatfeatures in the lower envelope of P ( a , b , k ) also features in the lower envelope of P v ( a , b , k ) , forsome v . Thus, f ( a , b , k ) ≤ ∑ v ∈ V f v ( a , b , k ) . (4.9)Since G has n vertices, P ( a , b , n ) is simply the set of all a - b paths. And since p ( cost G ( x )) is thenumber of pieces in the piecewise linear lower envelope of these paths, p ( cost G ( x )) ≤ f ( a , b , n ) .Thus it suffices to show that f ( a , b , n ) ≤ n log n + O ( ) . We will show, by induction on k , that f ( a , b , k ) ≤ ( n ) log k . The base case, f ( a , b , 1 ) ≤
1, is trivial. Now, let k > f v ( a , b , k ) ≤ ( f ( a , v , k /2 ) + f ( v , b , k /2 )) (4.10)Fix a vertex v ∈ V . By induction, f ( a , v , k /2 ) ≤ ( n ) log ( k /2 ) and f ( v , b , k /2 ) ≤ ( n ) log ( k /2 ) .Note that for every path P ∈ P v ( a , b , k ) , we have cost ( P )( x ) = cost ( P )( cost ( P )( x )) , where P ∈ P ( a , v , k /2 ) and P ∈ P ( v , b , k /2 ) . Thus we can invoke Lemma 4.3 with F , G and H asthe set of linear (path cost) functions corresponding to the paths P ( v , b , k /2 ) , P ( a , v , k /2 ) and P v ( a , b , k ) , respectively. Applying (Equation 4.6) and (Equation 4.7), we get f v ( a , b , k ) ≤ f ( v , b , k /2 ) + f ( a , v , k /2 ) + f ( a , v , k /2 ) ,which simplifies to Equation 4.10. Substituting Equation 4.10 in Equation 4.9, and using the factthat | V | = n , we get the following. f ( a , b , k ) ≤ ∑ v ∈ V ( f ( a , v , k /2 ) + f ( v , b , k /2 )) ≤ n (cid:16) ( n ) log ( k /2 ) + ( n ) log ( k /2 ) (cid:17) = ( n ) · · ( n ) log ( k /2 ) = ( n ) log k .Thus, f ( a , b , n ) ≤ ( n ) log n = n log n + . 10 Hardness of Scalar GPP with Non-Linear Weights
In this section, we show that it is NP -hard to approximate scalar GPP even if one of the edgeweights is made piecewise linear while keeping all other edge weights linear. Theorem 5.1.
Let ( G , W , L , x ) be a GPP instance with a special edge e ∗ , where G has n vertices andw e ( x ) = a e x + b e for every edge e ∈ E ( G ) \ { e ∗ } , and w e ∗ ( x ) is piecewise linear with 2 pieces. Then it is NP -hard find an s-t path that approximates the optimal s-t path in G to within a constant. Note that Theorem 5.1 implies that Problem 1.3 with piecewise linear edge weights is NP -hard. Proof of Theorem 5.1.
We reduce S ET P ARTITION , a well-known NP -hard problem [GJ79, Page 226]to scalar GPP. A similar reduction can be found in the work of Nikolova, Brand & Karger [NBK06,Theorem 3]. The S ET P ARTITION problem asks whether a given set of n integers A = { a , . . . , a n − } can be partitioned into two subsets A and A such that they have the same sum.We now explain our reduction. Let ε be the multiplicative approximation factor and δ be theadditive approximation term. Given a S ET P ARTITION instance A = { a , . . . , a n } , we multiply allits elements by the integer (cid:100) δ + (cid:101) . Note that this new instance can be partitioned into two subsetshaving the same sum if and only if the original instance can. Furthermore, after this modification,no subset of A has sum in the range [ − δ , δ ] , unless that sum is zero. Next, we define a graphinstantiated by the S ET P ARTITION instance.
Definition 5.2. G n is a directed, acyclic graph, with vertex ser { v , . . . , v n } . For every i ∈ {
0, . . . , n − } ,there are two edges from v i to v i + labelled by f and f . The start vertex s is v and the target vertex t isv n (see Figure 3). ♦ v f f v f f v f f v f f v Figure 3:
The graph G n for n = Consider the graph G n + . For every i ∈ {
0, 1, . . . , n − } , the edge from v i to v i + labelled by f has weight x + a i and the edge from v i to v i + labelled by f has weight x − a i . Both the edgesfrom v n to v n + have weight | x | . Let A be an algorithm which solves Problem 1.3. We will provide G n + and x = A , and show that A can be partitioned into two subsets having thesame sum if and only if A returns a path of cost 0. Definition 5.3.
Each path of G n (Figure 3) can be denoted by a string in {
0, 1 } n , from left to right. Forinstance, if n = and σ = ( ) , then the cost function f σ ( x ) of the path P σ is given byf σ ( x ) = f ( ) ( x ) = f ( f ( f ( f ( x )))) . 11 he innermost function corresponds to the first edge on the path P σ , and the outermost to the last. ♦ Let σ = ( σ σ · · · σ n − ) ∈ {
0, 1 } n . Let A be the subset of A with characteristic vector σ , and let A = A \ A . The cost of the path P σ (Definition 5.3) from v to v n is cost ( P σ )( x ) = x + n − ∑ i = ( − ) σ i a i = x + ∑ a i ∈ A a i − ∑ a i ∈ A a i .Now if we set the start time from vertex v as x = x =
0, then we obtain the following. cost ( P σ )( ) = = ⇒ ∑ a i ∈ A a i = ∑ a i ∈ A a i .Let OPT be a shortest path in G n + and Q be the path returned by A at start time x = x = v n to v n + (whose weight is | x | ) ensures that OPT ≥
0. So, if
OPT =
0, then cost ( Q )( ) ≤ ε · + δ = δ .Since every path of non-zero cost in G n + has cost more than δ , cost ( Q )( ) = OPT = OPT >
0, then
OPT ≥ (cid:100) δ + (cid:101) , and so A returns a path of cost more than δ . Thus, A canbe partitioned into two subsets having the same sum if and only if A returns a path of cost 0. Remark 5.4.
The proof of Theorem 5.1 also works if we change the weight of the last edge from | x | to x ,thereby implying that scalar GPP with polynomial edge weights is NP -hard even if one of the edge weightsis quadratic while all other edge weights are linear. ♦ In this section, we show that for the graph G n defined in the previous section (Definition 5.2), thetable size for PGPP (Problem 1.3) can be made exponential in n with a suitable choice of the weightfunctions f and f . Note that G n has exactly 2 n paths from s to t (Figure 3). We will show thateach of these paths is a shortest s - t path, for some value of x . Thus, there is a scalar GPP instancefor which the table size is 2 Ω ( n ) , needing log ( Ω ( n ) ) = Ω ( n ) time for a table lookup. Remark 6.1.
We show that it is not possible to retrieve the shortest s-t path in o ( n ) time (in the worst case)by storing all the shortest s-t paths in a lookup table. However, our proof does not rule out the existence ofan o ( n ) time query algorithm. In other words, there could be an algorithm that outputs the shortest s-t pathat a queried start time x in sublinear, possibly even poly-logarithmic, time. ♦ Our proof is by induction on n . All the edges labelled f have the same edge weight, and so doall the edges labelled f . Thus, although G n has 2 n edges, it has only two different edge weights.When composing functions, the output of one function becomes the input to the next. Thus, inorder to re-use the same two functions repeatedly, we design them in such a way that the functionsobtained after composition retain some of the properties as the original functions.12igure 4: The piecewise linear functions f , f defined in Theorem 6.4, satisfying the properties stated in Lemma 6.2. We define f and f such that they are bijective (in some specific intervals). Figure 4 showsone such choice of f and f . This bijective property enables us to show that the total numberof local minima in the compositions of these functions doubles every time n increases by one.See Appendix A for a visual depiction of the plots of the s - t paths in G n for n =
2, 3, 4, 5.We need some notation before we can proceed. For a function f : R → R , and a subset A ⊆ R ,if B ⊇ f ( A ) , then we denote by f | A : A → B , the function defined by f | A ( x ) = f ( x ) for every x ∈ A , also known as the restriction of f to A . Lemma 6.2.
Suppose f , f : R → R are functions such that their restrictionsf | [ ] : [
0, 1/3 ] → [
0, 1 ] , f | [ ] : [ ] → [
0, 1 ] are bijective . Further, suppose | f ( x ) | ≥ ∀ x ∈ ( − ∞ , 0 ] ∪ [ ∞ ) , | f ( x ) | ≥ ∀ x ∈ ( − ∞ , 1/3 ] ∪ [ ∞ ) . Then, for every n ≥ , there is a function α n : {
0, 1 } n → (
0, 1 ) such that(i) α n ( σ ) ∈ [
0, 1/3 ] if σ = ;(ii) α n ( σ ) ∈ [ ] if σ = ;(iii) For every σ , τ ∈ {
0, 1 } n , α n ( σ ) = α n ( τ ) ⇐⇒ σ = τ ;(iv) For every σ , τ ∈ {
0, 1 } n , f σ ( α n ( τ )) = ⇐⇒ σ = τ . roof. As stated earlier, our proof is by induction on n . For the base case ( n = α ( ) = ( f | [ ] ) − ( ) and α ( ) = ( f | [ ] ) − ( ) .First we check if α is well-defined and its range lies in (
0, 1 ) . To see that α ( ) and α ( ) are well-defined, note that the inverses of the functions f | [ ] and f | [ ] are well-defined because theyare bijective. To see that the range of α lies in (
0, 1 ) , note that for x ∈ {
0, 1 } , we have | f ( x ) | ≥ | f ( x ) | ≥
1, implying that they are both non-zero. Thus, 0 < α ( x ) < α n satisfies (i), (ii), (iii), (iv). Since f | [ ] and f | [ ] are bijective, α ( ) ∈ [
0, 1/3 ] and α ( ) ∈ [ ] . Thus, α satisfies (i), (ii). Since these intervals are disjoint, α satisfies(iii). Finally, note that f ( α ( )) = = f ( α ( )) . Also, since | f ( x ) | ≥ x ∈ [ ] and | f ( x ) | ≥ x ∈ [
0, 1/3 ] , both f ( α ( )) and f ( α ( )) are non-zero. Thus, α satisfies (iv).This proves the base case. Induction step ( n > ) : Assume that α n − : {
0, 1 } n − → (
0, 1 ) has been defined, and that itsatisfies (i), (ii), (iii), (iv). We now define α n : {
0, 1 } n → (
0, 1 ) . Let σ ∈ {
0, 1 } n be such that σ = σ σ (cid:48) , where σ ∈ {
0, 1 } and σ (cid:48) = σ · · · σ n ∈ {
0, 1 } n − . We define α n ( σ ) as follows. α n ( σ ) = ( f | [ ] ) − ( α n − ( σ (cid:48) )) if σ = ( f | [ ] ) − ( α n − ( σ (cid:48) )) if σ = α n ( σ ) = ( f σ | A ) − ( α n − ( σ (cid:48) )) , (6.3)where A = [
0, 1/3 ] when σ = A = [ ] when σ =
1, Note that α n is well-defined andits range lies in (
0, 1 ) for the same reasons as explained in the base case. We will now show that α n satisfies (i), (ii), (iii), (iv). Proof of (i), (ii).
Fix σ = σ σ (cid:48) ∈ {
0, 1 } n . Since ( f | [ ] ) − : [
0, 1 ] → [
0, 1/3 ] and ( f | [ ] ) − : [
0, 1 ] → [ ] , α n satisfies (i), (ii). Proof of (iii).
Suppose σ = σ σ (cid:48) ∈ {
0, 1 } n and τ = τ τ (cid:48) ∈ {
0, 1 } n . Clearly if σ = τ , then α n ( σ ) = α n ( τ ) . This shows the ⇐ direction. For the ⇒ direction, suppose α n ( σ ) = α n ( τ ) . Thenthe only option is σ = τ , since otherwise one of α n ( σ ) , α n ( τ ) would lie in the interval [
0, 1/3 ] andthe other would lie in the interval [ ] . Thus, ( f σ | A ) − ( α n − ( σ (cid:48) )) = ( f σ | A ) − ( α n − ( τ (cid:48) )) ,14here A = [
0, 1/3 ] when σ = A = [ ] when σ =
1. Since ( f σ | A ) is bijective, thismeans that α n − ( σ (cid:48) ) = α n − ( τ (cid:48) ) . Using part (iii) of the induction hypothesis, this implies that σ (cid:48) = τ (cid:48) . Thus, α n satisfies (iii). Proof of (iv).
Suppose σ = σ σ (cid:48) ∈ {
0, 1 } n and τ = τ τ (cid:48) ∈ {
0, 1 } n . Let us show the ⇐ directionfirst. If σ = τ , then f σ ( α n ( τ )) = f σ ( α n ( σ ))= f σ (cid:48) ( f σ ( α n ( σ ))) (since σ = σ σ (cid:48) ) = f σ (cid:48) ( f σ (( f σ | A ) − ( α n − ( σ (cid:48) )))) (using Equation 6.3) = f σ (cid:48) (( f σ ◦ ( f σ | A ) − )( α n − ( σ (cid:48) ))) (function composition is associative) = f σ (cid:48) ( α n − ( σ (cid:48) )) .Using part (iv) of the induction hypothesis, f σ (cid:48) ( α n − ( σ (cid:48) )) =
0, and thus f σ ( α n ( τ )) =
0. This showsthe ⇐ direction.For the ⇒ direction, suppose f σ ( α n ( τ )) =
0. We have two cases: σ = τ and σ (cid:54) = τ . We willshow that σ = τ in the first case, and that the second case is impossible. If σ = τ ,0 = f σ ( α n ( τ ))= f σ (cid:48) ( f σ (( f τ | A ) − ( α n − ( τ (cid:48) ))))= f σ (cid:48) ( f σ (( f σ | A ) − ( α n − ( τ (cid:48) ))))= f σ (cid:48) ( α n − ( τ (cid:48) )) .Using part (iv) of the induction hypothesis, f σ (cid:48) ( α n − ( τ (cid:48) )) = ⇒ σ (cid:48) = τ (cid:48) , and thus σ = τ . Thishandles the case σ = τ . We will now show by contradiction that the case σ (cid:54) = τ is impossible.Suppose σ (cid:54) = τ . Let σ = τ = σ = τ = ( f τ | [ ] ) − ( α n − ( τ (cid:48) )) ∈ [ ] . Since | f ( x ) | ≥ x ∈ ( − ∞ , 0 ] ∪ [ ∞ ) , this means that (cid:12)(cid:12)(cid:12) f σ (( f τ | [ ] ) − ( α n − ( τ (cid:48) ))) (cid:12)(cid:12)(cid:12) ≥
1. Also note that if | x | ≥
1, then | f ( x ) | ≥ | f ( x ) | ≥
1. By repeatedly applying this fact, it is easy to see that | f σ ( α n ( τ )) | = (cid:12)(cid:12)(cid:12) f σ n ( · · · ( f σ (( f τ | [ ] ) − ( α n − ( τ (cid:48) ))) · · · ) (cid:12)(cid:12)(cid:12) ≥ f σ ( α n ( τ )) = | f σ ( α n ( τ )) | ≥
1; this is a contradiction. This com-pletes the proof of the ⇒ direction and thus α n satisfies (iv).15 heorem 6.4. Consider the graph G n . Define piecewise linear functions f , f : R → R as follows.f ( x ) = − x , if x ≤ x − if x ≥ f ( x ) = − x , if x ≤ x − if x ≥ For every n ≥ and σ ∈ {
0, 1 } n , there exists a start time x ∈ (
0, 1 ) at which the path P σ (Definition 5.3) isthe unique shortest path in G n . Thus, the piecewise linear shortest path cost function has at least n pieces.Proof of Theorem 6.4. It is easy to check that f , f meet the conditions needed to invoke Lemma 6.2.Thus for every n ≥
1, there is a function α n which satisfies properties (i), (ii), (iii), (iv) of Lemma 6.2.Let n be a positive integer. Consider the graph G n (Definition 5.2). Each path of G n is indexedby a binary string σ ∈ {
0, 1 } n and has cost function f σ (Definition 5.3). Note that f ( x ) ≥ f ( x ) ≥ x ∈ R . Thus f σ ( x ) ≥ σ ∈ {
0, 1 } n , x ∈ R .Let σ ∈ {
0, 1 } n . Using property (iii), f σ ( α ( σ )) =
0, and f τ ( α ( σ )) > σ (cid:54) = τ ∈ {
0, 1 } n .Thus, the cost function f σ of the path P σ is a unique piece (which includes the point α n ( σ ) ) in thelower envelope formed by the cost functions { f σ } σ ∈{ } n . Remark 6.5.
The proof of Theorem 6.4 also works with quadratic edge weight functions, in particular whenf = ( x − ) and f = ( x − ) . ♦ In this section, we show that non-scalar GPP (GPP with k >
1) is NP -hard. Theorem 7.1.
Let ( G , W , L , x ) be a GPP instance, where G has n vertices and each edge e of G is la-belled by a two dimensional vector w e ( x ) . The vertices s , t are labelled by two dimensional vectors x , t ,respectively. Then it is NP -hard to compute an optimal s-t path in G. Note that Theorem 7.1 implies that Problem 1.2 with k = NP -hard. Proof of Theorem 7.1.
We reduce P
RODUCT P ARTITION , a well-known NP -hard problem [NBCK10]to non-scalar GPP. The problem is similar to the set partition problem, except that products of theelements are taken instead of their sums . Formally, the problem asks if a given set of n integers A = { a , . . . , a n } can it be partitioned into subsets A and A such that their product is the same.We now explain our reduction. Given a P RODUCT P ARTITION instance A = { a , . . . , a n } , con-sider the graph G n + (Definition 5.2). For every i ∈ {
0, 1, . . . , n − } , there are two edges from v i to v i + labelled by matrices (cid:34) a i a − i (cid:35) and (cid:34) a − i a i (cid:35) . 16e label s by the vector x = [
1, 1 ] T and t by t = [ − − ] T . Let A be an algorithm whichsolves Problem 1.2 with parameter k =
2. We provide G n + as input to A , and show that A can bepartitioned into two subsets having the same sum if and only if A returns a path of cost − σ = ( σ · · · σ n ) ∈ { − } n . Let A be the subset of A with characteristic vector σ , and let A = A \ A . The cost of the path P σ (Definition 5.3) from v to v n is cost ( P σ ) = (cid:104) (cid:105) · (cid:34) ∏ ni = a σ i i ∏ ni = a − · σ i i (cid:35) · (cid:34) − − (cid:35) .Evaluating this, we obtain cost ( P σ ) = − a − a − , where a = ∏ ni = a σ i i = ∏ a i ∈ A a i · ∏ a i ∈ A a − i .Furthermore, a = ⇐⇒ ∏ a i ∈ A a i = ∏ a i ∈ A a i .By the AM-GM inequality, a + a − < −
2, for every a (cid:54) =
1. Hence, A can be partitioned intotwo subsets whose product is the same if and only if A returns a path of cost − We study Generalized Path Problems on graphs with parametric weights. We show that the prob-lem is efficiently solvable when the weight functions are linear, but become intractable in generalwhen they are piecewise linear.We assume that weight functions are deterministic and fully known in advance. Modellingprobabilistic and partially known weight functions and proposing algorithms for them is a direc-tion for future work. Also, we have assumed that only one edge can be taken at a time, resulting inan optimization over paths . This requirement could be relaxed to study flows on graphs with para-metric weights. Though there is some work on such models in route planning algorithms [GGT89],results with rigorous guarantees such as the ones we have presented are challenging to obtain. Insuch cases, heuristic algorithms with empirical evaluation measures might be worth exploring.
References [Att19] Joseph Attia. The Applications of Graph Theory to Investing. arXiv preprintarXiv:1902.00786 , 2019.[BAA14] Samuel Bates, Valérie Angeon, and Ahmed Ainouche. The pentagon of vulnerabilityand resilience: A methodological proposal in development economics by using graphtheory.
Economic Modelling , 42:445–453, 2014.[Bel58] Richard Bellman. On a routing problem.
Quarterly of applied mathematics , 16(1):87–90,1958. 17Bra68] Dietrich Braess. Über ein Paradoxon aus der Verkehrsplanung.
Unternehmensforschung ,12(1):258–268, 1968.[Car83] Patricia J. Carstensen.
The complexity of some problems in parametric linear and combinato-rial programming . PhD thesis, University of Michigan, 1983.[CH66] Kenneth L Cooke and Eric Halsey. The shortest route through a network with time-dependent internodal transit times.
Journal of mathematical analysis and applications ,14(3):493–498, 1966.[CLRS09] Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest, and Clifford Stein.
Intro-duction to Algorithms, Third Edition . The MIT Press, 3rd edition, 2009.[Dea04] Brian C Dean. Shortest paths in FIFO time-dependent networks: Theory and algo-rithms.
Rapport technique, Massachusetts Institute of Technology , page 13, 2004.[DOS12] Frank Dehne, Masoud T Omran, and Jörg-Rüdiger Sack. Shortest paths in time-dependent FIFO networks.
Algorithmica , 62(1-2):416–435, 2012.[DP14] Kurt Dopfer and Jason Potts.
The new evolutionary economics . Edward Elgar Publishing,2014.[Dre69] Stuart E Dreyfus. An appraisal of some shortest-path algorithms.
Operations research ,17(3):395–412, 1969.[DS06] Freddy Delbaen and Walter Schachermayer.
The mathematics of arbitrage . SpringerScience & Business Media, 2006.[Ebo13] Mario Eboli.
Financial Applications of Flow Network Theory , pages 21–29. Springer BerlinHeidelberg, Berlin, Heidelberg, 2013.[EK10] David Easley and Jon Kleinberg.
Networks, crowds, and markets , volume 8. Cambridgeuniversity press Cambridge, 2010.[FHS14] Luca Foschini, John Hershberger, and Subhash Suri. On the Complexity of Time-Dependent Shortest Paths.
Algorithmica , 68(4):1075–1097, 2014.[FJ56] Lester R Ford Jr. Network flow theory. Technical report, Rand Corp Santa Monica, CA,1956.[GGT89] Giorgio Gallo, Michael D Grigoriadis, and Robert E Tarjan. A fast parametric maxi-mum flow algorithm and applications.
SIAM Journal on Computing , 18(1):30–55, 1989.[GJ79] Michael R Garey and David S Johnson.
Computers and intractability , volume 174. free-man San Francisco, 1979. 18Hau14] Harald Hau. The exchange rate effect of multi-currency risk arbitrage.
Journal of Inter-national Money and Finance , 47(C):304–331, 2014.[HP14] Gaurav Hajela and Manish Pandey. Parallel Implementations for Solving Shortest PathProblem using Bellman-Ford.
International Journal of Computer Applications , 95(15):1–6,June 2014. Full text available.[KB09] Michael D Koenig and Stefano Battiston. From graph theory to models of economicnetworks. a tutorial.
Networks, topology and dynamics , 613:23–63, 2009.[KVP20] Sreeja Kamishetty, Soumya Vadlamannati, and Praveen Paruchuri. Towards a bettermanagement of urban traffic pollution using a Pareto max flow approach.
Transporta-tion Research Part D: Transport and Environment , 79:102194, 2020.[Moo59] E. F. Moore. The shortest path through a maze.
Proc. Int. Symp. Switching Theory, 1959 ,part II:285–292, 1959.[Moo03] Imad A. Moosa.
Two-Currency, Three-Currency and Multi-Currency Arbitrage , pages 1–18. Palgrave Macmillan UK, London, 2003.[Mur70] John D Murchland. Braess’s paradox of traffic flow.
Transportation Research , 4(4):391–394, 1970.[NBCK10] Chi To Ng, MS Barketau, TC Edwin Cheng, and Mikhail Y Kovalyov. “Product Parti-tion” and related problems of scheduling and systems reliability: computational com-plexity and approximation.
European Journal of Operational Research , 207(2):601–604,2010.[NBK06] Evdokia Nikolova, Matthew Brand, and David R Karger. Optimal Route Planningunder Uncertainty. In
ICAPS , volume 6, pages 131–141, 2006.[OR90] Ariel Orda and Raphael Rom. Shortest-path and minimum-delay algorithms in net-works with time-dependent edge-length.
Journal of the ACM (JACM) , 37(3):607–625,1990.[RKDG09] Amnon Rapoport, Tamar Kugler, Subhasish Dugar, and Eyran J Gisches. Choice ofroutes in congested traffic networks: Experimental tests of the Braess Paradox.
Gamesand Economic Behavior , 65(2):538–571, 2009.[Ros77] Stephen Ross. Return, Risk and Arbitrage.
Risk and Return in Finance , Vol. I, 01 1977.[SV97] Andrei Shleifer and Robert W Vishny. The limits of arbitrage.
The Journal of finance ,52(1):35–55, 1997. 19SZ83] Richard Steinberg and Willard I Zangwill. The prevalence of Braess’ paradox.
Trans-portation Science , 17(3):301–318, 1983.[ZM93] Athanasios K. Ziliaskopoulos and Hani S. Mahmassani. Time-dependent, shortest-path algorithm for real-time intelligent vehicle highway system applications.
Trans-portation Research Record , 1993.
A Plots
In this section, we exhibit the plots of all the s - t paths (Definition 5.3) in the graphs G n (Defini-tion 5.2) for the piecewise linear weight functions f , f (Theorem 6.4), for various values of n . n = = n = =5