Abstract 1 Introduction 2 Preliminaries 3 Prelude: An 𝓞(𝟐𝒏/𝟐)-time algorithm for ARRIVAL 4 Stopping SSG on ladders in polynomial time 5 ARRIVAL on ladders in polynomial time 6 Concluding remarks References

Sinks and Ladders: ARRIVAL and SSG with Two Vertices per Level

Bernd Gärtner ORCID Department of Computer Science, ETH Zürich, Switzerland Sebastian Haslebacher ORCID Department of Computer Science, ETH Zürich, Switzerland Hung P. Hoang ORCID Algorithms and Complexity Group, Faculty of Informatics, TU Wien, Austria
Abstract

ARRIVAL is the problem of deciding whether a token, following a deterministic process, eventually reaches a designated destination. While the problem is known to lie in 𝖭𝖯𝖢𝗈𝖭𝖯, whether it can be solved in polynomial time remains a major open question. In this article, we study ladders, a class of graphs that constitutes a family of worst-case instances for many existing algorithms, including the currently best known algorithm by Gärtner, Haslebacher, and Hoang (ICALP 2021). We show that ARRIVAL restricted to ladders can be solved in polynomial time, and we further extend this result to stopping binary simple stochastic games (SSG). This article is partly based on an unpublished work in the thesis of the last author [14].

Keywords and phrases:
ARRIVAL, Rotor-Routing, Simple Stochastic Games
Funding:
Hung P. Hoang: Austrian Science Foundation (FWF, project ESP1136425).
Copyright and License:
[Uncaptioned image] © Bernd Gärtner, Sebastian Haslebacher, and Hung P. Hoang; licensed under Creative Commons License CC-BY 4.0
2012 ACM Subject Classification:
Theory of computation Graph algorithms analysis
Acknowledgements:
We are grateful to three anonymous referees for their helpful comments.
Editor:
John Iacono

1 Introduction

ARRIVAL is the following decision problem, first introduced by Dohrau, Gärtner, Kohler, Matoušek, and Welzl [7]. As the input, we are given a directed graph G with a designated origin 𝐨 and two designated destinations, 𝟏 and 𝟎.111In the literature, the two sinks are often called d and d¯. However, in this paper, as we want to emphasize a parallel between ARRIVAL and simple stochastic games, we call them 𝟏 and 𝟎 instead. Every other vertex has two outgoing edges, with one edge marked as even edge and the other as odd edge. We place a token on 𝐨 and move it according to the following deterministic rule: At every vertex, if the token has visited it an even number of times, the token traverses the even edge; otherwise, it takes the odd edge. The task is to decide whether the token eventually reaches 𝟏. See Figure 1 for an example.

This simple deterministic process has appeared in many contexts. Most notable is the study of deterministic simulations of a random walk under different names, such as Eulerian walkers [16], rotor-router walks [15], and Propp machines [6]. It also naturally arises from combinatorial games. The introduction of ARRIVAL problem by [7] was inspired by an online game called Looping Piggy developed by Gärtner for Kinderlabor, an initiative for computer science education in kindergartens. The latest reporting of a similar problem is in a blog post by Aaronson [1], also motivated by a children’s game. As the author pointed out in the post, this in turn is a rediscovery of a result back in 1994 [4].

Arguably one of the main attractions of ARRIVAL is its curious complexity status. It is shown in [7] that the problem lies in 𝖭𝖯𝖢𝗈𝖭𝖯. Subsequent papers have established more specific results, such as the membership in 𝖴𝖯𝖢𝗈𝖴𝖯 [10] and NL-hardness [8] as well as containment in subclasses of 𝖳𝖥𝖭𝖯 [10, 9], but one key question remains wide open: Is ARRIVAL in 𝖯?

Two common approaches to tackle this question are finding a faster algorithm for a general instance and expanding the classes of graphs where a polynomial-time algorithm for ARRIVAL exists. For the first approach, the best algorithm so far runs in subexponential time 2𝒪(nlogn) [11], where n is the number of non-sinks in the graph. For the second approach, there have been (quasi-)polynomial-time algorithms on tree-like multigraphs [2, 12], path-like multigraphs [3], and bounded treewidth [13]. Notably, most of these results also extend to a more generalized variant with multiple tokens.

Figure 1: An ARRIVAL instance on ladder. Bold edges are even edges. The vertices are also grouped by level, where Li are vertices with distance i from the destinations.

Contributions.

This paper contributes towards the second approach above. In particular, we consider the class of graphs where for every i, there are either no or exactly two vertices of distance i to the destinations (i.e., the length of the shortest path to either 𝟎 or 𝟏 is i); see Figure 1 for an example. These graphs, which we call ladders, capture one of the worst cases for the current state-of-the-art subexponential algorithm [11] and also for another deterministic algorithm, which we elaborate in Section 3. It turns out that ladders have an interesting structural property, expressed in terms of hitting properties of a Markov chain, which we can exploit to design a polynomial-time algorithm for ARRIVAL; see Section 5. Note that the technique used for this case is different than most of the existing algorithms for ARRIVAL, as we do not simulate the movement of the token in any way. Instead, we progressively and simultaneously construct a witness for a YES-instance and a witness for a NO-instance, and whichever fails first helps us decide the instance.

Moreover, ARRIVAL has a very close connection to Simple Stochastic Games (SSG), a famous problem that shares the same complexity status: It is also in 𝖭𝖯𝖢𝗈𝖭𝖯 but not known to be in 𝖯. While there has been no reduction between these two problems, they share many parallels; see [13] for a recent discussion. Due to this connection, we also explore how SSG can be solved on ladders. Using an analogous observation on the hitting probabilities, we can derive a simple polynomial-time algorithm for SSG on ladders; see Section 4.

2 Preliminaries

A binary graph is a directed simple graph G=(V,E) such that there are exactly two sinks 𝟏 and 𝟎 (i.e., these two vertices have no outgoing edges). All other vertices have exactly two outgoing edges. We also assume that it is possible to reach at least one of the two sinks starting at any vertex. In this paper, we define n:=|V|2; that is n is the number of non-sinks in the graph.

