A Subexponential Algorithm for ARRIVAL
AA SUBEXPONENTIAL ALGORITHM FOR ARRIVAL
BERND GÄRTNER, SEBASTIAN HASLEBACHER, AND HUNG P. HOANG
Department of Computer Science, ETH Zürich, Switzerland {gaertner, sebastian.haslebacher, hung.hoang}@inf.ethz.ch
Abstract.
The ARRIVAL problem is to decide the fate of a train moving along the edges of adirected graph, according to a simple (deterministic) pseudorandom walk. The problem is in NP ∩ coNP but not known to be in P . The currently best algorithms have runtime 2 Θ( n ) where n is the number of vertices. This is not much better than just performing the pseudorandom walk.We develop a subexponential algorithm with runtime 2 O ( √ n log n ) . We also give a polynomial-timealgorithm if the graph is almost acyclic. Both results are derived from a new general approachto solve ARRIVAL instances. INTRODUCTION
Informally, the ARRIVAL problem is the following (we quote from Dohrau et al. [6]):Suppose that a train is running along a railway network, starting from a designatedorigin, with the goal of reaching a designated destination. The network, however,is of a special nature: every time the train traverses a switch, the switch willchange its position immediately afterwards. Hence, the next time the traintraverses the same switch, the other direction will be taken, so that directionsalternate with each traversal of the switch.Given a network with origin and destination, what is the complexity of decidingwhether the train, starting at the origin, will eventually reach the destination?ARRIVAL is arguably the simplest problem in NP ∩ coNP that is not known to be in P . Dueto its innocence and at the same time unresolved complexity status, ARRIVAL has attractedquite some attention recently. The train run can be interpreted as a deterministic simulationof a random walk that replaces random decisions at a switch by perfectly fair decisions. Suchpseudorandom walks have been studied before under the names of Eulerian walkers [17], rotor-router walks [12], and
Propp machines [4]. The reachability question as well as NP and coNP membership are due to Dohrau et al. [6].Viewed somewhat differently, ARRIVAL is a zero player game (a process that runs without acontroller); in contrast, three other well-known graph games in NP ∩ coNP that are not knownto be in P are two-player (involving two controllers). These are simple stochastic games , mean-payoff games and parity games [3, 21, 13]. Moreover, it is stated in (or easily seen from) thesepapers that the one-player variants (the strategy of one controller is fixed) have polynomial-timealgorithms. In light of this, one might expect a zero-player game such as ARRIVAL to be really simple. But so far, no polynomial-time algorithm could be found.On the positive side, the NP ∩ coNP complexity upper bound could be strengthened in variousways. ARRIVAL is in UP ∩ coUP , meaning that there are efficient verifiers that accept unique Key words and phrases.
Pseudorandom walks, reachability, graph games, switching systems. a r X i v : . [ c s . D S ] F e b A SUBEXPONENTIAL ALGORITHM FOR ARRIVAL proofs [10]. A search version of ARRIVAL has been introduced by Karthik C. S. and shown tobe in
PLS [15], then in
CLS [10], and finally in
UniqueEOPL [10, 8]. The latter complexity class,established by Fearnley et al. [8], has an intriguing complete problem, but there is no evidencethat ARRIVAL is complete for
UniqueEOPL .Concerning complexity lower bounds, there is one result: ARRIVAL is NL -hard [7]. This is nota very strong statement and means that every problem that can be solved by a nondeterministiclog-space Turing machine reduces (in log-space) to ARRIVAL.Much more interesting are the natural one- and two-player variants of ARRIVAL that havebeen introduced in the same paper by Fearnley et al. [7] and later expanded by Ani et al. [1].These variants allow a better comparison with the previously mentioned graph games. It turnsout that the one-player variants of ARRIVAL are NP -complete, and that the two-player variantsare PSPACE -hard [7, 1]. This shows that the p -player variant of ARRIVAL is probably strictlyharder than the p -player variants of the other graph games mentioned before, for p = 1 ,
2. Thismakes it a bit less surprising that ARRIVAL itself ( p = 0) could so far not be shown to lie in P .On the algorithmic side, the benchmark is the obvious algorithm for solving ARRIVAL ona graph with n vertices: simulate the train run. This is known to take at most O ( n n ) steps(after this, we can conclude that the train runs forever) [6]. There is also an Ω(2 n ) lower boundfor the simulation [6]. The upper bound was improved to O ( p ( n )2 n/ ) (in expectation) forsome polynomial p , using a way to efficiently sample from the run [10]. The same bound waslater achieved deterministically [11, 18], and the approach can be refined to yield a runtime of O ( p ( n )2 n/ ), the currently best one for general ARRIVAL instances [18].In this paper, we prove that ARRIVAL can be decided in subexponential time 2 O ( √ n log n ) .While this is still far away from the desired polynomial-time algorithm, the new upper bound ismaking the first significant progress on the runtime. We also prove that polynomial runtime canbe achieved if the graph is close to acyclic, meaning that it can be made acyclic by removing aconstant number of vertices.As the main technical tool from which we derive both results, we introduce a generalizationof ARRIVAL. In this multi-run variant, there is a subset S of vertices where additional trainsmay start and also terminate. It turns out that if we start the right numbers of trains fromthe vertices in S , we also solve the original instance, so the problem is reduced to searching forthese right numbers. We show that this search problem is well-behaved and can be solved bysystematic guessing, where the number of guesses is exponential in | S | , not in n .We are thus interested in cases where S is small but at the same time allows a sufficientlyfast evaluation of a given guess. For the subexponential algorithm, we choose S as a set of size O ( √ n ), with the property that a train can only take a subexponential number of steps untilit terminates (in S or a destination). For almost acyclic graphs, we choose S as a minimumfeedback vertex set, a set whose removal makes the graph acyclic. In this case, a train can visitany vertex only once before it terminates.The multi-run variant itself is an interesting new approach to the ARRIVAL problem, andother applications of it might be found in the future.2. ARRIVAL
The ARRIVAL problem was introduced by Dohrau et al. [6] as the problem of decidingwhether the train arrives at a given destination or runs forever. Here, we work in a different butequivalent setting (implicitly established by Dohrau et al. already) in which the train alwaysarrives at one of two destinations, and we have to decide at which one. The definitions and
SUBEXPONENTIAL ALGORITHM FOR ARRIVAL 3 results from Dohrau et al. [6] easily adapt to our setting. We still provide independent proofs,derived from the more general setting that we introduce in Section 3.Given a finite set of vertices V , an origin o ∈ V , two destinations d, d / ∈ V and two functions s even , s odd : V → V ∪ { d, d } , the 6-tuple A = ( V, o, d, d, s even , s odd ) is an
ARRIVAL instance .The vertices s even ( v ) and s odd ( v ) are called the even and the odd successor of v .An ARRIVAL instance A defines a directed graph, connecting each vertex v ∈ V to its evenand its odd successor. We call this the switch graph of A and denote it by G ( A ). To avoidspecial treatment of the origin later, we introduce an artificial vertex Y / ∈ V ∪ { d, d } (think of itas the “train yard”) that only connects to the origin o . Formally, G ( A ) = ( V ( A ) , E ( A )) where V ( A ) = V ∪ { Y, d, d } and E ( A ) = { ( Y, o ) } ∪ { ( v, s even ( v )) : v ∈ V } ∪ { ( v, s odd ( v )) : v ∈ V } .We also refer to E ( A ) simply as the edges of A . An edge e = ( Y, o ) is called proper .The run procedure is the following. For every vertex we maintain a current and a nextsuccessor, initially the even and the odd one. We put a token (usually referred to as the train)at o and move it along switch graph edges until it reaches either d or d . Whenever the trainis at a vertex v , we move it to v ’s current successor and then swap the current and the nextsuccessor; see Algorithm 1 for a formal description and Figure 1 for an example. Algorithm 1:
Run Procedure
Input:
ARRIVAL instance A = ( V, o, d, d, s even , s odd ) Output: destination of the train: either d or d Let s curr and s next be arrays indexed by the vertices of V for v ∈ V do s curr [ v ] ← s even ( v ) s next [ v ] ← s odd ( v ) v ← o /* traversal of edge ( Y, o ) */ while v = d and v = d do w ← s curr [ v ]swap( s curr [ v ] , s next [ v ]) v ← w /* traversal of edge ( v, w ) */ return v Algorithm 1 (Run procedure) may cycle, but we can avoid this by assuming that from everyvertex v ∈ V , one of d and d is reachable along a directed path in G ( A ). We call such anARRIVAL instance terminating , since it guarantees that either d or d is eventually reached. d ¯ doY
33 2 21 1 11 0
Figure 1.
A terminating ARRIVAL instance and the train run. Bold edges goto the even successors, dashed edges to the odd successors. The two successorsmay coincide (lower left vertex). The numbers indicate how often each edge istraversed by the train.
A SUBEXPONENTIAL ALGORITHM FOR ARRIVAL
Lemma 1.
Let A = ( V, o, d, d, s even , s odd ) be a terminating ARRIVAL instance, | V | = n . Let v ∈ V and suppose that the shortest path from v to a destination in G ( A ) has length m . Then v is visited (the train is at v ) at most m times by Algorithm (Run Procedure).Proof. Let v = v m , v m − , . . . , v ∈ { d, d } be the sequence of vertices on a shortest path from v to { d, d } . Consider the first 2 m visits to v (if there are less, we are done). Once every twoconsecutive visits, the train moves on to v m − , so we can consider the first 2 m − visits to v m − and repeat the argument from there to show that v i is visited at least 2 i times for all i , before v exceeds 2 m visits. In particular, v ∈ { d, d } is visited, so the run indeed terminates within atmost 2 m visits to v . (cid:3) Lemma 2.
Let A = ( V, o, d, d, s even , s odd ) be a terminating ARRIVAL instance, | V | = n . Let ‘ be the maximum length of the shortest path from a vertex in V to a destination. Algorithm (Run Procedure) traverses at most ( n − ‘ + 2)2 ‘ − proper edges.Proof. By Lemma 1, the total number of visits to vertices v ∈ V is bounded by P ni =1 n i i , where n i is the number of vertices with a shortest path of length i to a destination. We have n i > i ≤ ‘ , and hence the sum is maximized if n i = 1 for all i < ‘ , and n ‘ = n − ‘ + 1. Inthis case, the sum is ( n − ‘ + 2)2 ‘ −
2. The number of proper edges being traversed (one afterevery visit of v ∈ V ) is the same. (cid:3) Given a terminating instance, ARRIVAL is the problem of deciding whether Algorithm 1(Run Procedure) returns d (YES instance) or d (NO instance). It is unknown whether ARRIVAL ∈ P , but it is in NP ∩ coNP , due to the existence of switching flows that are certificates for theoutput of Algorithm 1 (Run Procedure).2.1. Switching Flows.
For a vertex v and a set of edges E , we will denote the set of outgoingedges of v by E + ( v ). Analogously, we will denote the set of incoming edges of v by E − ( v ).Furthermore, for a function x : E → N , we will also use the notation x e instead of x ( e )to denote the value of x at some edge e ∈ E . Lastly, given some vertex v , edges E and afunction x : E → N , we will use x + ( v ) := P e ∈ E + ( v ) x e to denote the outflow of x at v and x − ( v ) := P e ∈ E − ( v ) x e to denote the inflow of x at v . For two functions x, x : E → N , we write x ≤ x if this holds componentwise, i.e. x e ≤ x e for all e ∈ E . Definition 1 (Switching Flow [6]) . Let A = ( V, o, d, d, s even , s odd ) be a terminating ARRIVALinstance with edges E . A function x : E → N is a switching flow for A if x + ( Y ) = 1 ,x + ( v ) − x − ( v ) = 0 , v ∈ V (flow conservation) x ( v,s even ( v )) − x ( v,s odd ( v )) ∈ { , } , v ∈ V (switching behavior) . Moreover, x is called a switching flow to t ∈ { d, d } if x − ( t ) = 1 . Note that due to flow conservation, a switching flow is a switching flow either to d or to d :exactly one of the destinations must absorb the unit of flow emitted by Y . If we set x e to thenumber of times the edge e is traversed in Algorithm 1 (Run Procedure), we obtain a switchingflow to the output; see Figure 1 for an example. Indeed, every time the train enters v ∈ V ,it also leaves it; this yields flow conservation. The strict alternation between the successors(beginning with the even one) yields switching behavior.Hence, the existence of a switching flow to the output is necessary for obtaining the output.Interestingly, it is also sufficient. For that, it remains to prove that we cannot have switchingflows to both d and d for the same instance. SUBEXPONENTIAL ALGORITHM FOR ARRIVAL 5
Theorem 3 (Switching flows are certificates [6]) . Let A = ( V, o, d, d, s even , s odd ) be a termi-nating ARRIVAL instance, t ∈ { d, d } . Algorithm (Run Procedure) outputs t if and only ifthere exists a switching flow to t . The switching flow corresponding to the actual train run can be characterized as follows.
Theorem 4 (The run profile is the minimal switching flow [6]) . Let A = ( V, o, d, d, s even , s odd ) be a terminating ARRIVAL instance with edges E . Let ˆ x be the run profile of A , meaning that ˆ x e counts the number of times edge e is traversed during Algorithm (Run Procedure). Then ˆ x ≤ x for all switching flows x . In particular, ˆ x is the unique minimizer of the total flow P e ∈ E x e overall switching flows. We note that this provides the missing direction of Theorem 3. Indeed, ˆ x is a switching flowand hence either has ˆ x − ( d ) = 1 or ˆ x − ( d ) = 1. By ˆ x ≤ x , every switching flow x is to the samedestination. In general, there can be switching flows x = ˆ x [6].We will derive Theorem 4 as a special case of Theorem 6 in the next section.3. A GENERAL FRAMEWORK
In order to solve the ARRIVAL problem, we can simulate Algorithm 1 (Run Procedure) whichtakes exponential time in the worst case [6]; alternatively, we can try to get hold of a switchingflow; via Theorem 3, this also allows us to decide ARRIVAL.According to Definition 1, a switching flow can be obtained by finding a feasible solutionto an integer linear program (ILP); this is a hard task in general, and it is unknown whetherswitching flow ILPs can be solved more efficiently than general ILPs.In this section, we develop a framework that allows us to reduce the problem to that of solvinga number of more constrained ILPs. At the same time, we provide direct methods for solvingthem that do not rely on using general purpose ILP solvers.3.1.
The idea.
Given a terminating ARRIVAL instance, we consider the ILP whose (unique)optimal solution is the run profile, see Theorem 4. Given an arbitrary fixed subset S = { v , . . . , v k } ⊆ V of k vertices, we drop the flow conservation constraints at the vertices in S ,but at the same time prescribe outflow values x + ( v ) , . . . , x + ( v k ) that we can think of as guessesfor their values in the run profile.If we optimally solve this guessing ILP, it turns out that we still obtain a unique solution (The-orem 6 (i) below) and hence unique inflow values x − ( v ) , . . . , x − ( v k ) for the vertices in S . If wehappen to stumble upon a fixed point of the mapping x + ( v ) , . . . , x + ( v k ) → x − ( v ) , . . . , x − ( v k ),we recover flow conservation also at S , which means that our guesses were correct and we haveobtained the run profile.The crucial property is that the previously described mapping is monotone (Theorem 6 (ii)below), meaning that the theory of Tarski fixed points applies that guarantees the existence of afixed point as well as efficient algorithms for finding it (Lemma 9 below).Hence, we reduce the computation of the run profile to a benign search problem (for a Tarskifixed point), where every search step requires us to solve a “simpler” ILP. But how much simplerthis is (if at all) depends on the properties of the switch graph and an appropriate choice ofthe set S . We next present a “rail” way of solving the guessing ILP that turns out to be moreefficient in the worst case (and also simpler) than general purpose ILP solvers.3.2. The Multi-Run Procedure.
Given S = { v , . . . , v k } ⊆ V and w ∈ N k (guesses for theoutflows from the vertices in S ), we start one train from Y and w i trains from v i until theyarrive back in S , or at a destination. In this way, we produce inflow values for the vertices in S . A SUBEXPONENTIAL ALGORITHM FOR ARRIVAL
By starting, we mean that we move each of the trains by one step: the one on Y moves to o ,while d w i / e of the ones at v i move to the even successor of v i , and b w i / c to the odd successor.Trains that are now on vertices in V \ S are called waiting (to move on).For all v ∈ V \ S , we initialize current and next successors as before in Algorithm 1 (RunProcedure). Then we (nondeterministically) repeat the following until there are no more trainswaiting.We pick a vertex v ∈ V \ S where some trains are waiting and call the number of waitingtrains t ( v ). We choose a number τ ∈ { , . . . , t ( v ) } of trains to move on; we move d τ / e of themto the current successor and b τ / c to the next successor. If τ is odd, we afterwards swap thecurrent and the next successor at v .Algorithm 2 (Multi-Run Procedure) provides the details. For S = ∅ , the procedure becomesdeterministic and is equivalent to Algorithm 1 (Run Procedure). Algorithm 2:
Multi-Run Procedure
Input:
Terminating ARRIVAL instance A = ( V, o, d, d, s even , s odd ) with edges E ; S = { v , v , . . . , v k } ⊆ V , w = ( w , w , . . . , w k ) ∈ N k (one train starts from Y , and w i trains start from v i ). Output: number of trains arriving at d, d , and in S , respectivelyLet t be a zero-initialized array indexed by the vertices of V ∪ { d, d } t [ o ] ← /* traversal of ( Y, o ) */ for i = 1 , , . . . , k do t [ s even ( v i )] ← t [ s even ( v i )] + d w i / e /* d w i / e traversals of ( v i , s even ( v i )) */ t [ s odd ( v i )] ← t [ s odd ( v i )] + b w i / c /* b w i / c traversals of ( v i , s odd ( v i )) */ Let s curr and s next be arrays indexed by the vertices of V \ S for v ∈ V \ S do s curr [ v ] ← s even ( v ) s next [ v ] ← s odd ( v ) while ∃ v ∈ V \ S : t [ v ] > do pick v ∈ V \ S such that t [ v ] > τ ∈ { , . . . , t [ v ] } t [ v ] ← t [ v ] − τt [ s curr ( v )] ← t [ s curr ( v )] + d τ / e /* d τ / e traversals of ( v, s curr ( v )) */ t [ s next ( v )] ← t [ s next ( v )] + b τ / c /* b τ / c traversals of ( v, s next ( v )) */ if τ is odd then swap( s curr [ v ] , s next [ v ]) return ( t [ d ] , t [ d ] , t [ v ] , t [ v ] , . . . , t [ v k ]) Lemma 5.
Algorithm (Multi-Run Procedure) terminates.Proof. This is a qualitative version of the argument in Lemma 1. Let x : E → N record howmany times each edge e ∈ E has been traversed in total, at any given time of Algorithm 2(Multi-Run Procedure). For v ∈ V \ S , we always have x + ( v ) = x − ( v ) − t ( v ), where t ( v ) isthe number of trains currently waiting at v . Suppose for a contradiction that the Multi-Runprocedure cycles. Then x − ( v ) is unbounded for at least one v ∈ V \ S , which means that x + ( v )is also unbounded, since t ( v ) is bounded. This in turn means that x − ( s even ( v )) and x − ( s odd ( v ))are unbounded as well, since we distribute x + ( v ) evenly between the two successors. Repeating SUBEXPONENTIAL ALGORITHM FOR ARRIVAL 7 this argument, we see that x − ( w ) is unbounded for all vertices w reachable from v . But as x − ( d )and x − ( d ) are bounded (by the number of trains that we started), neither d nor d are reachablefrom v . This is a contradiction to A being terminating. (cid:3) Candidate switching flows.
After Algorithm 2 (Multi-Run Procedure) has terminated,let ˆ x e be the number of times the edge e was traversed. We then have flow conservation at v ∈ V \ S , switching behavior at v ∈ V and outflow w i from v i . Indeed, every train that enters v ∈ V \ S eventually also leaves it; moreover, the procedure is designed such that it simulatesmoving trains out of v ∈ V individually, strictly alternating between successors. Finally, as westart w i trains from v i ∈ S and stop all trains once they arrive in S , we also have outflow w i from v i .We remark that we do not have any control over how many trains end up at d or d . Also, ˆ x could in principle depend on the order in which we pick vertices, and on the chosen τ ’s. We willshow in Theorem 6 below that it does not. So far, we have only argued that ˆ x is a candidateswitching flow according to the following definition. Definition 2 (Candidate Switching Flow) . Let A = ( V, o, d, d, s even , s odd ) be a terminatingARRIVAL instance with edges E , S = { v , v , . . . , v k } ⊆ V , w = ( w , w , . . . , w k ) ∈ N k .A function x : E → N is a candidate switching flow for A (w.r.t. S and w ) if x + ( Y ) = 1 ,x + ( v ) − x − ( v ) = 0 , v ∈ V \ S (flow conservation at V \ S ) x + ( v i ) = w i , i = 1 , , . . . , k, (outflow w at S ) x ( v,s even ( v )) − x ( v,s odd ( v )) ∈ { , } , v ∈ V (switching behavior) . (1) Theorem 6 (Each Multi-Run profile is the minimal candidate switching flow) . Let
A, E, S, w be as in Definition and let ˆ x be a Multi-Run profile of A , meaning that ˆ x e is the number oftimes edge e ∈ E was traversed during some run of Algorithm (Multi-Run Procedure). Thenthe following statements hold. (i) ˆ x ≤ x for all candidate switching flows x (w.r.t. S and w ). In particular, ˆ x is the uniqueminimizer of the total flow P e ∈ E x e over all candidate switching flows. (ii) For fixed
A, E, S , define F ( w ) = (ˆ x − ( v ) , . . . , ˆ x − ( v k )) ∈ N k . Then the function F : N k → N k is monotone , meaning that w ≤ w implies that F ( w ) ≤ F ( w ) .Proof. We prove part (i) by the pebble argument [6]: Let x be any candidate switching flow w.r.t. S and w . For every edge e , we initially put x e pebbles on e , and whenever a train traverses e inAlgorithm 2 (Multi-Run Procedure), we let it collect a pebble. If we can show that we never runout of pebbles, ˆ x ≤ x follows. By “running out of pebbles”, we concretely mean that we are forthe first time trying to collect a pebble from an edge with no pebbles left.Since x is a candidate switching flow, we cannot run out of pebbles while starting the trains.In fact, we exactly collect all the pebbles on the outgoing edges of { Y } ∪ S . It remains to showthat we cannot run out of pebbles while processing a picked vertex v ∈ V \ S . For this, we provethat we maintain the following additional invariants (which hold immediately after starting thetrains). Let p : E → N record for each edge e the remaining number of pebbles on e . Then forall v ∈ V \ S ,(a) p + ( v ) = p − ( v ) + t ( v ), where t ( v ) is the number of trains waiting at v ;(b) p (( v, s curr ( v ))) − p (( v, s next ( v ))) ∈ { , } .Suppose that these invariants hold when picking a vertex v ∈ V \ S . As we have not run out ofpebbles before, p − ( v ) ≥ q ≥ t ( v ) pebbles on the outgoing A SUBEXPONENTIAL ALGORITHM FOR ARRIVAL edges; by (b), d q/ e of them are on ( v, s curr ( v )) and b q/ c on ( v, s next ( v )). From the former, wecollect d τ / e , and from the latter b τ / c where τ ≤ t ( v ) ≤ q , so we do not run out of pebbles.We maintain (a) at v where both p + and t are reduced by τ . We also maintain (a) at thesuccessors; there, the gain in t exactly compensates the loss in p − . Finally, we maintain (b)at v : If τ is even, both p (( v, s curr ( v ))) and p (( v, s next ( v ))) shrink by τ /
2. If τ is odd, we have p (( v, s curr ( v ))) − p (( v, s next ( v ))) ∈ {− , } after collecting one more pebble from ( v, s curr ( v ))than from ( v, s next ( v )), but then we reverse the sign by swapping s curr and s next .For S = ∅ , this proves Theorem 4, and for general S , we have now proved (i). In particular,the order in which we move trains in Algorithm 2 (Multi-Run Procedure) does not matter.The proof of (ii) is now an easy consequence; recall that the inflow F ( w ) i is the number oftrains that arrive at v i . If w ≤ w , we run Algorithm 2 (Multi Run Procedure) with input w such that it first simulates a run with input w ; for this, we keep the extra trains correspondingto w − w waiting where they are after the start, until all other trains have terminated. At thispoint, we have inflow f ≥ F ( w ) at S , where f − F ( w ) corresponds to the extra trains that havealready reached S right after the start. We finally run the extra trains that are still waiting,and as this can only further increase the inflows at S , we get F ( w ) ≥ f ≥ F ( w ). (cid:3) Runtime.
As we have proved in Theorem 6 (i), the Multi-Run procedure always generatesthe unique flow-minimal candidate switching flow. But the number of steps depends on theorder in which vertices v ∈ V \ S are picked, and on the chosen τ ’s. We start with an upperbound on the number of edge traversals that generalizes Lemma 2. Lemma 7.
Let A = ( V, o, d, d, s even , s odd ) be a terminating ARRIVAL instance, | V | = n , S = { v , v , . . . , v k } ⊆ V , w = ( w , w , . . . , w k ) ∈ N k . Let ‘ be the maximum length of theshortest path from a vertex in V \ S to a vertex in { d, d } ∪ S . Further suppose that at thebeginning of some iteration in Algorithm (Multi-Run Procedure), R trains are still waiting.Then all subsequent iterations traverse at most R (( n − ‘ + 2)2 ‘ − edges in total.Proof. We continue to run each of the R waiting trains individually and proceed with the nextone only when the previous one has terminated. In Algorithm 2 (Multi-Run Procedure), thiscorresponds to always using τ = 1 and the next vertex v as the head of the previously traversededge, for each of the R trains. So we effectively perform Algorithm 1 (Run Procedure) for R trains.As each train terminates once it reaches a vertex in S ∪{ d, d } , Lemmata 1 and 2 are easily seento hold also here, after redefining “destination” as any vertex in S ∪ { d, d } . As a consequence,each train traverses at most ( n − ‘ + 2)2 ‘ − { d, d } ∪ S . Thisleads to at most R (( n − ‘ + 2)2 ‘ −
2) edge traversals overall. By Theorem 6 (i), this upper boundholds for all ways of continuing Algorithm 2 (Multi-Run Procedure). (cid:3)
With R = W := 1 + P ki =1 w i , we obtain an upper bound for the total number of loop iterationssince each iteration traverses at least one edge. But it turns out that we can be significantlyfaster (and polynomial in the encoding size of W ) when we proceed in a greedy fashion, i.e. wealways pick the next vertex as the one with the largest number of waiting trains, and move allthese trains at once. Lemma 8.
Let
A, n, S, w, ‘ as in Lemma , and suppose that in each iteration of Algorithm (Multi-Run Procedure), we pick v ∈ V \ S maximizing t [ v ] and further choose τ = t [ v ] . Then thenumber of iterations is at most (ln W + n )( n − k )(( n − ‘ + 2)2 ‘ − , where W = 1 + P ki =1 w i .Proof. As in the proof of Theorem 6, we let each train collect a pebble as it traverses an edge,where we initially put ˆ x e pebbles on edge e , with ˆ x being the unique Multi-Run profile. This SUBEXPONENTIAL ALGORITHM FOR ARRIVAL 9 means that we eventually collect all pebbles. Now consider an iteration and suppose that R ≤ W trains are still waiting. In the greedy algorithm, we move at least R/ ( n − k ) of them in thisiteration and collect at least that many pebbles. On the other hand, with R trains still waiting,and with T = ( n − ‘ + 2)2 ‘ −
2, there can be no more than RT pebbles left, as all of them willbe collected in the remaining at most that many edge traversals, due to Lemma 7.In summary, the number of pebbles is guaranteed to be reduced by a factor of (cid:18) − n − k ) T (cid:19) in each iteration, starting from at most W T pebbles before the first iteration. After s =(ln W + n )( n − k ) T iterations, we therefore have at most (cid:18) − n − k ) T (cid:19) s W T ≤ e − ln W − n W T <
T < e n ). Hence, after at most s iterations, the greedy version of Algorithm 2(Multi-Run Procedure) has indeed terminated. (cid:3) We remark that essentially the same runtime can be achieved by a round robin version thatrepeatedly cycles through V \ S in some fixed order.3.5. Tarski fixed points.
Tarski fixed points arise in the study of order-preserving functionson complete lattices [19]. For our application, it suffices to consider finite sets of the form L = { , , . . . , N } k for some N, k ∈ N + . For such a set, Tarski’s fixed point theorem [19] statesthat any monotone function D : L → L has a fixed point, some ˆ w ∈ L such that D ( ˆ w ) = ˆ w .Moreover, the problem of finding such a fixed point has been studied: Dang, Qi and Ye [5] haveshown that a fixed point can be found using O (log k N ) evaluations of D . Recently, Fearnleyand Savani [9] improved this to O (log k − N ) for k ≥ F : N k → N k , assuming that wecan efficiently evaluate F . Indeed, if we have such a fixed point, the corresponding flow-minimalcandidate switching flow is the flow-minimal actual switching flow and hence the run profile, byTheorem 4.The function F depends on a set S ⊆ V of size k that we can choose freely (we will do so inthe subsequent sections).Here, we still need to argue that we can restrict F to a finite set L = { , , . . . , N } k so thatthe Tarski fixed point theorem applies. We already know that outflow (and hence inflow) valuesnever exceed N = 2 n in the run profile (Lemma 1), so we simply restrict F to this range and atthe same time cap the function values accordingly. Lemma 9.
Let A = ( V, o, d, d, s even , s odd ) be a terminating ARRIVAL instance, S = { v , . . . , v k } ⊆ V , | V | = n . Let F be the function defined in Theorem (ii), let N = 2 n and consider thefunction D : { , , . . . , N } k → { , , . . . , N } k defined by D ( w ) = min( N, F ( w ) )min( N, F ( w ) ) ... min( N, F ( w ) k ) , w ∈ { , , . . . , N } k . Then D is monotone and has a fixed point ˆ w that can be found with O ( n k − ) evaluations of D for k ≥ or O ( n k ) evaluations of D for k < . Moreover, ˆ w is also a fixed point of F , and whenwe apply Theorem (i) with w = ˆ w , we obtain the run profile of A . Proof.
Monotonicity is clear: if w ≤ w , then F ( w ) ≤ F ( w ) by monotonicity of F ; seeTheorem 6 (ii). But then also D ( w ) ≤ D ( w ) for the capped values. Hence, the Tarskifixed point theorem [19] yields a fixed point ˆ w of D , and the algorithm of Dang, Qi and Ye [5]finds it using O (log k N ) = O ( n k ) evaluations. For k ≥
3, we can use the algorithm by Fearnleyand Savani [9] to find the fixed point after O ( n k − ) evaluations.It remains to prove that ˆ w is a fixed point of F . Suppose for a contradiction that itis not a fixed point. Then F ( ˆ w ) = D ( ˆ w ), i.e. some values were actually capped, and soˆ w j = D ( ˆ w ) j = N < F ( ˆ w ) j for at least one j . As we also have ˆ w = D ( ˆ w ) ≤ F ( ˆ w ), we get k X i =1 ˆ w i < k X i =1 F ( ˆ w ) i . (2)On the other hand, consider the candidate switching flow (1) with w = ˆ w . At most the totalflow emitted (at Y and the v i ’s) is absorbed at S , so we have k X i =1 F ( ˆ w ) i ≤ k X i =1 ˆ w i . (3)Putting this together with (2), we get an equality in (3). In particular, v j is the only vertexwhose inflow value was capped (by one), all emitted flow is absorbed at S , and no flow arrivesat d or d .But this is a contradiction to ˆ w j = N = 2 n : By the same arguments as in the proof ofLemma 1, based on flow conservation (at all v = v j ) and switching behavior, one of these 2 n outflow units is guaranteed to arrive at { d, d } . (cid:3) SUBEXPONENTIAL ALGORITHM FOR ARRIVAL
In this section, we present our main application of the general framework developed in theprevious section.Given a terminating ARRIVAL instance A with | V | = n , the plan is to construct a set S ⊆ V of size O ( √ n ) such that from any vertex, the length of the shortest path in G ( A ) to a vertexin S ∪ { d, d } is also bounded by roughly O ( √ n ). Since S is that small, we can find the runprofile with a subexponential number of F -evaluations; and since shortest paths are that short,each F -evaluation can also be done in subexponential time using the Multi-Run procedure. Anoverall subexponential algorithm ensues. Lemma 10.
Let A = ( V, o, d, d, s even , s odd ) be a terminating ARRIVAL instance with | V | = n .Let φ ∈ (0 , be a real number. In O ( n ) time, we can construct a φ -set S , meaning a set S ⊆ V such that (i) | S | ≤ φ · ( n + 2) ; (ii) for all v ∈ V , the shortest path from v to S ∪ { d, d } in G ( A ) has length at most log ( n + 2) /φ .Proof. We adapt the ball-growing technique of Leighton and Rao [16], as explained by Tre-visan [20].We first decompose the switch graph G ( A ) into layers based on the distance of the vertices to adestination [11]. More formally, for v ∈ V ∪ { d, d } , we denote by dist( v ) the length of the shortestpath from v to { d, d } in G ( A ). Then the layers are defined as L i := { v ∈ V ∪ { d, d } : dist( v ) = i } for i ≥
0. Define ‘ := max { dist( v ) : v ∈ V } . We can compute the layer decomposition( L , . . . , L ‘ ) using breadth-first search in O ( n ) time.Consider the following procedure that computes a φ -set as a union of layers: SUBEXPONENTIAL ALGORITHM FOR ARRIVAL 11
Algorithm 3:
Procedure to compute a φ -set Input:
ARRIVAL instance with layer decomposition ( L , . . . , L ‘ ), φ ∈ (0 , Output: a φ -set SS ← ∅ U ← L for i = 1 , . . . , ‘ doif | L i | < φ | U | then S ← S ∪ L i U ← ∅ U ← U ∪ L i return S It is clear that the procedure is done in O ( n ) time. To prove (i), we observe that wheneverwe add a layer L i to S , we have | L i | < φ | U | ; moreover, the U ’s considered in these inequalitiesare mutually disjoint subsets of V ∪ { d, d } . Hence, | S | < φ · ( n + 2).For (ii), let v ∈ V . Then v ∈ L b for some b ≥
1. Let 0 ≤ a ≤ b be the largest index such that L a ⊆ S ∪ { d, d } . Then the shortest path from v to a vertex in S ∪ { d, d } has length at most b − a . It remains to bound j := b − a . The interesting case is j > a -th iteration, we have | U | = | L a | ≥
1. Moreover, | L i | ≥ φ | U | for i = a + 1 , . . . , b , meaning that for each iteration i in this range, the size of U hasgrown by a factor of at least 1 + φ . Hence, after the b -th iteration, (1 + φ ) j ≤ | U | ≤ n + 2. Thisimplies j ≤ log ( n + 2) / log (1 + φ ) < log ( n + 2) /φ , where we use the inequality log (1 + φ ) > φ for φ ∈ (0 , (cid:3) Theorem 11.
Let A = ( V, o, d, d, s even , s odd ) be a terminating ARRIVAL instance with | V | = n . A can be decided (and the run profile be computed) in time O ( p ( n ) n √ n ) , for some polynomial p .Proof. By Lemma 10, we can find a φ -set S in O ( n ) time, for any φ ∈ (0 , | S | ≤ φ · ( n +2), byLemma 9, we can then decide A with O ( n φ · ( n +2) ) evaluations of the function D . Each evaluationin turn requires us to evaluate the function F in Theorem 6 (ii) for a given w ∈ { , , . . . , n } | S | .We can do this by applying Algorithm 2 (Multi-Run Procedure). By Lemma 8 and thedefinition of a φ -set in Lemma 10, running this algorithm in a greedy fashion requires at most(ln W + n )( n − | S | )(( n − ‘ + 2)2 ‘ −
2) iterations, where W = 1 + P | S | i =1 w i and ‘ = log ( n + 2) /φ .Further, from the choice of w , we have W ≤ n φ ( n + 2) + 1. Therefore, the number of iterationsis O ( q ( n ) n /φ ) for some polynomial q . At each iteration, we need to find the vertex with thehighest number of waiting trains, as stated in Lemma 8, and move the trains from the chosenvertex. All these operations take polynomial time.In total, the runtime of the whole process is O ( n φ · ( n +2) · p ( n ) n /φ ) for some polynomial p .Choosing φ = 1 / √ n , the runtime becomes O ( p ( n ) n √ n ). (cid:3) FEEDBACK VERTEX SETS
In the previous section, we used our framework to obtain an improved algorithm for ARRIVALin general. In this section, we will instantiate the framework differently to obtain a polynomial-time algorithm for a certain subclass of ARRIVAL.A subset S ⊆ V of vertices in a directed graph G = ( V, E ) is called a feedback vertex set ifand only if the subgraph induced by V \ S is acyclic (i.e. it contains no directed cycle). Karp [14]showed that the problem of finding a smallest feedback vertex set is NP -hard. However, there exists a parameterized algorithm by Chen et al. [2] which can find a feedback vertex set of size k in time O ( n k k k !) in a directed graph on n vertices, or report that no such set exists.If we apply Theorem 6 with a feedback vertex set S , it turns out that we can compute theMulti-Run profile in polynomial time, meaning that we get a polynomial-time algorithm forARRIVAL if there is a feedback vertex set of constant size k . Theorem 12.
Let A = ( V, o, d, d, s even , s odd ) be a terminating ARRIVAL instance with graph G ( A ) . If G ( A ) has a feedback vertex set S ⊆ V of size k (assumed to be fixed as n = | V | → ∞ ),then A can be decided in time O ( n + n k +1 ) .Proof. Using the algorithm by Chen et al. [2], we can find a feedback vertex set S in O ( n )time if it exists. According to Lemma 9, we can then decide A with O ( n k − ) evaluations of thefunction D if k ≥ O ( n k ) evaluations of the function D if k <
3. Each evaluation inturn requires us to evaluate the function F in Theorem 6 (ii) for a given w ∈ { , , . . . , n } k .To do this, we apply Algorithm 2 (Multi-Run Procedure) where we pick vertices v ∈ V \ S intopological order and choose τ = t [ v ] always. As we never send any trains back to verticesthat have previously been picked, we terminate within n − k iterations, each of which can beperformed in time O ( n ) as it involves O ( n )-bit numbers. Hence, F ( w ) can be computed in O ( n )time.In total, for k ≥
3, the runtime is O ( n + n k +1 ). For k <
3, the runtime is O ( n + n k +2 ) = O ( n ).Hence, the claimed runtime holds for all k . (cid:3) We remark that even if k is not constant, we can still beat the subexponential algorithm inSection 4, as long as k = O ( n α ) for some α < / References [1]
Ani, J., Demaine, E. D., Hendrickson, D. H., and Lynch, J.
Trains, games, and complexity: 0/1/2-playermotion planning through input/output gadgets, 2020.[2]
Chen, J., Liu, Y., Lu, S., O’Sullivan, B., and Razgon, I.
A fixed-parameter algorithm for the directedfeedback vertex set problem.
J. ACM 55 , 5 (2008), Art. 21, 19.[3]
Condon, A.
The complexity of stochastic games.
Information and Computation 96 , 2 (1992), 203 – 224.[4]
Cooper, J., Doerr, B., Spencer, J., and Tardos, G.
Deterministic random walks on the integers.
European Journal of Combinatorics 28 , 8 (2007), 2072 – 2090. EuroComb ’05 - Combinatorics, Graph Theoryand Applications.[5]
Dang, C., Qi, Q., and Ye, Y.
Computations and complexities of Tarski’s fixed points and supermodulargames, 2020.[6]
Dohrau, J., Gärtner, B., Kohler, M., Matoušek, J., and Welzl, E.
ARRIVAL: a zero-player graphgame in NP ∩ coNP . In A journey through discrete mathematics . Springer, Cham, 2017, pp. 367–374.[7]
Fearnley, J., Gairing, M., Mnich, M., and Savani, R.
Reachability switching games. In , vol. 107 of
LIPIcs. Leibniz Int. Proc. Inform.
SchlossDagstuhl. Leibniz-Zent. Inform., Wadern, 2018, pp. Art. No. 124, 14.[8]
Fearnley, J., Gordon, S., Mehta, R., and Savani, R.
Unique end of potential line.
J. Comput. SystemSci. 114 (2020), 1–35.[9]
Fearnley, J., and Savani, R.
A faster algorithm for finding Tarski fixed points, 2020.[10]
Gärtner, B., Hansen, T. D., Hubáček, P., Král, K., Mosaad, H., and Slívová, V.
ARRIVAL: nextstop in CLS. In , vol. 107 of
LIPIcs. Leibniz Int. Proc. Inform.
Schloss Dagstuhl. Leibniz-Zent. Inform., Wadern, 2018, pp. Art. No. 60,13.[11]
Gärtner, B., and Hoang, H. P.
ARRIVAL with two vertices per layer. Manuscript in preparation, 2021.[12]
Holroyd, A. E., and Propp, J.
Rotor walks and Markov chains. In
Algorithmic probability and combinatorics ,vol. 520 of
Contemp. Math.
Amer. Math. Soc., Providence, RI, 2010, pp. 105–126.[13]
Jurdziński, M.
Deciding the winner in parity games is in UP ∩ co-UP. Information Processing Letters 68 , 3(1998), 119 – 124.
SUBEXPONENTIAL ALGORITHM FOR ARRIVAL 13 [14]
Karp, R. M.
Reducibility among combinatorial problems. In
Complexity of computer computations (Proc.Sympos., IBM Thomas J. Watson Res. Center, Yorktown Heights, N.Y., 1972) (1972), pp. 85–103.[15]
Karthik, C. S.
Did the train reach its destination: the complexity of finding a witness.
Inform. Process.Lett. 121 (2017), 17–21.[16]
Leighton, T., and Rao, S.
Multicommodity max-flow min-cut theorems and their use in designingapproximation algorithms.
J. ACM 46 , 6 (1999), 787–832.[17]
Priezzhev, V. B., Dhar, D., Dhar, A., and Krishnamurthy, S.
Eulerian walkers as a model ofself-organized criticality.
Phys. Rev. Lett. 77 (1996), 5079–5082.[18]
Rote, G.
Personal communication, 2020.[19]
Tarski, A.
A lattice-theoretical fixpoint theorem and its applications.
Pacific J. Math. 5 (1955), 285–309.[20]
Trevisan, L.
Approximation algorithms for unique games. In (2005), pp. 197–205.[21]
Zwick, U., and Paterson, M.
The complexity of mean payoff games on graphs.