For a vertex vV, denote by d(v) the distance of v to either of the sinks, i.e. d(v) is the length of a shortest path (number of edges) in the graph G from v to either 𝟏 or 𝟎. In particular, we have d(𝟏)=d(𝟎)=0. For i, let Li{vV:d(v)=i} denote the set of vertices of distance exactly i from the sinks. We call Li the i-th levelset and call (L0,L1,) the level decomposition of G. Observe that we can compute the level decomposition of G in linear time by inverting all edge directions and starting a multi-source breadth-first search with sources 𝟏 and 𝟎.

An edge (u,v) is a forward edge if v is closer to the sinks than u (i.e., u in Li and v in Li1 for some i). Otherwise, we call (u,v) a backward edge. Note that a backward edge may connect two vertices in the same levelset.

A binary graph G is a ladder, if every non-empty levelset of G consists of exactly two vertices, except for the last non-empty levelset which may consist of a single vertex. In other words, let (L0,L1,) be the level decomposition of G; then G is a ladder, if |Li|2 for all i and |Li|<2 implies |Lj|=0 for all i,j with i<j.

2.1 ARRIVAL

For a binary graph G=(V,E), a partition (E0,E1) of the edge set E is balanced, if every vertex vV{𝟎,𝟏} has exactly one outgoing edge in E0 and one outgoing edge in E1. We call these edges the even edge and the odd edge of v and denote them by (v,s0(v)) and (v,s1(v)), respectively. Then an instance of ARRIVAL is defined formally as a tuple of a binary graph G=(V,E), a designated source vertex 𝐨V, and a balanced partition of E into E0 and E1.

Given such an instance of ARRIVAL, consider moving a token along the edges of the graph according to the following rules: Whenever the token reaches a vertex v, it follows the even edge of v if it has been at v an even number of times already. Otherwise, it follows the odd edge of v. This results in the token effectively switching between the two outgoing edges at every vertex. The process finishes once the token reaches one of the two sinks. The problem is to decide which of the two sinks the token will end up at.

2.2 (Binary) SSG

Following roughly the definition given by Condon [5], a (binary) Simple Stochastic Game (SSG) is played on a binary graph G=(V,E) with V=VmaxVminVavg{𝟎,𝟏}. Moreover, one of the vertices 𝐨V{𝟎,𝟏} is considered the designated source.

The game works as follows: For every vertex vVmax, the so-called max-player chooses one of the outgoing edges of v. Next, the min-player chooses one outgoing edge for every vVmin. A token is then placed on 𝐨 and starts moving along the directed edges of the graph. Whenever the token reaches a vertex vVmax, the token follows the outgoing edge that was chosen by the max-player for this vertex. Analogously, the edges chosen by the min-player determine where the token moves to from vertices in Vmin. When the token reaches an average vertex vVavg, an outgoing edge of v is chosen uniformly at random and the token continues along this edge. The game ends when the token reaches either of the sinks 𝟎 or 𝟏. The max-player wins if the token eventually reaches 𝟏. If the token never reaches 𝟏, the min-player wins. This can happen if the token reaches 𝟎 instead or if it continues traversing the graph indefinitely without ever reaching any of the sinks.

A (positional) strategy σ for the max-player is a function σ:VmaxE that assigns each vertex vVmax one of its outgoing edges. If the max-player plays according to the strategy σ, this means that whenever the token reaches a vertex vVmax, it will continue along the outgoing edge σ(v). Analogously, a strategy τ for the min-player is a function τ:VminE that assigns to each vertex in Vmin one of its outgoing edges.

We denote by Gσ,τ the graph that we obtain if we delete outgoing edges from vertices in VmaxVmin that are not used by σ and τ. In other words, Gσ,τ is the graph restricted to the strategies σ,τ. This can be thought of as a Markov chain: Vertices in VmaxVmin have exactly one outgoing edge that is taken with probability 1, vertices in Vavg have two outgoing edges each with a transition probability of 12. Given strategies σ,τ and a vertex vV, the value (or hitting probability) hσ,τ(v) is the probability that a token starting at vertex v will eventually hit 𝟏 in the Markov chain Gσ,τ. In other words, this is the probability of the max-player winning the game if the players play according to σ and τ and the token starts at v. The optimal value h(v) of a vertex vV is defined as h(v)maxσminτhσ,τ(v).

The computational problem SSG is to decide whether h(𝐨)>12 or not, where h(𝐨) is the optimal value of the designated source.

An SSG is called stopping if and only if a sink is reachable from every vertex in the graph Gσ,τ for all strategies σ and τ of the players. In other words, in a stopping game, the probability of the token looping indefinitely in the graph without ever reaching a sink is zero, regardless of the played strategies. There is a well-known trick that reduces SSGs to stopping SSGs [5]. However, using it for SSGs on ladders would destroy the ladder structure of the underlying graph. Hence, in this article, we only consider stopping SSGs on ladders.

3 Prelude: An 𝓞(𝟐𝒏/𝟐)-time algorithm for ARRIVAL

As a motivation for studying ladders, consider the following simple algorithm for ARRIVAL that runs in time 𝒪(2n/2). Note that this algorithm has been discovered independently by Rote [17], who also bootstrapped it into a 𝒪(2n/3)-time algorithm.

Suppose we are given an instance of ARRIVAL consisting of the binary graph G, 𝐨V, and a balanced partition (E0,E1) of the edge set. Let (L0,L1,) be the level decomposition of G. Now assume there is a vertex w in some levelset Lk such that all forward edges from Lk+1 (i.e., all edges from a vertex in Lk+1 to a vertex in Lk) have w as the target. Let G be the graph obtained from G by contracting all vertices in j>kLj to w; that is, we replace every edge (u,v) such that d(v)>k by (u,w) and then remove all vertices in j>kLj and their outgoing edges. Let 𝐨 be w if d(𝐨)>k and be 𝐨 otherwise. Finally, let (E0,E1) be the balanced partition of E(G) obtained from (E0,E1) through the process of replacement and deletion above.

Lemma 1.

(G,𝐨,E0,E1) is a YES ARRIVAL instance, if and only if (G,𝐨,E0,E1) is also a YES ARRIVAL instance.

Proof.

Let S and S be the sequences of vertices that the token visits for (G,𝐨,E0,E1) and (G,𝐨,E0,E1), respectively. We prove by induction the claim that every prefix of S can be obtained from some prefix of S by removing vertices in j>kLj. For the base case, suppose d(𝐨)>k. Observe that the token only terminates when it visits a vertex in L0 (i.e., 𝟏 or 𝟎); and by the construction of the level decomposition, after visiting u, the token has to visit at least one vertex in each of the levelsets between Ld(u) and L0. This implies that it has to visit w, and until the first time it visits w after this visit at u, the token only visits vertices in layers Lj for j>k. Hence, S contains a prefix that ends with w and otherwise contains only vertices in j>kLj. Since 𝐨=w when d(𝐨)>k, the claim then holds for the prefix (𝐨) of S. Note that it trivially holds for this prefix when d(𝐨)k, since in this case 𝐨=𝐨.

For the inductive step, suppose for some prefix P of S, we have the corresponding prefix P of S as guaranteed by the claim. Note that we can choose P such that P and P end at the same vertex v. Suppose the vertex after P in S is u. If d(u)k, then the vertex after P in S is also u, since at this point, the token should have visited v the same number of times in both G and G. Otherwise, the token visits w next in P, since u should have been contracted to w when we constructed G from G. By a similar argument as above, we also conclude that after P in S, there is a substring that ends with w and otherwise contains only vertices in j>kLj. Concatenating this substring to P, we obtain a prefix in S corresponding to the prefix resulting from the concatenation of P and w in S, as required by the claim. This completes the proof of the claim.

Since 𝟎 and 𝟏 are not contracted, the lemma then follows from the claim above.

We are now ready to describe our algorithm: If there exists a levelset with only one vertex, let k be the smallest index such that |Lk|=1, and let w be the only vertex in layer Lk. Let (G,𝐨,E0,E1) be the graph obtained by performing the contractions described above. If there exists no such levelset, then we define (G,𝐨,E0,E1) to be the same as the original instance. Next, we simulate the movement of the token in G until it reaches 𝟎 or 𝟏. By Lemma 1, we can then decide the original instance accordingly.

As shown in [11], the number of steps the token takes is 𝒪(2k), since k is the highest index of a nonempty levelset for G. By the choice of k, we obtain that kn/2, and it attains the maximum, when there are exactly two vertices per non-empty levelset, except for potentially the last such levelset (i.e., when the graph is a ladder). In other words, the ladders capture a class of “hard” instances for the algorithm above (i.e., instances for which the algorithm runs the longest). Interestingly, they are also hard instances for the current state-of-the-art algorithms for ARRIVAL [11].

4 Stopping SSG on ladders in polynomial time

Since the arguments for SSG is simpler than for ARRIVAL, we present first the polynomial-time algorithm for stopping SSGs on ladders in this section.

Theorem 2.

Stopping SSG can be solved in polynomial time on ladders.

Our algorithm roughly works as follows: We start at the levelset L0. It contains the two sinks 𝟎 and 𝟏 and we know that h(𝟎)=0<1=h(𝟏). Now consider the next levelset L1 and assume it contains the two vertices u and v. We claim that by looking at forward edges of u and v, and by considering which types of vertices u and v are (max, min, or avg), we can figure out whether h(u)<h(v) or not. Moreover, we can repeat this for the other levelsets. Combined with a further observation, we can deduce a total order on the optimal values of all vertices which allows us to solve the SSG.

For the rest of this section, assume that we are given a stopping SSG on a ladder as defined in Section 2 with k being the smallest number such that |Lk|<2. In particular, this implies |Li|=2 for all i with i<k, and |Li|=0 for all i with i>k. By adding up to two new vertices (e.g. to Vavg) with outgoing edges to vertices from Lk1, we also get |Lk|=2. This does not change the game since these new vertices have no incoming edges and will never be visited by the token. Hence, from now on we assume |Li|=2 for all i{0,1,,k}.

4.1 Optimal values within levelsets

The first ingredient for our algorithm is to find out which of the two vertices in each levelset has larger optimal value. For this, consider the following definition.

Definition 3.

For every i{0,1,,k}, define iLi to be a vertex iargminvLih(v), and define uiLi such that uii, i.e. ui is the other vertex in Li. Note that this implies h(ui)=maxvLih(v).

In particular, we have 0=𝟎 and u0=𝟏. The following observation will be crucial.

Lemma 4.

For every i{1,,k}, we have h(i1)h(i)h(ui)h(ui1).

Proof.

Let i{1,,k} be arbitrary and assume σ,τ are optimal strategies. In particular, we have hσ,τ(v)=h(v) for all vV. Assume the token is currently at i and recall that we assume that the game is stopping. Consider any walk of the token through the graph eventually ending at a sink. The walk has to pass through i1 or ui1 which implies that h(i) is a convex combination of h(i1) and h(ui1). The same argument works for ui (and in fact all vertices in levelsets Li,,Lk). The goal of this subsection hence becomes determining i and ui for each i{0,1,,k}. As we have observed, we already know this for i=0.

We process the remaining levelsets iteratively going from i=1 up to i=k. Assume that we are in iteration i and hence know i1 and ui1. We are trying to determine i and ui.

Lemma 5 (one max-vertex).

Assume there is a vertex vLiVmax, and let w denote the other vertex in Li. Then h(w)h(v).

Proof.

We distinguish two cases: assume first that v has a forward edge with target ui1. The best strategy for the max-player is to use this edge since it will yield h(v)=h(ui1) which is best possible according to Lemma 4. We conclude that h(w)h(ui1)=h(v), as desired.

Thus, assume now that v has no forward edge to ui1. Then the outgoing edges of v are (v,i1) and (v,z) with zLj for some ji. By Lemma 4, we have h(z)h(i1) and hence it is optimal for the max-player to choose the edge (v,z). This again means that under optimal strategies, a token starting at z needs to go through w in order to get to a sink. Hence, we get h(z)=h(w)=h(v).

Analogously, we can prove the following lemma.

Lemma 6 (one min-vertex).

Assume there is a vertex vLiVmin, and let w denote the other vertex in Li. Then h(v)h(w).

Proof.

We again distinguish two cases: assume first that v has a forward edge with target i1. The best strategy for the min-player is to use this edge since it will yield h(v)=h(i1) which is best possible according to Lemma 4. We conclude that h(w)h(i1)=h(v), as desired.

Thus, assume now that v has no forward edge to i1. Then the outgoing edges of v are (v,ui1) and (v,z) with zLj for some ji. By Lemma 4, we have h(z)h(ui1) and hence it is optimal for the min-player to choose the edge (v,z). This again means that under optimal strategies, a token starting at z needs to go through w in order to get to a sink. Hence, we get h(z)=h(w)=h(v).

Finally, we consider the case where both vertices are average vertices in Lemma 7 and 8.

Lemma 7 (average vertices I).

Assume that the two vertices v,wLi with vw are both average vertices, i.e. v,wVavg. If the edge (v,i1) exists but the edge (v,ui1) does not exist, then we have h(v)h(w).

Proof.

Assume first that the edge (w,ui1) exists, and let (v,z) and (w,y) be the remaining outgoing edges of v and w. Observe that both z and y are in one of the levelsets Li1,,Lk and hence we have h(i1)h(z)h(ui1) and h(i1)h(y)h(ui1). We conclude that indeed h(v)=12h(i1)+12h(z)12h(y)+12h(ui1)=h(w).

Thus, assume now that (w,ui1) does not exist. Then the edge (w,i1) must exist instead. Let (v,z) and (w,y) be the remaining outgoing edges of v and w. Observe that all paths from z,y,v,w to any of the sinks must go through i1. Hence, we get h(y)=h(z)=h(v)=h(w)=h(i1).

Lemma 8 (average vertices II).

Assume that the two vertices v,wLi with vw are both average vertices, i.e. v,wVavg. If the edge (v,ui1) exists but the edge (v,i1) does not exist, then we have h(v)h(w).

Proof.

Assume first that the edge (w,i1) exists, and let (v,z) and (w,y) be the remaining outgoing edges of v and w. Observe that both z and y are in one of the levelsets Li1,,Lk and hence we have h(i1)h(z)h(ui1) and h(i1)h(y)h(ui1). We conclude that indeed h(v)=12h(ui1)+12h(z)12h(y)+12h(i1)=h(w).

Thus, assume now that (w,i1) does not exist. Then the edge (w,ui1) must exist instead. Let (v,z) and (w,y) be the remaining outgoing edges of v and w. Observe that all paths from z,y,v,w to any of the sinks must go through ui1. Hence, we get h(y)=h(z)=h(v)=h(w)=h(ui1).

The only remaining case is the one where both average vertices have edges to both i1 and ui1.

Lemma 9 (average vertices III).

Let v,wLi with vw be the two vertices in levelset Li and assume that none of the Lemmas 5-8 apply. Then h(v)=h(w).

Proof.

If none of the Lemmas 5-8 apply, then v,w must be average vertices, both with edges to ui1 and i1. Hence, we have h(v)=h(w).

We conclude that we can determine i and ui in constant time by just looking at i1,ui1 and the two vertices v,wLi as well as their outgoing edges.

4.2 The algorithm

In Section 4.1 we proved that we can find i and ui in polynomial time for all i{0,1,,k}. From Lemma 4, we know that this gives us a total order

h(0)h(1)h(k)h(uk)h(uk1)h(u0)

on the optimal values of all vertices in the graph. From this total order, we can directly derive optimal strategies σ,τ for both players. More precisely, for each vertex in Vmax, we keep the outgoing edges to the out-neighbor with the higher value, while for each vertex in Vmin, we keep the edge to the one with the lower value. Finally, we can solve the Markov chain Gσ,τ to obtain the optimal value h(𝐨) and decide the game in polynomial time.

5 ARRIVAL on ladders in polynomial time

This section is wholly dedicated to show the following.

Theorem 10.

ARRIVAL can be solved in polynomial time on ladders.

We start by some structural observations on ladders in Section 5.1. Next, in Section 5.2, we define switching flows and recap the result that integral switching flows are certificates for whether an ARRIVAL instance is a YES- or a NO-instance. Then we give an overview of our polynomial-time algorithm in Section 5.3. After that, we explain the key lemma in Section 5.4 and the main technical recursive argument of the algorithm in Section 5.5. Finally, we wrap up the algorithm in Section 5.6.

For the rest of this section, we consider an ARRIVAL instance on a ladder G=(V,E) with a designated source 𝐨 and a balanced partition (E0,E1) of the edges E. Let (L0,L1,) be the level decomposition of G. Similar to Section 4, we also assume that there exists k such that |Li|=2 for i{0,,k} and |Li|=0 for i>k.

5.1 Zero-player hitting probabilities

Consider the Markov chain on the ladder G, where the transition probability of every edge is 12. That is, from every vertex in V{𝟏,𝟎}, there is an equal probability to visit one of its two out-neighbors next. Let h~G(v) be the hitting probability at vertex v in this Markov chain. In other words, h~G(v) is exactly the optimal h(v) of the SSG on G where Vmax=Vmin=. For this reason, we call this the zero-player hitting probability. We drop the subscript G from h~G when the graph G is clear from context.

As explained in Section 4, in polynomial time, we can label the two vertices in each levelset Li for i{0,,k} as i and ui such that 0=𝟎, u0=𝟏, and

0=h~(0)h~(1)h~(k)h~(uk)h~(uk1)h~(u0)=1. (1)

Next, we can assume without loss of generality that (k,k1,,0) and (uk,uk1,,u0) are two directed paths in G. Indeed, suppose for some i{1,,k}, there is no edge from i to i1. (The case of the missing edge (ui,ui1) can be argued analogously.) Then i must have an edge to ui1. By Lemma 8, h~(ui)h~(i). Combined with (1), this implies that h~(ui)=h~(i). If ui has an edge to i1, we can exchange the labels of ui and i, and after this relabeling, we have the edges (i,i1) and (ui,ui1). Otherwise, the target of all forward edge(s) of ui is ui1. This means that all vertices of Li have their forward edges to ui1. Then by using the same argument as in Section 3, we can contract all vertices in jiLj to ui1.

Finally, for each vertex vV{𝟎,𝟏}, we define the gap gG(v):=h~G(v)h~G(s0(v))=(h~G(v)h~G(s1(v))). We also drop the subscript G from gG when the graph G is clear. The following lemma shows a crucial structural property of ladders that allows us to design an efficient algorithm later.

Lemma 11.

vV{𝟎,𝟏}|g(v)|=1+h~(k)h~(uk)1.

Proof.

Figure 2: Illustration of Lemma 11. The points represent the h~ values from smallest to largest. Note that each |g(v)| is the distance between some two consecutive points. Hence, the sum vg(v)+(h~(uk)h~(k)) is the distance between h~(u0) and h~(0), which is exactly one.

See Figure 2 for an illustration of the following proof. For each vertex vV{𝟎,𝟏}, |g(v)| is the absolute difference between the h~-value of v and that of any its out-neighbor. Combining this with (1) and the fact that (k,k1,,0) and (uk,uk1,,u0) are two directed paths in G, we have for i{1,,k},

|g(i)| =h~(i)h~(i1),
|g(ui)| =h~(ui1)h~(ui).

Therefore,

vV{𝟎,𝟏}|g(v)| =i{1,,k}|g(i)|+i{1,,k}|g(ui)|
=i{1,,k}(h~(i)h~(i1))+i{1,,k}(h~(ui1)h~(ui))
=(h~(k)h~(0))+(h~(u0)h~(uk))
=1+(h~(k)h~(uk))1.

The last line above follows from (1). Specifically, the equality follows from the facts that h~(0)=0 and h~(u0)=1, while the inequality follows from the fact that h~(k)h~(uk).

5.2 Switching Flows

Switching flows were first introduced in [7]. We define them here more generally.

Definition 12 (Switching Flow).

Given a binary graph G=(V,E), a balanced partition (E0,E1) of E, and a function φ:V{𝟎,𝟏}, a switching flow with respect to (V,E0,E1,φ) is a function x:E0 satisfying the equations

u:(v,u)Ex(v,u)u:(u,v)Ex(u,v) =φ(v)
0x(v,s0(v))x(v,s1(v)) 1

for all vV{𝟎,𝟏}.

Definition 13 (Inflow and Outflow).

Given a binary graph G=(V,E), a balanced partition E=E0E1, and a function φ:V{𝟎,𝟏}, and a switching flow x with respect to (V,E0,E1,φ), we call x(v):=u:(u,v)Ex(u,v) the inflow of vV. Analogously, we call x+(v):=u:(v,u)Ex(v,u) the outflow of vV.

We distinguish between different types of switching flows.

Definition 14 (Types of Switching Flows).

Suppose we are given a binary graph G=(V,E), a balanced partition (E0,E1) of E, a function φ:V{𝟎,𝟏}, and a switching flow x with respect to (V,E0,E1,φ). We use the following adjectives to define different types of switching flows.

  • We call x integral if x(e) for all eE.

  • Suppose for some 𝐨V, φ satisfies φ(𝐨)=1 and φ(v)=0 for v𝐨. Then we say x is a switching flow from 𝐨.

  • Finally, we call x a switching flow to 𝟏 if x(𝟎)=0, and we call it a switching flow to 𝟎 if x(𝟏)=0.

The following result goes back to Dohrau, Gärtner, Kohler, Matoušek, and Welzl [7] and implicitly proves that ARRIVAL is in 𝖭𝖯𝖢𝗈𝖭𝖯.

Theorem 15 (Switching Flows are Certificates [7]).

An instance of ARRIVAL has an integral switching flow from the origin 𝐨 to 𝟏 if and only if the token eventually arrives at 𝟏. Analogously, it has an integral switching flow from the origin 𝐨 to 𝟎 if and only if the token ends up at 𝟎.

In other words, in order to solve ARRIVAL, it suffices to find an integral switching flow.

5.3 Overview of the algorithm

As we have seen in the previous subsection, one way to try to solve ARRIVAL is to solve its integer linear program (ILP) formulation implicitly given in Definition 12 together with the constraints that all variables are integral. Unfortunately, we do not know how to solve this ILP fast. However, we can easily obtain a (not necessarily integral) switching flow by solving the linear system in Definition 12 in polynomial time. In fact, for each of the two sinks, we can efficiently check if there exists a switching flow to that sink. The non-existence of a switching flow to one sink suffices to decide ARRIVAL. Thus, the interesting case is when there are two switching flows from 𝐨, one to 𝟏 and one to 𝟎.

The general idea to solve this case is as follows. We start with the two switching flows above. At every iteration, we attempt to make more values in the two switching flows to be integral, while maintaining that one switching flow is from 𝐨 to 𝟏 and the other to 𝟎. More specifically, at iteration i, we require the flow on the edges starting from a vertex in jiLj to be integral. We show that for each switching flow, there is at most one choice of integral values for these edges, and we can compute it in polynomial time. Hence, either we can decide the instance immediately (because no integral values are possible for one switching flow) or we can progressively fix more integral values in both switching flows.

5.4 Difference between two switching flows

This subsection is dedicated to Lemma 16 below, which is the key lemma to our algorithm and discusses the relationship between any two switching flows with respect to the same tuple (V,E0,E1,φ). In particular, it shows that the inflows to 𝟏 in any two switching flows cannot differ by more than one. This is trivial when the switching flows are from an origin 𝐨, since the inflows to 𝟏 can then be at most one. However, it is not obvious for an arbitrary function φ, where the inflow to 𝟏 can potentially take any value between 0 and vV{𝟎,𝟏}φ(v). Further, Lemma 16 also states that when the difference between the inflows to 𝟏 in the two switching flows is exactly one, we know exactly the difference between the flows of the even and odd edges from each vertex v such that g(v)0, in both switching flows.

Lemma 16.

Let G=(V,E) be a ladder, (E0,E1) a balanced partition of E, and φ:V{𝟎,𝟏} a function. Let x and y be two switching flows with respect to (V,E0,E1,φ). Then |x(𝟏)y(𝟏)|1.

Further, if x(𝟏)y(𝟏)=1, then h~(k)=h~(uk), and for each vV{𝟎,𝟏},

  • if g(v)<0, then x(v,s0(v))x(v,s1(v))=1 and y(v,s0(v))y(v,s1(v))=0; and

  • if g(v)>0, then x(v,s0(v))x(v,s1(v))=0 and y(v,s0(v))y(v,s1(v))=1.

Proof.

Consider the following sum over all edges of E:

M:=(u,v)E(y(u,v)x(u,v))(h~(u)h~(v)).

On one hand, we can sum over the vertices and obtain

M =vVh~(v)(y+(v)y(v)x+(v)+x(v))
=x(𝟏)y(𝟏). (2)

In the last equality, we use the facts that h~(𝟏)=1, that h~(𝟎)=0, that x+(𝟏)=y+(𝟏)=0, and that for vV{𝟎,𝟏}, x+(v)x(v)=y+(v)y(v)=φ(v).

On the other hand, we can consider the two cases of whether (u,v) is an odd edge or even edge and obtain

M =vV{𝟎,𝟏}(y(v,s0(v))x(v,s0(v)))g(v)(y(v,s1(v))x(v,s1(v)))g(v)
=vV{𝟎,𝟏}(y(v,s0(v))y(v,s1(v))x(v,s0(v))+x(v,s1(v)))g(v)
vV{𝟎,𝟏}|g(v)|1+h~(k)h~(uk)1. (3)

The second and third inequalities above follow from Lemma 11, while in the first inequality, we use the fact that for vV{𝟎,𝟏}, 0y(v,s0(v))y(v,s1(v))1 and 0x(v,s0(v))x(v,s1(v))1 to deduce that

1y(v,s0(v))y(v,s1(v))x(v,s0(v))+x(v,s1(v))1.

Combining (2) and (3), we obtain x(𝟏)y(𝟏)1. Symmetrically, we also have y(𝟏)x(𝟏)1. Hence, |x(𝟏)y(𝟏)|1, as claimed.

If x(𝟏)y(𝟏)=1, the equalities of (3) must hold at equalities. This implies that h~(k)=h~(uk) and for vV{𝟎,𝟏},

  • if g(v)<0, then x(v,s0(v))x(v,s1(v))=1 and y(v,s0(v))y(v,s1(v))=0; and

  • if g(v)>0, then x(v,s0(v))x(v,s1(v))=0 and y(v,s0(v))y(v,s1(v))=1.

5.5 Fixing flow values from the next levelset

For convenience, we first define a few notations. For i{0,,k}, define Li:=j=0iLj and Li:=j=ikLj. Moreover, we say a switching flow x is i-integral if for every edge e from a vertex in Li, x(e). (x,y) is an i-pair, if x and y are i-integral switching flows from 𝐨 to 𝟏 and 𝟎, respectively. In this subsection, we package the idea of the algorithm in Section 5.3 in the following lemma.

Lemma 17.

For i{0,,k}, if there exists an i-pair (x,y), then

  1. 1.

    for every outgoing edge e of a vertex in Li, there exists only one possible value for each of x(e) and y(e);

  2. 2.

    if such e is a backward edge, then x(e)=y(e); and

  3. 3.

    for vLi, |x(v)y(v)|=1.

Moreover, in polynomial time, we can output either an i-pair, or that there is no i-integral switching flow from 𝐨 to 𝟏, or that there is no i-integral switching flow from 𝐨 to 𝟎.

Proof.

We prove by induction on i. For the base case i=0, a 0-pair (x,y) is simply a pair of switching flows from 𝐨 to 𝟏 and to 𝟎, without any integrality constraint. Then statements 1 and 2 are vacuously true, while statement 3 holds since x(𝟏)y(𝟏)=1 and x(𝟎)y(𝟎)=1. Hence, we only need to argue about the run time. As noted before, x can be obtained by solving the linear program that comprises the inequalities in Definition 12 and the constraint that the inflow to 𝟏 is one. Likewise, y can be obtained by solving a similar linear program but with the constraint that the inflow to 𝟏 is instead zero. These linear programs can be solved in polynomial time. If one of them is infeasible, we conclude that the corresponding 0-integral switching flow does not exist. Otherwise, combining a solution of each linear program yields a 0-pair.

For the inductive step, assume that the lemma statement holds for some i<k. We show that it also holds for i+1. Suppose that there exists an (i+1)-pair (x,y). Note that this is also an i-pair. Hence, statements 1–3 already holds for vertices in Li, and we only need to show them for vertices in Li+1. The idea is to apply Lemma 16 to fix the differences x(v,s0(v))x(v,s1(v)) and y(v,s0(v))y(v,s1(v)) for vLi+1 and from this information deduce the unique values for x(v,s0(v)), x(v,s1(v)), y(v,s0(v)), and y(v,s1(v)). However, the issue here is that we require g(v)0 in order to apply the lemma, and this may not hold. In order to circumvent this, instead of applying Lemma 16 directly to the original ladder G, we apply it to the ladder induced on the layers Li instead.

Formally, let Gi=(Vi,Ei) be the graph obtained from G by removing the vertices in Li1, removing the outgoing edges from i and ui, and relabeling i and ui to 𝟎 and 𝟏. It is easy to see that Gi is a ladder with the level decomposition (Li,Li+1,). To avoid confusion, we still refer to the vertices in Li by their old labels i and ui. Let E0i:=EiE0 and E1i:=EiE1. Then (E0i,E1i) is a balanced partition of Ei. Next, let φi be the function such that for vLi+1,

φi(v)={(u,v)E:uLix(u,v)if v𝐨1+(u,v)E:uLix(u,v)if v=𝐨.

Finally, let xi and yi be the functions obtained by restricting x and y to the set {(u,v)EuLi+1}. Then by construction, xi is a switching flow with respect to (Vi,E0i,E1i,φi). Moreover, applying statement 2 in the inductive hypothesis, we also have that yi is a switching flow with respect to (Vi,E0i,E1i,φi).

We now argue that gGi(i+1)0. Let S be the sequence (i,i+1,,k,uk,,ui). Let v be a vertex in the sequence except for i and ui. Suppose the two out-neighbors of v precede it in the sequence S. Since there are two directed paths (k,,i) and (uk,,ui), v must be j for some j{i+1,,k}. However, due to the definition of the level decomposition, the preceding out-neighbors of j in the sequence can only be j1. Now together with the fact that the graph is simple, we arrive at a contradiction. Hence, v must have at least one out-neighbor succeeding it in S. By an analogous argument, v must also have at least one out-neighbor preceding it in S. Hence, v has exactly one preceding and one succeeding out-neighbor. Now, if gGi(i+1)=0, then since i{s0(i+1),s1(i+1)} and h~Gi(i)=0, we have h~Gi(s0(i))=h~Gi(s1(i))=0. Combined with (1), this implies that h~Gi(u)=0 for all u between i and w:=max{s0(i),s1(i)} in S, where max indicates the further vertex among the two in the sequence. As shown before, w has one preceding and one succeeding out-neighbor in S. We then use the same argument as above to derive that h~Gi(u)=0 for all u between i and max{s0(w),s1(w)} in S. Repeating this argument, we obtain that the whole sequence S has the same h~Gi values. However, this is false, since h~Gi(i)=01=h~Gi(ui). Hence, gGi(i+1)0. By a similar argument, gGi(ui+1)0.

Therefore, we can now apply Lemma 16 on Gi,(E0i,E1i),φi, and the two switching flows xi and yi. By statements 2 and 3 of the inductive hypothesis, we obtain that |xi(ui)yi(ui)|=1. Further, as argued above, gGi(v)0 for vLi+1. Therefore, Lemma 16 implies that for v{i+1,ui+1} exactly one of x(v,s0(v))x(v,s1(v)) and y(v,s0(v))y(v,s1(v)) has value 0 and the other has value 1. Further, we know exactly these values, since we can compute gGi(i+1) and gGi(ui+1). (Recall that gGi can easily computed from h~Gi, which in turn can be computed in polynomial time as explained in Section 4.)

In the remainder of the proof, we assume that

x(ui+1,s0(ui+1))x(ui+1,s1(ui+1))=1 and y(ui+1,s0(ui+1))y(ui+1,s1(ui+1))=0; (4)

the other case can be argued analogously. By Lemma 16, in this case, one of the following holds:

  • x(ui)y(ui)=1 and gGi(ui+1)<0; or

  • x(ui)y(ui)=0 and gGi(ui+1)>0.

Note that since h~Gi(ui)>h~Gi(ui+1), in the former case, we have ui=s0(ui+1), and in the latter case, ui=s1(ui+1).

We now complete the proof of the inductive step by considering the two following cases.

Case 1.

At least one of i+1 and ui+1 have only one forward edge. Suppose i+1 has only one forward edge. Then for ui, other than its incoming edge (ui+1,ui), all its other incoming edges are from vertices in Li. We have

x(ui+1,ui) =x+(ui)(v,ui)E:vLix(v,ui)δ(ui),
y(ui+1,ui) =y+(ui)(v,ui)E:vLiy(v,ui)δ(ui),

where δ(ui) takes value one if ui=𝐨 and zero otherwise.

Note that the edges in the sums in the two expressions above are backward edges from vertices in Li. Hence, by the inductive hypothesis, the two sums have the same value. Further, also by the inductive hypothesis, the values of x+(ui) and y+(ui) are fixed and differ by one. Hence, the values of x(ui+1,ui) and y(ui+1,ui) are also unique and

x(ui+1,ui)y(ui+1,ui)=x+(ui)y+(ui)=x(ui)y(ui)=xi(ui)yi(ui). (5)

Now suppose x+(ui)y+(ui)=1. Then x(ui)y(ui)=1. As argued above, this implies ui=s0(ui+1) and gGi(ui+1)<0. Then combining this with (4) and (5), we obtain that x(ui+1,s1(ui+1)) and y(ui+1,s1(ui+1)) have the same unique value. Hence, the statements 1–3 hold for the outgoing edges of ui+1. With a similar analysis for the incident edges of i, we also conclude statements 1–3 hold for the outgoing edges of i+1. Further, note that all these unique values can be computed in polynomial time. Once we have all the unique values for the outgoing edges from Li+1, we add constraints to fix these values in the linear program to compute the switching flows from 𝐨 to 𝟎 and to 𝟏. If one of these linear programs is infeasible, we conclude that the corresponding (i+1)-switching flow does not exist; otherwise, their solutions form an (i+1)-pair.

The case for x+(ui)y+(ui)=1 can be argued analogously. It remains to consider the case when the two outgoing edges of i+1 are forward edges. Then ui+1 must have only one forward edge. We then use similar arguments as before to show that statements 1–3 hold for all outgoing edges of ui+1 and i+1 and that the relevant computation can be done in polynomial time.

Case 2.

All outgoing edges of i+1 and ui+1 are forward edges. Since the values of the outgoing edges from i+1 and ui+1 in x and y are integral, the assumption of (4) implies that x+(ui+1) is odd and y+(ui+1) is even.

We now define Vi+1,E0i+1,E1i+1,φi+1,xi+1,yi+1 similar to how we defined Vi,E0i,E1i,φi, xi,yi. Since the outgoing edges of i+1 and ui+1 are both forward edges, and since the values for the backward edges from vertices in Li are the same in x and y, we obtain that xi+1 and yi+1 are switching flows with respect to (Vi+1,E0i+1,E1i+1,φi+1). Lemma 16 states that for any two switching flows with respect to (Vi+1,E0i+1,E1i+1,φi+1), the inflows to ui+1 differ by at most one. This means that if we know the parity of the inflow to ui+1 then there can only be a unique value for this inflow, since if any distinct values of the same parity have difference at least two. This implies statement 1 for the outgoing edges of ui+1. Statement 2 for these edges hold vacuously, as these edges are not backward edges. Statement 3 is also implied from the analysis above: We know that the inflows to ui+1 in x and y differ by at most one. Since the parities of these inflows are different, they have to differ exactly by one.

It remains to show that we can do the computation in polynomial time. By the inductive hypothesis, in polynomial time, we can obtain an i-pair (x¯,y¯). As argued above, we know that x+(ui+1) is an odd number in the range [x¯+(ui+1)1,x¯+(ui+1)+1]. If there is only one odd number in the range, then that is the value for x+(ui+1). If there are two odd numbers in the range, we use the earlier observation that one of these numbers cannot be the outflow of ui+1 for any i-switching flow from 𝐨 to 𝟏. Hence, by using the same linear program to obtain x¯ with the additional constraint to fix the outflow of ui+1 to one of odd numbers in this range, we can verify which odd number is the unique possible value for x+(ui+1) based on the feasibility of this linear program. After obtaining the unique value for x+(ui+1), we can easily deduce the unique values of x(ui+1,s0(ui+1)) and x(ui+1,s1(ui+1)). By the same procedure, we can also obtain the unique values for y(ui+1,s0(ui+1)) and y(ui+1,s1(ui+1)), as well as the values for the outgoing edges of i+1. Note that in the entire process, if something is infeasible, we can immediate conclude that the corresponding (i+1)-switching flow does not exist.

5.6 Summary

Theorem 15 states that a k-integral switching flow from 𝐨 to 𝟏 (resp., to 𝟎) is a certificate of a YES-instance (resp., NO-instance). This implies that there is no k-pair. Hence, using the algorithm as guaranteed by Lemma 17 for i=k, in polynomial time, we conclude that either the non-existence of a k-integral switching flow from 𝐨 to 𝟏 or non-existence of a k-integral switching flow from 𝐨 to 𝟎. We can then decide the ARRIVAL instance accordingly.

6 Concluding remarks

In this article, we prove that ARRIVAL and SSG on ladders can be solved in polynomial time. Note that our proof of Lemma 17 above mainly aims at making the run time polynomial rather than optimizing it as much as possible. Instead of solving a linear number of linear programs as this proof implies, we can solve as few as 𝒪(t) linear programs, where t is the number of levelsets i such that all four outgoing edges from Li are forward edges. Further, the results can also be extended to the generalization of ARRIVAL with multiple tokens. We refer to [14] for more detail on both of these results.

Whether ARRIVAL can be solved in polynomial time remains open. While ladders capture a subset of worst-case instances for the subexponential time algorithm by [11], there are still other instances with the same asymptotic run time, e.g., when all non-empty levelsets have r vertices for some constant r>2. Unfortunately, the analysis in this article does not extend to these cases, and they could form another interesting class of graphs for future work.

References

  • [1] Scott Aaronson. The computational expressiveness of a model train set: A paperlet. https://scottaaronson.blog/?p=5402, 2021. Accessed: 6 July 2022.
  • [2] David Auger, Pierre Coucheney, and Loric Duhazé. Polynomial Time Algorithm for ARRIVAL on Tree-Like Multigraphs. In Stefan Szeider, Robert Ganian, and Alexandra Silva, editors, 47th International Symposium on Mathematical Foundations of Computer Science (MFCS 2022), volume 241 of Leibniz International Proceedings in Informatics (LIPIcs), pages 12:1–12:14, Dagstuhl, Germany, 2022. Schloss Dagstuhl – Leibniz-Zentrum für Informatik. doi:10.4230/LIPIcs.MFCS.2022.12.
  • [3] David Auger, Pierre Coucheney, Loric Duhazé, and Kossi Roland Etse. Generalized ARRIVAL problem for rotor walks in path multigraphs. In Reachability problems, volume 14235 of Lecture Notes in Comput. Sci., pages 183–198. Springer, Cham, [2023] ©2023. doi:10.1007/978-3-031-45286-4_14.
  • [4] Adam Chalcraft and Michael Greene. Train sets. Eureka, 53:5–12, 1994.
  • [5] Anne Condon. The complexity of stochastic games. Information and Computation, 96(2):203–224, 1992. doi:10.1016/0890-5401(92)90048-K.
  • [6] Joshua Cooper, Benjamin Doerr, Joel Spencer, and Gábor Tardos. Deterministic random walks on the integers. European Journal of Combinatorics, 28(8):2072–2090, 2007. EuroComb ’05 - Combinatorics, Graph Theory and Applications. doi:10.1016/J.EJC.2007.04.018.
  • [7] Jérôme Dohrau, Bernd Gärtner, Manuel Kohler, Jiří Matoušek, and Emo Welzl. ARRIVAL: A Zero-Player Graph Game in NP coNP. In Martin Loebl, Jaroslav Nešetřil, and Robin Thomas, editors, A Journey Through Discrete Mathematics: A Tribute to Jiří Matoušek, pages 367–374. Springer International Publishing, Cham, 2017. doi:10.1007/978-3-319-44479-6_14.
  • [8] John Fearnley, Martin Gairing, Matthias Mnich, and Rahul Savani. Reachability switching games. In 45th International Colloquium on Automata, Languages, and Programming, volume 107 of LIPIcs. Leibniz Int. Proc. Inform., pages Art. No. 124, 14. Schloss Dagstuhl – Leibniz-Zentrum für Informatik, 2018.
  • [9] John Fearnley, Spencer Gordon, Ruta Mehta, and Rahul Savani. Unique end of potential line. Journal of Computer and System Sciences, 114:1–35, December 2020. doi:10.1016/j.jcss.2020.05.007.
  • [10] Bernd Gärtner, Thomas Dueholm Hansen, Pavel Hubácek, Karel Král, Hagar Mosaad, and Veronika Slívová. ARRIVAL: Next Stop in CLS. In Ioannis Chatzigiannakis, Christos Kaklamanis, Dániel Marx, and Donald Sannella, editors, 45th International Colloquium on Automata, Languages, and Programming (ICALP 2018), volume 107 of Leibniz International Proceedings in Informatics (LIPIcs), pages 60:1–60:13, Dagstuhl, Germany, 2018. Schloss Dagstuhl – Leibniz-Zentrum für Informatik. ISSN: 1868-8969. doi:10.4230/LIPIcs.ICALP.2018.60.
  • [11] Bernd Gärtner, Sebastian Haslebacher, and Hung P. Hoang. A subexponential algorithm for ARRIVAL. In 48th International Colloquium on Automata, Languages, and Programming, volume 198 of LIPIcs. Leibniz Int. Proc. Inform., pages Art. No. 69, 14. Schloss Dagstuhl – Leibniz-Zentrum für Informatik, 2021.
  • [12] Ebrahim Ghorbani, Jonah Leander Hoff, and Matthias Mnich. A quasi-polynomial time algorithm for multi-arrival on tree-like multigraphs. In 42nd International Symposium on Theoretical Aspects of Computer Science, volume 327 of LIPIcs. Leibniz Int. Proc. Inform., pages Art. No. 39, 19. Schloss Dagstuhl – Leibniz-Zentrum für Informatik, 2025. doi:10.4230/lipics.stacs.2025.39.
  • [13] Sebastian Haslebacher. ARRIVAL: recursive framework & 1-contraction. In 52nd International Colloquium on Automata, Languages, and Programming, volume 334 of LIPIcs. Leibniz Int. Proc. Inform., pages Art. No. 95, 17. Schloss Dagstuhl – Leibniz-Zentrum für Informatik, 2025. doi:10.4230/lipics.icalp.2025.95.
  • [14] Hung P. Hoang. On Two Combinatorial Reconfiguration Problems: Reachability and Hamiltonicity. PhD thesis, ETH Zurich, 2022. doi:10.3929/ethz-b-000572947.
  • [15] Alexander E. Holroyd and James Propp. Rotor walks and Markov chains. In Algorithmic probability and combinatorics, volume 520 of Contemp. Math., pages 105–126. Amer. Math. Soc., Providence, RI, 2010.
  • [16] Viacheslav B. Priezzhev, Deepak Dhar, Abhishek Dhar, and Supriya Krishnamurthy. Eulerian walkers as a model of self-organized criticality. Phys. Rev. Lett., 77:5079–5082, 1996.
  • [17] Günter Rote. Personal communication, 2020.