DOKK Library

On Solving Reachability in Grid Digraphs using a Pseudoseparator

Authors Rahul Jain, Raghunath Tewari,

License CC-BY-3.0

Plaintext
                           T HEORY OF C OMPUTING, Volume 19 (2), 2023, pp. 1–23
                                        www.theoryofcomputing.org




On Solving Reachability in Grid Digraphs
        using a Pseudoseparator
                             Rahul Jain                         Raghunath Tewari
                  Received January 13, 2020; Revised May 25, 2022; Published August 28, 2023




       Abstract. The reachability problem asks to decide if there exists a path from one
       vertex to another in a digraph. In a grid digraph, the vertices are the points of
       a two-dimensional square grid, and an edge can occur between a vertex and its
       immediate horizontal and vertical neighbors only.
           Asano and Doerr (CCCG’11) presented the first simultaneous time-space bound
       for reachability in grid digraphs by solving the problem in polynomial time and
                                                                          ˜ 1/3 ) by Ashida
       𝑂(𝑛 1/2+πœ– ) space. In 2018, the space complexity was improved to 𝑂(𝑛
       and Nakagawa (SoCG’18).
           In this paper, we show that there exists a polynomial-time algorithm that uses
       𝑂(𝑛 1/4+πœ– ) space to solve the reachability problem in a grid digraph containing 𝑛
       vertices. We define and construct a new separator-like device called pseudoseparator
       to develop a divide-and-conquer algorithm. This algorithm works in a space-efficient
       manner to solve reachability.

   A conference version of this paper appeared in the Proceedings of the 39th IARCS Annual Conference on
Foundations of Software Technology and Theoretical Computer Science (FSTTCS 2019) [10].


ACM Classification: G.2.2
AMS Classification: 68Q25
Key words and phrases: digraph reachability, grid digraph, graph algorithm, sublinear space
algorithm


Β© 2023 Rahul Jain and Raghunath Tewari
c b Licensed under a Creative Commons Attribution License (CC-BY)                DOI: 10.4086/toc.2023.v019.a002
                               R AHUL JAIN AND R AGHUNATH T EWARI

1   Introduction
Let 𝑠 and 𝑑 be vertices of a given directed graph (digraph). The problem of digraph reachability
is to decide if there is a path from 𝑠 to 𝑑. This problem has many applications in the field
of algorithms and computational complexity theory. Many algorithms for network-related
problems use it as a subroutine. Digraph reachability is NL-complete and thus captures the
complexity of nondeterministic logarithmic space. Hence designing better algorithms for this
problem is of utmost importance to the theory of computing.
    Standard traversal algorithms such as DFS and BFS give a linear-time algorithm for this prob-
lem, but they require linear space. Savitch’s divide-and-conquer algorithm solves reachability
in 𝑂(log2 𝑛) space. However, as a tradeoff, it requires 𝑛 𝑂(log 𝑛) time [14]. Hence it is natural to
ask whether we can get the best of both worlds and design an algorithm for digraph reachability
that runs in polynomial time and uses polylogarithmic space. Wigderson asked a relaxed version
of this question in his survey, whether digraph reachability can be solved by a polynomial-time
algorithm that uses 𝑂(𝑛 1βˆ’πœ– ) space [16].
                                                                                               √
    Barnes et al. showed that digraph reachability can be decided simultaneously in 𝑛/2Θ( log 𝑛)
space and polynomial time [6]. Although this algorithm gives a sublinear space bound, it still
does not answer Wigderson’s question.
    Undirected graphs can be considered as a specific type of digraphs, where adjacency is a
symmetric relation. Reachability in undirected graphs can be solved in logspace [13]. Also, for
certain classes of digraphs, where the underlying undirected graph is topologically restricted,
we know of polynomial time algorithms with space complexity better than linear. Imai et
al. presented a polynomial-time algorithm that solves reachability for planar digraphs using
𝑂(𝑛 1/2+πœ– ) space for any πœ– > 0 [9]. Later, Asano et al. presented a polynomial-time algorithm
whose space complexity was 𝑂(𝑛   ˜ 1/2 ) for the same problem [4]. For digraphs of higher genus,
Chakraborty et al. presented a polynomial-time algorithm that uses 𝑂(𝑛     ˜ 2/3 𝑔 1/3 ) space. Their
algorithm additionally requires an embedding of the underlying undirected graph on a surface
                                                         ˜ 2/3 )-space algorithm for 𝐻-minor-free
of genus 𝑔, as part of the input [7]. They also gave an 𝑂(𝑛
digraphs which requires a tree decomposition of the underlying undirected graph as part of
the input and 𝑂(𝑛 1/2+πœ– )-space algorithms for 𝐾 3,3 -minor-free digraphs and for 𝐾 5 -minor-free
digraphs.
    For layered planar digraphs Chakraborty and Tewari showed that for every πœ– > 0, there is an
𝑂(𝑛 πœ– )-space algorithm [8]. Stolee and Vinodchandran presented a polynomial-time algorithm
that, for any πœ– > 0 solves reachability in an acyclic digraph with 𝑂(𝑛 πœ– ) sources and embedded
on the surface of genus 𝑂(𝑛 πœ– ) using 𝑂(𝑛 πœ– ) space [15]. For unique-path digraphs Kannan et al.
presented an 𝑂(𝑛 πœ– )-space, polynomial-time algorithm [11].
    In this paper, grid digraphs are our concern. Grid digraphs are a subclass of planar digraphs.
In a grid digraph, the vertices are the points of an π‘š Γ— π‘š grid. The edges can only occur between
a vertex and its immediate vertical and horizontal neighbours. We know that reachability in
planar digraphs can be reduced to reachability in grid digraphs in logarithmic space [1]. The
reduction, however, causes at least a quadratic blow-up in the size of the digraph. In this paper,
we study the simultaneous time–space complexity of reachability in grid graphs.

                      T HEORY OF C OMPUTING, Volume 19 (2), 2023, pp. 1–23                         2
             O N S OLVING R EACHABILITY IN G RID D IGRAPHS U SING A P SEUDOSEPARATOR

    Asano and Doerr presented a polynomial-time algorithm that uses 𝑂(𝑛 1/2+πœ– ) space for
solving reachability in grid digraphs [3]. Ashida and Nakagawa presented an algorithm with
improved space complexity of 𝑂(𝑛  e 1/3 ) [5]. The latter algorithm proceeds by first dividing
the input grid digraph into subgrids. It then uses a gadget to transform each subgrid into a
planar digraph, making the whole of the resultant digraph planar. Finally, it uses the planar
reachability algorithm of Imai et al. [9] as a subroutine to get the desired space bound.
    In this paper, we present a 𝑂(𝑛 1/4+πœ– ) space and polynomial-time algorithm for grid digraph
reachability, thereby significantly improving the space bound of Ashida and Nakagawa.
Theorem 1.1 (Main Theorem). For every πœ– > 0, there exists a polynomial-time algorithm that solves
reachability in an 𝑛-vertex grid digraph using 𝑂(𝑛 1/4+πœ– ) space.
     The approach of Ashida and Nakagawa [5] is to reduce the size of the input 𝑛-vertex digraph
to a digraph of size 𝑂(𝑛 2/3 ). Their new graph preserves reachability between vertices and is
planar. They use the planar-reachability algorithm of Asano et al. [4]. Our approach is slightly
different. We convert the input digraph into an auxiliary digraph of size 𝑂(𝑛 1/2+𝛼/2 ) for arbitrarily
small 𝛼. The auxiliary digraph is created by dividing the given grid digraph into subgrids and
replacing paths in each subgrid with a single edge between the boundary vertices. While our
auxiliary digraph preserves reachability, it is not planar; and hence we cannot use Asano et
al.’s algorithm directly. The auxiliary digraph comes with a drawing with the crossing property,
that is, if two edges, 𝑒 and 𝑓 , cross each other in this drawing, there necessarily exist two more
edges, one from the tail of 𝑒 to the head of 𝑓 and the other from the tail of 𝑓 to the head of
𝑒, in the digraph. This property allows us to use a device that we call pseudoseparator to solve
reachability in it. A pseudoseparator designates a set of vertices, a set of edges and a set of
components of the digraph, such that a path from one component to another necessarily either
takes a vertex of the pseudoseparator or crosses one of the edges of the pseudoseparator in the
drawing. We finally solve the problem by recursively solving each of these components and
using a traversal algorithm. Due to the crossing property, we are required to store only a small
number of vertices for performing the traversal, thereby saving space.
     In Section 2, we state the definitions and notation that we use in this paper. In Section 3, we
define the auxiliary digraph and state various properties of it that we use later. In Section 4,
we discuss the concept of the pseudoseparator. We give its formal definition and show how to
compute the pseudoseparator efficiently. In Section 5, we give the algorithm to solve reachability
in an auxiliary digraph and prove its correctness. Finally in Section 6 we use the algorithm of
Section 5 to give an algorithm to decide reachability in grid digraphs and thus prove Theorem 1.1.


2   Preliminaries
Let [𝑛] denote the set {0, 1, 2, . . . , 𝑛}. We denote the vertex set of a digraph 𝐺 by 𝑉(𝐺) and its
edge set by 𝐸(𝐺). We assume that the vertices of a digraph are indexed by integers from 1 to
|𝑉(𝐺)|. For a subset π‘ˆ of 𝑉(𝐺), we denote the sub-digraph of 𝐺 induced by the vertices of π‘ˆ
as 𝐺[π‘ˆ] and we denote the sub-digraph of 𝐺 induced by the vertices 𝑉(𝐺) \ π‘ˆ as 𝐺 \ π‘ˆ. For
a digraph 𝐺, we write cc(𝐺) to denote the set of all connected components in the underlying

                       T HEORY OF C OMPUTING, Volume 19 (2), 2023, pp. 1–23                          3
                                       R AHUL JAIN AND R AGHUNATH T EWARI

undirected graph of 𝐺. By the underlying undirected graph, we mean the graph formed by
symmetrizing the adjacency relation. To do this, we consider each directed edge in the digraph
and create an undirected edge between the corresponding vertices. Henceforth, whenever we
talk about connected components, we will mean the connected components of the underlying
undirected graph. In a drawing of a graph in the plane we map each vertex to a point in the plane
and each edge to a simple arc whose endpoints coincide with the images of the end vertices of
the edge. Moreover, the image of a vertex does not belong to the interior of an arc corresponding
to any edge. We say that a graph is planar if there exists a drawing of that graph on a plane such
that no two arcs corresponding to the edges of the graph intersect except at the endpoints. Such
a drawing is called a planar embedding.
    A planar digraph is a digraph whose underlying undirected graph is planar. Similarly, a
drawing of a digraph is defined as the drawing of its underlying undirected graph.
    We will represent a planar graph by describing the cyclic ordering of a graph’s edges around
each vertex. We note that the results in [2] and [13] combine to a deterministic logarithmic space
algorithm that decides whether a given graph is planar, and if it is, outputs a planar embedding.
Hence, when dealing with planar graphs, we will assume without loss of generality that we
have a planar embedding whenever required. An π‘š Γ— π‘š grid digraph is a directed graph whose
set of vertices is [π‘š] Γ— [π‘š] = {0, 1, . . . , π‘š} Γ— {0, 1, . . . , π‘š} so that if ((𝑖1 , 𝑗1 ), (𝑖2 , 𝑗2 )) is an edge
then |𝑖1 βˆ’ 𝑖2 | + | 𝑗1 βˆ’ 𝑗2 | = 1. In other words, we start with an undirected π‘š Γ— π‘š grid graph. Then,
we remove some of the edges and assign directions to the remaining edges while keeping all the
vertices. This process results in the formation of an π‘š Γ— π‘š grid digraph, which has a total of
𝑛 = (π‘š + 1)2 vertices. It follows from the definition that grid digraphs are planar.
    We will work with π‘š Γ— π‘š grid digraphs where π‘š = 𝑂(𝑛 1/2 ). Hence, a space complexity of
                                                                      0
𝑂(π‘š 1/2+πœ– ) will translate into a space complexity of 𝑂(𝑛 1/4+πœ– ) as required.


3    Auxiliary graph
Let 𝐺 be an π‘š Γ— π‘š grid digraph. We divide 𝐺 into π‘š 2𝛼 subgrids such that each subgrid is a
π‘š 1βˆ’π›Ό Γ— π‘š 1βˆ’π›Ό grid. Formally, for 0 < 𝛼 < 1 and 1 ≀ 𝑖, 𝑗 ≀ π‘š 𝛼 , the (𝑖, 𝑗)-th subgrid of 𝐺, denoted
𝐺[𝑖, 𝑗], is the sub-digraph of 𝐺 induced by the set of vertices, 𝑉(𝐺[𝑖, 𝑗]), where 𝑉(𝐺[𝑖, 𝑗]) is

              {(𝑖 0 , 𝑗 0) | (𝑖 βˆ’ 1) Β· π‘š 1βˆ’π›Ό ≀ 𝑖 0 ≀ 𝑖 Β· π‘š 1βˆ’π›Ό and (𝑗 βˆ’ 1) Β· π‘š 1βˆ’π›Ό ≀ 𝑗 0 ≀ 𝑗 Β· π‘š 1βˆ’π›Ό } .

    For ease of presentation, we will assume without loss of generality that variables like π‘š and
𝛼 are such that the values like π‘š 𝛼 and π‘š 1βˆ’π›Ό are integers.
    We define the auxiliary digraph Aux𝛼 (𝐺)[𝑖, 𝑗] as follows. The vertex set of Aux𝛼 (𝐺)[𝑖, 𝑗] is
the set of vertices on the boundary of 𝐺[𝑖, 𝑗]. That means, 𝑉(Aux𝛼 (𝐺)[𝑖, 𝑗]) is

             {(𝑖 0 , 𝑗 0) | (𝑖 0 , 𝑗 0) ∈ 𝑉(𝐺[𝑖, 𝑗]) and
              ((𝑖 βˆ’ 1) Β· π‘š 1βˆ’π›Ό = 𝑖 0 or 𝑖 Β· π‘š 1βˆ’π›Ό = 𝑖 0 or (𝑗 βˆ’ 1) Β· π‘š 1βˆ’π›Ό = 𝑗 0 or 𝑗 Β· π‘š 1βˆ’π›Ό = 𝑗 0)} .

For two vertices 𝑒, 𝑣 in Aux𝛼 (𝐺)[𝑖, 𝑗], (𝑒, 𝑣) is an edge in Aux𝛼 (𝐺)[𝑖, 𝑗] if there is a path from 𝑒 to
𝑣 in the subgrid 𝐺[𝑖, 𝑗]. We draw Aux𝛼 (𝐺)[𝑖, 𝑗] on an Euclidean plane by mapping vertex (π‘₯, 𝑦)

                           T HEORY OF C OMPUTING, Volume 19 (2), 2023, pp. 1–23                                  4
             O N S OLVING R EACHABILITY IN G RID D IGRAPHS U SING A P SEUDOSEPARATOR

to the point with coordinates (π‘₯, 𝑦). The points corresponding to vertices of Aux𝛼 (𝐺)[𝑖, 𝑗] thus
lie on a square. We use a straight line segment to represent the edge if 𝑒 and 𝑣 do not lie on a
single side of this square. and an arc inside the square to represent it otherwise.
    We define the 𝛼-auxiliary digraph, Aux𝛼 (𝐺) as follows. The vertex set of Aux𝛼 (𝐺), 𝑉(Aux𝛼 (𝐺)) =
{(𝑖, 𝑗) | 𝑖 = π‘˜ Β· π‘š 1βˆ’π›Ό or 𝑗 = 𝑙 Β· π‘š 1βˆ’π›Ό , such that 0 ≀ π‘˜, 𝑙 ≀ π‘š 𝛼 }. The edges of Aux𝛼 (𝐺) are the edges
of Aux𝛼 (𝐺)[𝑖, 𝑗] taken over all pairs (𝑖, 𝑗). Note that Aux𝛼 (𝐺) might have parallel edges, since an
edge on a side of a block might be in the adjacent block as well. In such cases we preserve both
the edges, in their different blocks of Aux𝛼 (𝐺) in the drawing of Aux𝛼 (𝐺) on the plane. Figure 1
contains an example of a grid digraph partitioned into subgrids and its corresponding auxiliary
digraph. Since each block Aux𝛼 (𝐺)[𝑖, 𝑗] contains 4π‘š 1βˆ’π›Ό vertices, the total number of vertices in
Aux𝛼 (𝐺) is at most 4π‘š 1+𝛼 .
    Our algorithm for reachability first constructs Aux𝛼 (𝐺) by solving each of the π‘š 1βˆ’π›Ό Γ— π‘š 1βˆ’π›Ό
grids recursively. It then uses a polynomial-time subroutine to decide reachability in Aux𝛼 (𝐺).
Note that we do not store the digraph Aux𝛼 (𝐺) explicitly since that would require too much
space. Rather we solve a subgrid recursively whenever the subroutine queries for an edge in
that subgrid of Aux𝛼 (𝐺).
    Our strategy is to develop a polynomial-time algorithm which solves reachability in Aux𝛼 (𝐺)
using 𝑂( ˜ π‘šΛœ 1/2+𝛽/2 ) space where π‘š  ˜ is the number of vertices in Aux𝛼 (𝐺). As discussed earlier, π‘š  ˜
is at most 4π‘š 1+𝛼 . Hence, the main algorithm requires 𝑂(π‘š       ˜ 1/2+𝛽/2+𝛼/2+𝛼𝛽/2 ) space. For a fixed
constant πœ– > 0, we can pick 𝛼 > 0 and 𝛽 > 0 such that the space complexity becomes 𝑂(π‘š 1/2+πœ– ).




Figure 1: A grid digraph 𝐺 divided into subgrids and its corresponding auxiliary digraph
Aux𝛼 (𝐺)




3.1   Properties of the auxiliary digraph

In the following definition, we give ordered labelling to the vertices of a block of the auxiliary
digraph. We define the labelling with respect to some vertex in the block.

Definition 3.1. Let 𝐺 be a π‘š Γ— π‘š grid digraph, β„“ = Aux𝛼 (𝐺)[𝑖, 𝑗] be a block of Aux𝛼 (𝐺) and
𝑣 = (π‘₯, 𝑦) be a vertex in Aux𝛼 (𝐺)[𝑖, 𝑗]. Let 𝑑 = π‘š 1βˆ’π›Ό . We define a cyclic permutation 𝑐ℓ on the

                       T HEORY OF C OMPUTING, Volume 19 (2), 2023, pp. 1–23                             5
                                      R AHUL JAIN AND R AGHUNATH T EWARI

vertex set of Aux𝛼 (𝐺)[𝑖, 𝑗] as follows:

                                      ο£±
                                      
                                       (π‘₯ + 1, 𝑦)   if π‘₯ < (𝑖 + 1)𝑑 and 𝑦 = 𝑗𝑑
                                        (π‘₯, 𝑦 + 1)   if π‘₯ = (𝑖 + 1)𝑑 and 𝑦 < (𝑗 + 1)𝑑
                                      
                                      
                                      ο£²
                                      
                          𝑐 𝑙 (𝑣) =
                                      
                                       (π‘₯ βˆ’ 1, 𝑦)   if π‘₯ > 𝑖𝑑 and 𝑦 = (𝑗 + 1)𝑑
                                      
                                       (π‘₯, 𝑦 βˆ’ 1)
                                      
                                                     if π‘₯ = 𝑖𝑑 and 𝑦 > 𝑗𝑑
                                      ο£³
For any non-negative integer π‘Ÿ, we define π‘β„“π‘Ÿ inductively as follows. For π‘Ÿ = 0, 𝑐 π‘™π‘Ÿ (𝑣) = 𝑣 and
otherwise we have 𝑐 π‘™π‘Ÿ+1 (𝑣) = 𝑐 𝑙 (𝑐 π‘™π‘Ÿ (𝑣)).

    Note that the permutation 𝑐ℓ can be seen as a counter-clockwise shift. Also note that for
                                                          𝑝
a block β„“ and vertices 𝑣 and 𝑀 in it, we can write 𝑣 as 𝑐 𝑙 (𝑀) where 𝑝 is smallest non-negative
                    𝑝
integer for which 𝑐 𝑙 (𝑀) = 𝑣. Next we formalize what it means to say that two edges of the
auxiliary digraph cross each other.

Definition 3.2. Let 𝐺 be a grid digraph and β„“ be a block of Aux𝛼 (𝐺). For two distinct edges 𝑒
                                        𝑝                 π‘ž
and 𝑓 in the block, such that 𝑒 = (𝑣, 𝑐 𝑙 (𝑣)) and 𝑓 = (𝑐 𝑙 (𝑣), 𝑐 π‘™π‘Ÿ (𝑣)). We say that edges 𝑒 and 𝑓
cross each other if min(π‘ž, π‘Ÿ) < 𝑝 < max(π‘ž, π‘Ÿ).

   Note the definition of cross given above is symmetric. That is, if edges 𝑒 and 𝑓 cross each
                                                                                      π‘ž
other then 𝑓 and 𝑒 must cross each other as well. For an edge 𝑓 = (𝑐 𝑙 (𝑣), 𝑐 π‘™π‘Ÿ (𝑣)), we define
β†βˆ’                π‘ž
 𝑓 = (𝑐 π‘™π‘Ÿ (𝑣), 𝑐 𝑙 (𝑣)) and call it the reverse of 𝑓 . We also note that if 𝑒 and 𝑓 cross each other, then 𝑒
    β†βˆ’
and 𝑓 also cross each other.
   In Lemma 3.3 we state an equivalent condition of the crossing of two edges. In Lemmas 3.5
and 3.6 we state some specific properties of the auxiliary digraph that we use later.

Lemma 3.3. Let 𝐺 be a grid digraph and β„“ be a block of Aux𝛼 (𝐺). Let 𝑀 be an arbitrary vertex in the
                   𝑝        π‘ž
block β„“ and 𝑒 = (𝑐 𝑙 (𝑀), 𝑐 𝑙 (𝑀)) and 𝑓 = (𝑐 π‘™π‘Ÿ (𝑀), 𝑐 𝑙𝑠 (𝑀)) be two distinct edges in β„“ . Then 𝑒 and 𝑓 cross
each other if and only if either of the following two conditions hold:

    β€’ min(𝑝, π‘ž) < min(π‘Ÿ, 𝑠) < max(𝑝, π‘ž) < max(π‘Ÿ, 𝑠)

    β€’ min(π‘Ÿ, 𝑠) < min(𝑝, π‘ž) < max(π‘Ÿ, 𝑠) < max(𝑝, π‘ž)

Proof. We prove that if min(𝑝, π‘ž) < min(π‘Ÿ, 𝑠) < max(𝑝, π‘ž) < max(π‘Ÿ, 𝑠) then 𝑒 and 𝑓 cross each
other. We let 𝑝 < π‘Ÿ < π‘ž < 𝑠. Other cases can be proved by reversing appropriate edges.
We thus have integers π‘Ÿ1 = π‘Ÿ βˆ’ 𝑝, π‘ž1 = π‘ž βˆ’ 𝑝 and 𝑠 1 = 𝑠 βˆ’ 𝑝. Clearly, π‘Ÿ1 < π‘ž1 < 𝑠 1 . Let
          𝑝                                           π‘ž            π‘ž   𝑝            π‘ž
𝑣 = 𝑐 𝑙 (𝑀). Thus we have 𝑒 = (𝑣, 𝑐 𝑙 (𝑀)) = (𝑣, 𝑐 𝑙 1 (𝑐 𝑙 (𝑀))) = (𝑣, 𝑐 𝑙 1 (𝑣)) and 𝑓 = (𝑐 π‘™π‘Ÿ (𝑀), 𝑐 𝑙𝑠 (𝑀)) =
          𝑝                𝑝
(𝑐 π‘™π‘Ÿ1 (𝑐 𝑙 (𝑀)), 𝑐 𝑙𝑠1 (𝑐 𝑙 (𝑀))) = (𝑐 π‘™π‘Ÿ1 (𝑣), 𝑐 𝑙𝑠1 (𝑣)) The proof for the second condition is similar.
                                              𝑝          π‘ž
       Now, we prove that if 𝑒 = (𝑐 𝑙 (𝑀), 𝑐 𝑙 (𝑀)) and 𝑓 = (𝑐 π‘™π‘Ÿ (𝑀), 𝑐 𝑙𝑠 (𝑀)) cross each other then either of
the given two condition holds. We assume that 𝑝 is the smallest integer among 𝑝, π‘ž, π‘Ÿ and 𝑠. Other
                                                                 𝑝
cases can be proved similarly. Now, let 𝑣 = 𝑐 𝑙 (𝑀). We thus have integers π‘ž 1 = π‘ž βˆ’ 𝑝, π‘Ÿ1 = π‘Ÿ βˆ’ 𝑝
                                                  π‘ž1
and 𝑠1 = 𝑠 βˆ’ 𝑝 such that 𝑒 = (𝑣, 𝑐 𝑙 (𝑣)) and 𝑓 = (𝑐 π‘™π‘Ÿ1 (𝑣), 𝑐 𝑙𝑠1 (𝑣)). Since 𝑒 and 𝑓 cross each other,

                         T HEORY OF C OMPUTING, Volume 19 (2), 2023, pp. 1–23                                  6
              O N S OLVING R EACHABILITY IN G RID D IGRAPHS U SING A P SEUDOSEPARATOR

we have min(π‘Ÿ1 , 𝑠1 ) < π‘ž1 < max(π‘Ÿ1 , 𝑠1 ). Thus min(π‘Ÿ1 + 𝑝, 𝑠1 + 𝑝) < π‘ž1 + 𝑝 < max(π‘Ÿ1 + 𝑝, 𝑠1 + 𝑝).
It follows that min(π‘Ÿ, 𝑠) < π‘ž < max(π‘Ÿ, 𝑠). Since we assumed 𝑝 to be smallest integer among 𝑝, π‘ž,
π‘Ÿ and 𝑠; we have min(𝑝, π‘ž) < min(π‘Ÿ, 𝑠) < max(𝑝, π‘ž) < max(π‘Ÿ, 𝑠), thus proving the lemma.           
   We see that we can draw an auxiliary digraph on a plane such that the arcs corresponding to
two of its edges intersect if and only if the corresponding edges cross each other. Henceforth,
we will work with such a drawing.

Definition 3.4. Let 𝐺 be a grid digraph and β„“ be a block of Aux𝛼 (𝐺). For a vertex 𝑣 and edges
                         π‘ž
𝑓 , 𝑔 such that 𝑓 = (𝑐 𝑙 (𝑣), 𝑐 π‘™π‘Ÿ (𝑣)) and 𝑔 = (𝑐 𝑙𝑠 (𝑣), 𝑐 𝑙𝑑 (𝑣)), we say that 𝑓 is closer to 𝑣 than 𝑔 if
min(π‘ž, π‘Ÿ) < min(𝑠, 𝑑).
     We say 𝑓 is closest to 𝑣 if there exists no other edge 𝑓 0 which is closer to 𝑣 than 𝑓 .

Lemma 3.5. Let 𝐺 be a grid digraph and 𝑒1 = (𝑒1 , 𝑣1 ) and 𝑒2 = (𝑒2 , 𝑣2 ) be two edges in Aux𝛼 (𝐺). If 𝑒1
and 𝑒2 cross each other, then Aux𝛼 (𝐺) also contains the edges (𝑒1 , 𝑣2 ) and (𝑒2 , 𝑣1 ).
                      𝑝                   π‘ž
Proof. Let 𝑒1 = (𝑣, 𝑐 𝑙 (𝑣)) and 𝑒2 = (𝑐 𝑙 (𝑣), 𝑐 π‘™π‘Ÿ (𝑣)) be two edges that cross each other in Aux𝛼 (𝐺).
Let β„“ be the block of Aux𝛼 (𝐺) to which 𝑒1 and 𝑒2 belong. Consider the subgrid of 𝐺 which is
solved to construct the block β„“ . Since the edge 𝑒1 exists in block β„“ , there exists a path 𝑃 from 𝑣 to
   𝑝
𝑐 𝑙 (𝑣) in the underlying subgrid. This path 𝑃 divides the subgrid into two parts such that the
             π‘ž                                                                                  π‘ž
vertices 𝑐 𝑙 (𝑣) and 𝑐 π‘™π‘Ÿ (𝑣) belong to different parts of the subgrid. Thus, a path between 𝑐 𝑙 (𝑣) and
𝑐 π‘™π‘Ÿ (𝑣) necessarly take a vertex of path 𝑃. Hence, there is a path from 𝑣 to 𝑐 π‘™π‘Ÿ (𝑣) and a path from
   𝑝
𝑐 𝑙 (𝑣) to 𝑐 π‘™π‘Ÿ (𝑣). Thus the lemma follows.                                                           




Figure 2: Edge crossings in an auxiliary grid. On the left, there is one block of the auxiliary
digraph that contains edges that cross. The dotted edges are the ones whose existence is made
necessary by Lemma 3.5. On the right, a subgrid which results in the auxiliary block on the left.


Lemma 3.6. Let 𝐺 be a grid digraph and 𝑒1 = (𝑒1 , 𝑣1 ) and 𝑒2 = (𝑒2 , 𝑣2 ) be two edges in Aux𝛼 (𝐺). If
𝑒1 and 𝑒2 cross a certain edge 𝑓 = (π‘₯, 𝑦), and 𝑒1 is π‘π‘™π‘œπ‘ π‘’π‘Ÿ to π‘₯ than 𝑒2 , then the edge (𝑒1 , 𝑣2 ) is also in
Aux𝛼 (𝐺).

                          T HEORY OF C OMPUTING, Volume 19 (2), 2023, pp. 1–23                              7
                                   R AHUL JAIN AND R AGHUNATH T EWARI

                                                       y


     u2                       e2                                                                  v2



     u1                                                                                           v1
                              e1
                                                   f

                                                       x
                                   Figure 3: Illustration of Lemma 3.6

                      𝑝               π‘ž                                            π‘ž
Proof. Let 𝑓 = (𝑣, 𝑐ℓ (𝑣)), 𝑒1 = (𝑐ℓ (𝑣), π‘β„“π‘Ÿ (𝑣)) and 𝑒2 = (𝑐ℓ𝑠 (𝑣), 𝑐ℓ𝑑 (𝑣)). If 𝑐ℓ (𝑣) = 𝑐ℓ𝑠 (𝑣) then the
lemma trivially follows. Otherwise, we have two cases to consider:
                                                           π‘ž
Case 1 (𝑒1 crosses 𝑒2 ): In this case, we will have (𝑐ℓ (𝑣), 𝑐ℓ𝑑 (𝑣)) in Aux𝛼 (𝐺) by Lemma 3.5.

Case 2 (𝑒1 does not cross 𝑒2 ): In this case, we have min(π‘ž, π‘Ÿ) < min(𝑠, 𝑑) < 𝑝 < max(𝑠, 𝑑) <
                                                               π‘ž      𝑝
     max(π‘ž, π‘Ÿ). Since 𝑒1 crosses 𝑓 , we have the edge (𝑐ℓ (𝑣), 𝑐ℓ (𝑣)) in Aux𝛼 (𝐺) by Lemma 3.5.
                                         π‘ž
     This edge will cross 𝑒2 . Hence (𝑐ℓ (𝑣), 𝑐ℓ𝑑 (𝑣)) is in Aux𝛼 (𝐺).                        


4    Pseudoseparators in a grid digraph
Imai et al. used a separator construction to solve the reachability problem in planar digraphs [9].
A separator is a set of vertices whose removal disconnects the graph into small components. The
class of grid digraphs is a subclass of planar digraphs. Grid graphs are known to have small
separators. However, for a grid digraph 𝐺, the underlying undirected graph of Aux𝛼 (𝐺) might
not have a small separator.
    An essential property of a separator is that, for any two vertices, a path between the vertices
must contain a separator vertex if the vertices lie in two different components with respect to
the separator. This property can then be used to design a divide and conquer algorithm for
reachability where only separator vertices need to be marked and stored for traversal. Lemma 3.6

                          T HEORY OF C OMPUTING, Volume 19 (2), 2023, pp. 1–23                            8
             O N S OLVING R EACHABILITY IN G RID D IGRAPHS U SING A P SEUDOSEPARATOR

allows us to use edges as well since, at most, one vertex on each side of an edge needs to be
stored for traversal (the visited-vertex closest to the tail of the edge). Hence, we can use a slightly
weaker structure in place of a separator. We construct a structure called pseudoseparator (see
Definition 4.1). It is essentially a set of vertices and edges that can be used to divide the digraph
into components, such that a path from one component to another either takes a vertex of the
pseudoseparator or crosses an edge of the pseudoseparator.
    For a digraph 𝐻 = (𝑉1 , 𝐸1 ) given along with its drawing, and a sub-digraph 𝐢 = (𝑉2 , 𝐸2 ) of 𝐻,
define the digraph 𝐻  𝐢 = (𝑉3 , 𝐸3 ) as 𝑉3 = 𝑉1 \ 𝑉2 and 𝐸3 = 𝐸1 \ {𝑒 ∈ 𝐸1 | βˆƒ 𝑓 ∈ 𝐸2 , 𝑒 crosses 𝑓 }.
We note that the digraph 𝐻 we will be working with throughout the article will be a sub-digraph
of an auxiliary digraph. Hence it will always come with a drawing.
Definition 4.1. Let 𝐺 be a grid digraph and 𝐻 be an induced sub-digraph of Aux𝛼 (𝐺) with
β„Ž vertices. Let 𝑓 : β„• β†’ β„• be a function. A sub-digraph 𝐢 of 𝐻 is said to be an 𝑓 (β„Ž)-
pseudoseparator of Aux𝛼 (𝐺) if the size of every connected component in cc(𝐻  𝐢) is at most
𝑓 (β„Ž). The size of 𝐢 is the number of vertices plus the number of edges of 𝐢.
    For an inducedsub-digraph 𝐻 of Aux𝛼 (𝐺), an 𝑓 (β„Ž)-pseudoseparator is a sub-digraph 𝐢 of 𝐻
that has the property that, if we remove the vertices as well as all the edges that cross one of
the edges of the pseudoseparator, the digraph gets disconnected into small pieces. Moreover
for every edge 𝑒 in 𝐻, if there exists distinct sets π‘ˆ1 and π‘ˆ2 in cc(𝐻  𝐢) such that one of the
endpoints of 𝑒 is in π‘ˆ1 and the other is in π‘ˆ2 , then there exists an edge 𝑓 in 𝐢 such that 𝑒 crosses
𝑓 . Hence any path in 𝐻 that connects two vertices in different components of 𝐻  𝐢 must either
contain a vertex of 𝐢 or must contain an edge that crosses an edge of 𝐢. We divide the digraph
using this pseudoseparator and give an algorithm that recursively solves each sub-digraph and
then combines their solution efficiently.

4.1   Constructing a pseudoseparator
Before working out the details below, we briefly comment on how to construct a pseudoseparator
of an inducedsub-digraph 𝐻 of Aux𝛼 (𝐺). Ideally, we would have liked to have a set of cycles
of 𝐻 such that the surfaces obtained by cutting along these cycles have a bounded number of
vertices on it.However, such cycles might not exist. We instead pick a maximal subset of edges
from 𝐻 so that no two edges cross (see Definition 4.2 and Lemma 4.3). Then we triangulate the
resulting graph. We show that this triangulated graph has the required cycles and can be found
using Imai et al.’s separator algorithm. Call the triangulated graph 𝐻
                                                                     b and the separator vertices
as 𝑆. Since the cycles might have triangulated edges, we will add at most a constant number of
vertices and edges from 𝐻 to shield these triangulated edges. The vertex set of pseudoseparator
of 𝐻 will thus contain all the vertices of 𝑆 and at most four additional vertices for each edge
of 𝐻[𝑆]
   b that is not in 𝐻. The edge set of pseudoseparator of 𝐻 will contain all the edges of 𝐻
which are also in 𝐻[𝑆]
                    b and at most four additional edges for each edge of 𝐻[𝑆]
                                                                            b that is not in 𝐻.

Definition 4.2. Let 𝐺 be a grid digraph and 𝐻 be an induced sub-digraph of Aux𝛼 (𝐺). We define
planar(𝐻) as a sub-digraph of 𝐻. The vertex set of planar(𝐻) is same as that of 𝐻. For an edge
𝑒 ∈ 𝐻, let β„“ be the block to which 𝑒 belongs and let 𝑀 be the lowest indexed vertex in that block.

                       T HEORY OF C OMPUTING, Volume 19 (2), 2023, pp. 1–23                          9
                                R AHUL JAIN AND R AGHUNATH T EWARI

                   𝑗                                                                    𝑦
Then 𝑒 = (𝑐ℓ𝑖 (𝑀), 𝑐ℓ (𝑀)) is in planar(𝐻) if there exists no other edge 𝑓 = (𝑐ℓπ‘₯ (𝑀), 𝑐ℓ (𝑀)) in 𝐻 such
that min(π‘₯, 𝑦) < min(𝑖, 𝑗) < max(π‘₯, 𝑦) < max(𝑖, 𝑗).

   In Lemma 4.3 we show that the digraph planar(𝐻) is indeed planar. We also prove that the
subset of edges that we have picked from 𝐻 is a maximal subset such that no two edges cross.

Lemma 4.3. Let 𝐺 be a grid digraph and 𝐻 be an induced sub-digraph of Aux𝛼 (𝐺). No two edges of
planar(𝐻) cross each other. Moreover, for any edge 𝑒 in 𝐻 that is not in planar(𝐻), there exists another
edge in planar(𝐻) that crosses 𝑒.
                                                                                            𝑝       π‘ž
Proof. Let β„“ be a block of Aux𝛼 (𝐺) and 𝑀 be the smallest index vertex of β„“ . Let 𝑒 = (𝑐ℓ (𝑀), 𝑐ℓ (𝑀))
and 𝑓 = (π‘β„“π‘Ÿ (𝑀), 𝑐ℓ𝑠 (𝑀)) be two edges of 𝐻 that cross. We have, by Lemma 3.3, that either
min(𝑝, π‘ž) < min(π‘Ÿ, 𝑠) < max(𝑝, π‘ž) < max(π‘Ÿ, 𝑠) or min(π‘Ÿ, 𝑠) < min(𝑝, π‘ž) < max(π‘Ÿ, 𝑠) < max(𝑝, π‘ž).
Hence, by our construction of planar(𝐻), atmost one of 𝑒 and 𝑓 belongs to it. Thus no two edges
of planar(𝐻) cross.
    For the second part, we will prove by contradiction. Let us assume that there exists
edges in 𝐻 which is not in planar(𝐻) and also not crossed by an edge in planar(𝐻). We
                  𝑝       π‘ž
pick edge 𝑒 = (𝑐ℓ (𝑀), 𝑐ℓ (𝑀)) from them such that min(𝑝, π‘ž) of that edge is minimum. Since
this edge is not in planar(𝐻), we have by definition, an edge 𝑓 = (π‘β„“π‘Ÿ (𝑀), 𝑐ℓ𝑠 (𝑀)) such that
min(π‘Ÿ, 𝑠) < min(𝑝, π‘ž) < max(π‘Ÿ, 𝑠) < max(𝑝, π‘ž). We pick the edge 𝑓 for which min(π‘Ÿ, 𝑠) is
                                                                                             𝑗
minimum. Now, since this edge 𝑓 is not in planar(𝐻), we have another edge 𝑔 = (𝑐ℓ𝑖 (𝑀), 𝑐ℓ (𝑀)) in
planar(𝐻) such that min(𝑖, 𝑗) < min(π‘Ÿ, 𝑠) < max(𝑖, 𝑗) < max(π‘Ÿ, 𝑠). We pick 𝑔 such that min(𝑖, 𝑗)
is minimum and break ties by picking one whose max(𝑖, 𝑗) is maximum. Now, we have the
following cases:

Case 1 (𝑖 < π‘Ÿ < 𝑗 < 𝑠): Note that 𝐻 is an induced sub-digraph of Aux𝛼 (𝐺). Thus, in this case, the
     edge (𝑐ℓ𝑖 (𝑀), 𝑐ℓ𝑠 (𝑀)) will be in 𝐻 due to Lemma 3.5. Since 𝑖 < 𝑝 < 𝑠 < π‘ž, and 𝑖 < min(π‘Ÿ, 𝑠),
     this will contradict the way in which edge 𝑓 was chosen.
                                                           𝑗
Case 2 (𝑖 < 𝑠 < 𝑗 < π‘Ÿ): In this case, the edge (π‘β„“π‘Ÿ (𝑀), 𝑐ℓ (𝑀)) will be in 𝐻 due to Lemma 3.5. This
                                                                                                    𝑗0
      edge will cross 𝑒 and hence not be in planar(𝐻). Thus, we have an edge 𝑔 0 = (𝑐ℓ𝑖 (𝑀), 𝑐ℓ (𝑀))
                                                                                            0


      in planar(𝐻) such that min(𝑖 0 , 𝑗 0) < 𝑗 < max(𝑖 0 , 𝑗 0) < π‘Ÿ. We will thus have two subcases.

      Case 2a (𝑖 < min(𝑖 0 , 𝑗 0)): Here, we will have 𝑖 < min(𝑖 0 , 𝑗 0) < 𝑗 < max(𝑖 0 , 𝑗 0). Hence this
          edge will cross 𝑔 giving a contradiction to the first part of this Lemma.
      Case 2b (min(𝑖 0 , 𝑗 0) ≀ 𝑖): Here, this edge should have been chosen instead of 𝑔 contradict-
          ing our choice of 𝑔.

The analysis of two remaining cases where 𝑗 < 𝑠 < 𝑖 < π‘Ÿ and 𝑗 < π‘Ÿ < 𝑖 < 𝑠 are similar to Cases 1
and 2 respectively.                                                                           

Definition 4.4. Let 𝐺 be a grid digraph and 𝐻 be an induced sub-digraph of Aux𝛼 (𝐺). The
graph 𝐻
      b is formed by first running Algorithm 1 on 𝐻 and then triangulating the underlying
undirected graph of the result

                       T HEORY OF C OMPUTING, Volume 19 (2), 2023, pp. 1–23                              10
              O N S OLVING R EACHABILITY IN G RID D IGRAPHS U SING A P SEUDOSEPARATOR

     Input: An induced sub-digraph 𝐻 of Aux𝛼 (𝐺)
 1 Output all the vertices of 𝐻;
 2 Output all the edges of planar(𝐻);
 3 foreach block β„“ in 𝐻 do
 4    foreach vertex 𝑣 of 𝐻 in β„“ do
                                                      𝑝
 5       𝑝 ← the smallest positive integer such that 𝑐ℓ (𝑣) ∈ 𝑉(𝐻);
                 𝑝
 6       if (𝑣, 𝑐ℓ (𝑣)) βˆ‰ 𝐸(planar(𝐻)) then
                                    𝑝
 7           Output the edge (𝑣, 𝑐ℓ (𝑣));
 8       end
 9    end
10 end
                    Algorithm 1: Completing the boundary of planar(𝐻)


    Note that Algorithm 1 completes the boundary of each block. Thus, for any block, the
vertices in its boundary form a simple cycle. Since the interiors of these cycles are disjoint, there
is no edge that is drawn through more than one block in 𝐻.    b Thus, each edge of 𝐻   b lies either
entirely inside one of the blocks, or lies completely outside the whole π‘š Γ— π‘š grid.
    Now, for each of those edges added to 𝐻   b as part of triangulation that is inside one of the
blocks, we define a set of at most four shield edges.
Definition 4.5. Let 𝐺 be a grid digraph and 𝐻 be an induced sub-digraph of Aux𝛼 (𝐺). Let
𝑒 = (𝑣, 𝑀) be an edge in 𝐻
                         b such that 𝑒 is inside one of the blocks and 𝑒 is not in planar(𝐻). Let 𝑝
                                  𝑝               π‘ž
and π‘ž be integers such that 𝑀 = 𝑐ℓ (𝑣) and 𝑣 = 𝑐ℓ (𝑀).
                                                                                                      𝑝
     β€’ Let 𝑝 1 be the largest integer such that 𝑝 1 < 𝑝 and an edge 𝑒1 with endpoints 𝑣 and 𝑐ℓ 1 (𝑣)
       exists in planar(𝐻). 𝑒1 is undefined if no such integer exists.
                                                                                                      𝑝
     β€’ Let 𝑝 2 be the smallest integer such that 𝑝 2 > 𝑝 and an edge 𝑒2 with endpoints 𝑣 and 𝑐ℓ 2 (𝑣)
       exists in planar(𝐻). 𝑒2 is undefined if no such integer exists.
                                                                                              π‘ž
     β€’ Let π‘ž1 be the largest integer such that π‘ž1 < π‘ž and an edge 𝑒3 with endpoints 𝑐ℓ 1 (𝑀) and 𝑀
       exists in planar(𝐻). 𝑒3 is undefined if no such integer exists.
                                                                                                  π‘ž
     β€’ Let π‘ž 2 be the smallest integer such that π‘ž2 > π‘ž and an edge 𝑒4 with endpoints 𝑐ℓ 2 (𝑀) and
       𝑀 exists in planar(𝐻). 𝑒4 is undefined if no such integer exists.

For 𝑖 = 1, 2, 3, 4, the edges 𝑒 𝑖 which are defined above are called shield edges of 𝑒.
   We will be using the following Lemma, which was proven by Imai et al., to help us in the
construction of pseudoseparator.
Lemma 4.6. [9] For every 𝛽 > 0, there exists a polynomial-time and 𝑂(β„Ž   ˜ 1/2+𝛽/2 )-space algorithm that
takes a β„Ž-vertex planar graph 𝑃 as input and outputs a set of vertices 𝑆, such that |𝑆| is 𝑂(β„Ž 1/2+𝛽/2 ) and
removal of 𝑆 disconnects the graph into components of size 𝑂(β„Ž 1βˆ’π›½ ).

                       T HEORY OF C OMPUTING, Volume 19 (2), 2023, pp. 1–23                               11
                                 R AHUL JAIN AND R AGHUNATH T EWARI

   Algorithm 2 describes how to construct a sub-digraph of 𝐻 which we call psep(𝐻). In
Lemma 4.8 we show that psep(𝐻) is a pseudoseparator of 𝐻.

   Input: Aninduced sub-digraph 𝐻 of Aux𝛼 (𝐺) and a positive number 𝛽
   Output: The digraph psep(H)
 1 Construct 𝐻 b from 𝐻;
 2 Find a set 𝑆 of vertices in 𝐻b which divides it into components of size 𝑂(𝑛 1βˆ’π›½ ) by
    applying Lemma 4.6 ;
 3 Output all the vertices of 𝑆;

 4 Output those edges of 𝐻 which are also (in its undirected form) in 𝐻[𝑆];
                                                                          b
 5 foreach edge 𝑒 = (𝑣, 𝑀) of 𝐻 b do
 6    if 𝑒 is inside a block of 𝐻
                                b and 𝑒 βˆ‰ 𝐸(planar(𝐻)) and both endpoints of 𝑒 are in 𝑆 then
 7        Output all the shield edges of 𝑒 along with their end vertices.
 8    end
 9 end
                             Algorithm 2: Construction of psep(H)


Lemma 4.7. Let 𝐺 be a grid digraph , and 𝐻 be aninduced sub-digraph of Aux𝛼 (𝐺). For every 𝛽 > 0,
                                   ˜ 1/2+𝛽/2 )-space algorithm that takes 𝐻 as input and outputs
there exists a polynomial-time and 𝑂(β„Ž
psep(H).

Proof. To prove this lemma, we analyse the space and time complexity of Algorithm 2. We will
               b is constructed from 𝐻 in logspace. To see it, we first note that we can decide if an
first see that 𝐻
edge 𝑒 of 𝐻 belong to planar(𝐻) in logspace by checking if 𝑒 satisfies the condition required by
Definition 4.2. Next, the boundary of planar(𝐻) is completed in logspace by using Algorithm 1.
Finally we triangulate the resultant graph in logspace: For every face 𝑓 in the resultant graph, we
connect each vertex of 𝑓 to the lowest-indexed vertex of 𝑓 . The space complexity of construction
of psep(H) is thus dominated by the space required by step 2 of Algorithm 2. By Lemma 4.6, we
know that this step requires 𝑂(β„Ž 1/2+𝛽/2 ) space. Hence, the space required by Algorithm 2 is
𝑂(β„Ž 1/2+𝛽/2 ). Each step of Algorithm 2 is performed in polynomial time, hence the total time
complexity is bounded by a polynomial.                                                              

Lemma 4.8. Let 𝐺 be a grid digraph , and 𝐻 be aninduced sub-digraph of Aux𝛼 (𝐺). The digraph
psep(𝐻) is a β„Ž 1βˆ’π›½ -pseudoseparator of 𝐻.

   To prove Lemma 4.8, we first show a property of triangulated graphs that we use in our
construction of pseudoseparator. We know that a simple cycle in a planar embedding of a
planar graph divides the plane into two parts. We call these two parts the two sides of the cycle.

Lemma 4.9. Let 𝐺 be a triangulated planar graph, and 𝑆 be a subset of its vertices. For each pair of
vertices 𝑒, 𝑣 belonging to different components of 𝐺 \ 𝑆, a cycle in 𝐺[𝑆] exists, such that 𝑒 and 𝑣 belong
to different sides of this cycle.

                       T HEORY OF C OMPUTING, Volume 19 (2), 2023, pp. 1–23                            12
             O N S OLVING R EACHABILITY IN G RID D IGRAPHS U SING A P SEUDOSEPARATOR

Proof. To prove the Lemma, we first need some terminology. We call a set of faces a region of
edge-connected faces if they induce a connected subgraph in the dual graph. We can orient the
edges of an undirected planar simple cycle to make it a directed cycle. This can help us identify
the two sides of the cycle as interior (left-side) and exterior (right-side).
    Let 𝐢 be a component of 𝐺 \ 𝑆 and 𝑆0 be the set of vertices of 𝑆 adjacent to at least one of the
vertices of 𝐢 in 𝐺. Let 𝐹 be the set of triangle faces of 𝐺 to which at least one vertex of 𝐢 belongs.
Let 𝐺˜ be the dual graph of 𝐺 and 𝐺[𝐹]  ˜    be the subgraph induced by 𝐹 on this dual graph.
    We first observe that since we have started with a triangulated graph, the vertices of any face
 𝑓 of 𝐹 will either belong to 𝐢 or 𝑆0.
    Let 𝑓1 and 𝑓2 be two arbitrary faces of 𝐹. We will first show that 𝐹 is a region of edge-connected
faces by showing that there exists a path between 𝑓1 and 𝑓2 in 𝐺[𝐹].       ˜     Let 𝑣 1 be a vertex of 𝐢
which belongs to 𝑓1 . Similarly, let 𝑣2 be a vertex of 𝐢 which belongs to 𝑓2 . Let the length of
shortest path between 𝑣 1 and 𝑣 2 in 𝐺 \ 𝑆 be π‘˜. We prove our claim by induction on π‘˜. If π‘˜ = 0,
then 𝑣 1 = 𝑣 2 . We know that the set of faces that share a vertex induce a connected subgraph
in the dual graph, hence our claim holds for π‘˜ = 0. Now, we assume that our claim holds for
path length π‘˜ = β„“ βˆ’ 1. To prove that our claim holds for π‘˜ = β„“ , let (𝑣3 , 𝑣2 ) be the last edge in the
shortest path from 𝑣 1 to 𝑣 2 . Let 𝑓3 be a face with both 𝑣 3 and 𝑣 2 in its boundary. Since the length
of shortest path from 𝑣 1 to 𝑣 3 is β„“ βˆ’ 1, by induction hypothesis, there exists a path between 𝑓1
            ˜
and 𝑓3 in 𝐺[𝐹].   Since 𝑓3 and 𝑓2 share the vertex 𝑣2 , there is a path between 𝑓3 and 𝑓2 in 𝐺[𝐹].   ˜
Combining these two paths, we get a path between 𝑓1 and 𝑓2 in 𝐺[𝐹]       ˜     which proves our claim.
    Miller proved that the boundary of a region of edge-connected faces is a set of edge-disjoint
simple cycles which can be oriented such that they have disjoint exteriors [12]. We claim that all
the vertices of any boundary cycle of 𝐹 are contained in 𝑆0. We prove this claim by contradiction.
Let us assume that 𝑣 is a vertex in a boundary cycle of 𝐹 that is not in 𝑆0. In this case, 𝑣 belongs
to 𝐢. Consider an edge (𝑣, 𝑀) of the boundary cycle. Let π‘“π‘Ž and 𝑓𝑏 be the two faces that shares
the edge (𝑣, 𝑀). Let 𝑣 π‘Ž and 𝑣 𝑏 be the third vertex of π‘“π‘Ž and 𝑓𝑏 respectively. Since 𝑣 π‘Ž , 𝑣 𝑏 and 𝑀
are all connected to 𝑣, they are in either 𝑆0 or 𝐢. Thus both π‘“π‘Ž and 𝑓𝑏 are in 𝐹. However, this
contradicts that (𝑣, 𝑀) is at boundary of 𝐹.
    Thus, we have proved that the vertices of a connected component of 𝐺 \ 𝑆 are contained
inside a set of edge-disjoint simple cycles with disjoint exteriors. The vertices of all such cycles
are contained in 𝑆. Hence the lemma follows.                                                            

Proof of Lemma 4.8. Let 𝐢 = psep(𝐻). Let 𝑆 be the set of vertices obtained from 𝐻        b by using
Lemma 4.6. We claim that if any two vertices 𝑒 and 𝑣 belong to different connected components
of 𝐻
   b \ 𝑆, then it belongs to different components of cc(𝐻  𝐢). We prove this by contradiction.
Let us assume that it is not true. Then there is an edge 𝑒 in 𝐻 and two distinct sets π‘ˆ1 and π‘ˆ2 of
cc(𝐻b \ 𝑆) such that one of the end point of 𝑒 is in π‘ˆ1 , the other is in π‘ˆ2 and 𝑒 does not cross any
                                                                       𝑝
of the edges of psep(𝐻). Without loss of generality, let 𝑒 = (𝑣, 𝑐ℓ (𝑣)), for some block β„“ , where
              𝑝
𝑣 ∈ π‘ˆ1 and 𝑐ℓ (𝑣) is not in π‘ˆ1 (we pick the edge 𝑒 such that 𝑝 is minimum for any choice of 𝑣).
                                                                                            π‘ž
Due to Lemma 4.9, it follows that there exists an edge 𝑓 in 𝐻[𝑆]
                                                             b    such that 𝑓 = ((𝑐ℓ (𝑣)), π‘β„“π‘Ÿ (𝑣))
and that 𝑒 crosses 𝑓 . This edge 𝑓 is a triangulation edge, for otherwise it is also in psep(H)
giving us a contradiction. We orient the triangulation edge so that π‘ž < 𝑝 < π‘Ÿ. Now, since 𝑒 is

                      T HEORY OF C OMPUTING, Volume 19 (2), 2023, pp. 1–23                            13
                                    R AHUL JAIN AND R AGHUNATH T EWARI

not in planar(𝐻), by Lemma 4.3 there exists at least one edge that crosses it and is in planar(𝐻).
Let 𝑔 = (𝑐ℓ𝑠 (𝑣), 𝑐ℓ𝑑 (𝑣)) be one such edge such that 𝑑 βˆ’ 𝑠 is maximum1 We thus have the following
cases:
Case 1 (𝑠 < π‘ž < 𝑝 < π‘Ÿ < 𝑑): In this case, since 𝑔 crosses 𝑒, by Lemma 3.5, we have that the edge
                      𝑝
     𝑒 0 = (𝑐ℓ𝑠 (𝑣), 𝑐ℓ (𝑣)) is also in 𝐻. 𝑒 0 also crosses 𝑓 . Since 𝑝 βˆ’ 𝑠 < 𝑝, existence of 𝑒 0 contradicts
     our choice of 𝑒.

Case 2 (π‘ž < 𝑑 < 𝑝 < 𝑠 < π‘Ÿ): In this case, since 𝑔 crosses 𝑒, by Lemma 3.5, we have that the edge
     𝑒 0 = (𝑣, 𝑐ℓ𝑑 (𝑣)) is also in 𝐻. 𝑒 0 also crosses 𝑓 . Since 𝑑 < 𝑝, existence of 𝑒 0 contradicts our
     choice of 𝑒.
                                                                         𝑝
Case 3 (𝑑 < π‘ž < 𝑝 < π‘Ÿ < 𝑠): In this case, the edge 𝑒 0 = (𝑐ℓ𝑠 (𝑣), 𝑐ℓ (𝑣)) will also be in 𝐻. 𝑒 0 will cross
      𝑓 and hence will not be in planar(𝐻). By Lemma 4.3, there exists an edge 𝑔 0 = (𝑐ℓ𝑠 (𝑣), 𝑐ℓ𝑑 (𝑣))
                                                                                               0        0


     in planar(𝐻) that crosses 𝑒 0. Since both 𝑔 0 and 𝑔 are in planar(𝐻), these edges do not cross
     each other.
      Using the fact that 𝑔 0 crosses 𝑒 0 and 𝑔 0 does not cross 𝑔, we get the following:

                                       𝑑 ≀ min(𝑠 0 , 𝑑 0) < 𝑝 < max(𝑠 0 , 𝑑 0) < 𝑠

      Consequently, 𝑑 0 βˆ’ 𝑠 0 > 𝑑 βˆ’ 𝑠 and 𝑔 0 crosses 𝑒. This contradicts our choice of 𝑔.

Case 4 (π‘ž < 𝑠 < 𝑝 < 𝑑 < π‘Ÿ): In this case, since 𝑔 crosses 𝑒, by Lemma 3.5, we have that the edge
     𝑒 0 = (𝑣, 𝑐ℓ𝑑 (𝑣)) is in 𝐻. 𝑒 0 also crosses 𝑓 and hence 𝑒 0 was not in planar(𝐻). Thus there will
     exist an edge in planar(𝐻) which crosses 𝑒 0 by Lemma 4.3. Let 𝑔 0 = (𝑐ℓ𝑠 (𝑣), 𝑐ℓ𝑑 (𝑣)) be the
                                                                                     0     0


     edge in planar(𝐻) that crosses 𝑒 0 such that 𝑑 0 βˆ’ 𝑠 0 is maximum. We have the following
     subcases:

      Case 4a (𝑠 0 < π‘ž < 𝑑 < π‘Ÿ < 𝑑 0): In this case, since 𝑔 0 crosses 𝑒, by Lemma 3.5, we have that
                                     𝑝
          the edge 𝑒 00 = (𝑐ℓ𝑠 (𝑣), 𝑐ℓ (𝑣)) is also in 𝐻. 𝑒 00 also crosses 𝑓 . Since 𝑝 βˆ’ 𝑠 0 < 𝑝, existence
                              0


          of 𝑒 00 contradicts our choice of 𝑒.
      Case 4b (π‘ž < 𝑑 0 < 𝑑 < 𝑠 0 < π‘Ÿ): In this case, we see that since 𝑔 and 𝑔 0 are both in planar(𝐻),
          they do not cross each other. Therefore. 𝑑 0 ≀ 𝑠 and consequently 𝑑 0 < 𝑝. Thus, 𝑔 0
          crosses 𝑒 and by Lemma 3.5, the edge 𝑒 00 = (𝑣, 𝑐ℓ𝑑 (𝑣)) is also in 𝐻. 𝑒 00 also crosses 𝑓 .
                                                                 0


          Since 𝑑 0 < 𝑝, existence of 𝑒 00 contradicts our choice of 𝑒.
      Case 4c (𝑑 0 < π‘ž < 𝑑 < π‘Ÿ < 𝑠 0): In this case, the edge 𝑒 00 = (𝑐ℓ𝑠 (𝑣), 𝑐ℓ𝑑 (𝑣)) will also be in 𝐻.
                                                                                0


          𝑒 00 will cross 𝑓 and hence will not be in planar(𝐻). By Lemma 4.3, there exists an
          edge 𝑔 00 = (𝑐ℓ𝑠 (𝑣), 𝑐ℓ𝑑 (𝑣)) in planar(𝐻) that crosses 𝑒 00. Since 𝑔 00, 𝑔 0 and 𝑔 are all in
                           00      00


          planar(𝐻), these edges do not cross each other.
          Using the fact that 𝑔 00 crosses 𝑒 00, 𝑔 00 does not cross 𝑔 0 and 𝑔 00 does not cross 𝑔; we get
          the following:
   1We note that we do not consider the absolute value of the 𝑑 βˆ’ 𝑠, rather we consider the actual value. 𝑑 βˆ’ 𝑠 can
hence be negative for an edge.


                         T HEORY OF C OMPUTING, Volume 19 (2), 2023, pp. 1–23                                   14
                  O N S OLVING R EACHABILITY IN G RID D IGRAPHS U SING A P SEUDOSEPARATOR


                   𝑀
                                                                                           𝑒                    𝑣
                                                                                                        𝑒
           𝑒                                                                               𝑒0                   𝑣0
                           𝑣
    (a) The 𝑠-𝑑 path takes a vertex of the separator                           (b) The 𝑠-𝑑 path crosses an edge of the separator

                                                            Figure 4



                                             𝑑 0 ≀ min(𝑠 00 , 𝑑 00) < 𝑠 < 𝑑 < max(𝑠 00 , 𝑑 00) < 𝑠 0

                Consequently, 𝑑 00 βˆ’ 𝑠 00 > 𝑑 0 βˆ’ 𝑠 0 and 𝑔 00 crosses 𝑒 0. This contradicts our choice of 𝑔 0.
         Case 4d (π‘ž < 𝑠 0 < 𝑑 < 𝑑 0 < π‘Ÿ): In this case, we see that since 𝑔 and 𝑔 0 are both in planar(𝐻),
             they do not cross each other. Therefore 𝑠 0 ≀ 𝑠 and consequently 𝑠 0 < 𝑝. Thus, 𝑔 0
             crosses 𝑒 and 𝑑 0 βˆ’ 𝑠 0 > 𝑑 βˆ’ 𝑠. This contradicts our choice of 𝑔.

In other cases, if 𝑔 is picked such that one of its vertices is common with 𝑓 , then 𝑒 will cross a
𝑠 β„Žπ‘–π‘’π‘™π‘‘ edge of 𝑓 , giving a contradiction. If 𝑔 is picked such that 𝑔 cross 𝑓 , then it contradicts the
fact that both of them are in 𝐻,b which is a planar digraph .                                          

      Summarizing Lemmas 4.7 and 4.8 we have Theorem 4.10.

Theorem 4.10. Let 𝐺 be a grid digraph and 𝐻 be aninduced subgraph of Aux𝛼 (𝐺) with β„Ž vertices. For
                                    ˜ 1/2+𝛽/2 )-space and polynomial-time algorithm that takes 𝐻 as
any constant 𝛽 > 0, there exists an 𝑂(β„Ž
input and outputs an β„Ž -pseudoseparator of size 𝑂(β„Ž 1/2+𝛽/2 ).
                      1βˆ’π›½



5      Algorithm to solve reachability in the auxiliary digraph
In this section, we discuss the grid digraph reachability algorithm. Let 𝐺 be a grid digraph
having e𝑛 vertices. By induction, we assume that we have access to an induced subgraph 𝐻 of
Aux𝛼 (𝐺), containing β„Ž vertices. Below we describe a recursive procedure AuxReach(𝐻, π‘₯, 𝑦) that
outputs true if there is a path from π‘₯ to 𝑦 in 𝐻 and outputs false otherwise.

5.1      Description of the algorithm AuxReach
First we construct a β„Ž 1βˆ’π›½ -pseudoseparator 𝐢 of 𝐻, using Theorem 4.10. We also ensure that π‘₯
and 𝑦 are part of 𝐢 (if not then we add them). Let 𝐼1 , 𝐼2 , . . . , 𝐼ℓ be the connected components of
𝐻  𝐢.
     We maintain an array called visited of size |𝐢| to mark vertices or edges of the pseudoseparator
𝐢. Each cell of visited corresponds to a distinct vertex or edge of 𝐢. For a vertex 𝑣 in 𝐢, we set
visited[𝑣] := 1 if there is a path from π‘₯ to 𝑣 in 𝐻, else it is set to 0. For an edge 𝑒 = (𝑒, 𝑣) in 𝐢, we
set visited[𝑒] := 𝑒 0 if (i) there is an edge 𝑓 = (𝑒 0 , 𝑣 0) that crosses 𝑒, (ii) there is a path from π‘₯ to 𝑒 0

                               T HEORY OF C OMPUTING, Volume 19 (2), 2023, pp. 1–23                                           15
                                 R AHUL JAIN AND R AGHUNATH T EWARI

in 𝐻 and (iii) 𝑓 is the closest such edge to 𝑒. Else visited[𝑒] is set to NULL. Initially, for all vertex
𝑣 ∈ 𝐢, visited[𝑣] := 0 and for all edges 𝑒 ∈ 𝐢, visited[𝑒] := NULL. We say that a vertex 𝑣 is marked
if either visited[𝑣] = 1 or visited[𝑒] = 𝑣 for some edge 𝑒.
     First set visited[π‘₯] := 1. We then perform an outer loop with β„Ž iterations and in each iteration
update certain entries of the array visited as follows. For every vertex 𝑣 ∈ 𝐢, the algorithm sets
visited[𝑣] := 1 if there is a path from a marked vertex to 𝑣 such that the internal vertices of that
path all belong to only one component 𝐼 𝑖 . Similarly, for each edge 𝑒 = (𝑒, 𝑣) of 𝐢, the algorithm
sets visited[𝑒] := 𝑒 0 if (i) there exists an edge 𝑓 = (𝑒 0 , 𝑣 0) which crosses 𝑒, (ii) there is a path
from a marked vertex to 𝑒 0 such that the internal vertices of that path all belong to only one
component 𝐼 𝑖 and, (iii) 𝑓 is the closest such edge to 𝑒. Finally we output true if visited[𝑦] = 1 else
output false. We use the procedure AuxReach recursively to check if there is a path between two
vertices in a single connected component of 𝐻  𝐢. A formal description of AuxReach is given in
Algorithm 3.

5.2   Proof of correctness of AuxReach
Let 𝑃 be a path from π‘₯ to 𝑦 in 𝐻. Suppose 𝑃 passes through the components 𝐼 𝜎1 , 𝐼 𝜎2 , . . . , 𝐼 𝜎𝐿 in
this order. The length of this sequence is at most |𝐻 |. As the path leaves the component 𝐼 𝜎 𝑗 and
goes into 𝐼 𝜎 𝑗+1 , it can do in the following two ways only:
   1. The path exits 𝐼 𝜎 𝑗 through a vertex 𝑀 of pseudoseparator as shown in Figure 4a. In this
      case, Algorithm 3 marks the vertex 𝑀.

   2. The path exits 𝐼 𝜎 𝑗 through an edge (𝑒, 𝑣) whose other endpoint is in 𝐼 𝜎 𝑗+1 . By Lemma 3.6,
      this edge will cross an edge 𝑒 = (π‘₯ 0 , 𝑦 0) of the pseudoseparator. In this case, Algorithm 3
      marks the vertex 𝑒 0, such that there is an edge (𝑒 0 , 𝑣 0) that crosses 𝑒 as well and (𝑒 0 , 𝑣 0) is
      closer than (𝑒, 𝑣) to π‘₯ 0 and there is a path in 𝐼 𝜎 𝑗 from a marked vertex to 𝑒 0. By Lemma 3.6,
      the edge (𝑒 0 , 𝑣) is in 𝐻 as well.
Thus after the 𝑗-th iteration, AuxReach traverses the fragment of the path in the component
𝐼 𝜎 𝑗 and either marks its endpoint or a vertex which is closer to the edge 𝑒 of 𝐢 which the path
crosses. Finally, 𝑦 is marked after 𝐿 iterations if and only if there is a path from π‘₯ to 𝑦 in 𝐻.
We give a formal proof of correctness in Lemma 5.1. For a path 𝑃 = (𝑒1 , 𝑒2 , . . . 𝑒𝑑 ), we define
tail(𝑃) := 𝑒1 and head(𝑃) := 𝑒𝑑 .

Lemma 5.1. Let 𝐺 be a grid digraph and 𝐻 be aninduced subgraph of Aux𝛼 (𝐺). Then for any two
vertices π‘₯, 𝑦 in 𝐻, there is a path from π‘₯ to 𝑦 in 𝐻 if and only if AuxReach(𝐻, π‘₯, 𝑦) returns true.
Proof. Firstly observe that, if a vertex is marked, then there is a path from some other marked
vertex to that vertex in 𝐻. Hence if there is no path from π‘₯ to 𝑦 then 𝑦 is never marked by
AuxReach and hence AuxReach returns false.
   Now let 𝑃 be a path from π‘₯ to 𝑦 in 𝐻. We divide the path into subpaths 𝑃1 , 𝑃2 , . . . , 𝑃ℓ , such
that for each 𝑖, all vertices of 𝑃𝑖 belong to π‘ˆ βˆͺ 𝑉(𝐢) for some connected component π‘ˆ in cc(𝐻  𝐢)
and either (i) head(𝑃𝑖 ) = tail(𝑃𝑖+1 ), or (ii) 𝑒 𝑖 = (head(𝑃𝑖 ), tail(𝑃𝑖+1 )) is an edge that crosses some
edge 𝑓𝑖 ∈ 𝐢. By Definition 4.1, we have that if condition (i) is true then head(𝑃𝑖 ) is a vertex in 𝐢,

                       T HEORY OF C OMPUTING, Volume 19 (2), 2023, pp. 1–23                              16
            O N S OLVING R EACHABILITY IN G RID D IGRAPHS U SING A P SEUDOSEPARATOR




    Input: An induced subgraph 𝐻 of Aux𝛼 (𝐺) and two vertices π‘₯ and 𝑦 in 𝐻 (let 𝐺 be an
            π‘š Γ— π‘š grid digraph and β„Ž = |𝑉(𝐻)|)
    Output: true if there is a path from π‘₯ to 𝑦 in 𝐻 and false otherwise
 1 if β„Ž ≀ π‘š 1/8 then Use DFS to solve the problem; /* π‘š is a global variable where
     𝐺 is an π‘š Γ— π‘š grid digraph */
 2 else
  3    Compute a β„Ž 1βˆ’π›½ -pseudoseparator 𝐢 of 𝐻 using Theorem 4.10;
  4    𝐢 ← 𝐢 βˆͺ {π‘₯, 𝑦};
  5    foreach edge 𝑒 in 𝐢 do visited[𝑒] ← NULL;
  6    foreach vertex 𝑣 in 𝐢 do visited[𝑣] ← 0;
  7    visited[π‘₯] ← 1;
  8    for 𝑖 = 1 to |𝐻 | do
  9         foreach edge 𝑒 = (𝑒, 𝑣) ∈ 𝐢 do
10              closestedge ← NULL;
11              foreach marked vertex 𝑀 do
12                  foreach π‘ˆ ∈ cc(𝐻  𝐢) do
 13                      foreach edge 𝑓 = (𝑒 0 , 𝑣 0) such that 𝑓 crosses 𝑒 do
 14                         if AuxReach(𝐻[π‘ˆ βˆͺ {𝑀, 𝑒 0 }], 𝑀, 𝑒 0) = true then
 15                             if closestedge = NULL or 𝑓 is closer to 𝑒 than closestedge then
 16                                 visited[𝑒] ← 𝑒 0;
 17                                 closestedge ← 𝑓 ;
 18                             end
 19                         end
 20                      end
21                  end
22              end
23          end
24          foreach vertex 𝑣 ∈ 𝐢 do
25              if βˆƒπ‘€βˆƒπ‘ˆ such that 𝑀 is a marked vertex and π‘ˆ ∈ cc(𝐻  𝐢) and
                 AuxReach(𝐻[π‘ˆ βˆͺ {𝑀, 𝑣}], 𝑀, 𝑣) = true)) then
26                  visited[𝑣] ← 1;
27              end
28          end
29     end
30     if visited[𝑦] = 1 then return true;
31     else return false;
32 end
                                  Algorithm 3: AuxReach(𝐻, 𝑠, 𝑑)




                    T HEORY OF C OMPUTING, Volume 19 (2), 2023, pp. 1–23                          17
                                  R AHUL JAIN AND R AGHUNATH T EWARI

and if condition (ii) is true then head(𝑃𝑖 ) and tail(𝑃𝑖+1 ) belong to two different components of
cc(𝐻  𝐢) and 𝑒 𝑖 is the edge between them.
    We claim that after 𝑖-th iteration of loop in Line 8 of Algorithm 3, either of the following two
statements hold:

   1. head(𝑃𝑖 ) is a vertex in 𝐢 and visited[head(𝑃𝑖 )] = 1.

   2. There exists an edge 𝑓𝑖 = (𝑒𝑖 , 𝑣 𝑖 ) of 𝐢 such that the edge 𝑒 𝑖 = (head(𝑃𝑖 ), tail(𝑃𝑖+1 )) crosses
      𝑓𝑖 and there is an edge 𝑔 𝑖 = (𝑒𝑖0 , 𝑣 0𝑖 ) which crosses 𝑓𝑖 as well, such that 𝑔 𝑖 is closer to 𝑒𝑖 than
      𝑒 𝑖 and visited[ 𝑓𝑖 ] = 𝑒𝑖0.

We prove the claim by induction. The base case holds since π‘₯ is marked at the beginning. We
assume that the claim is true after the (𝑖 βˆ’ 1)-th iteration. We have that 𝑃𝑖 belongs to π‘ˆ βˆͺ 𝑉(𝐢)
for some connected component π‘ˆ in cc(𝐻  𝐢).

Case 1 (head(π‘ƒπ‘–βˆ’1 ) = tail(𝑃𝑖 ) = 𝑀(say)): By induction hypothesis 𝑀 was marked after the (𝑖 βˆ’ 1)-
     th iteration. If head(𝑃𝑖 ) is a vertex in 𝐢 then it will be marked after the 𝑖-th iteration in
     Line 26. On the other hand if 𝑒 𝑖 = (head(𝑃𝑖 ), tail(𝑃𝑖+1 )) is an edge that crosses some edge
     𝑓𝑖 = (𝑒𝑖 , 𝑣 𝑖 ) ∈ 𝐢 then in the 𝑖-th iteration in Line 16, the algorithm marks a vertex 𝑒𝑖0 such
     that, 𝑔 𝑖 = (𝑒𝑖0 , 𝑣 0𝑖 ) is the closest edge to 𝑒𝑖 that crosses 𝑓𝑖 and there is a path from 𝑀 to 𝑒𝑖0.

Case 2 (𝑒 π‘–βˆ’1 = (head(π‘ƒπ‘–βˆ’1 ), tail(𝑃𝑖 )) crosses some edge π‘“π‘–βˆ’1 = (π‘’π‘–βˆ’1 , 𝑣 π‘–βˆ’1 ) ∈ 𝐢): By induction hy-
     pothesis, there is an edge 𝑔 π‘–βˆ’1 = (π‘’π‘–βˆ’1    0
                                                    , 𝑣 0π‘–βˆ’1 ) which crosses π‘“π‘–βˆ’1 as well, such that 𝑔 π‘–βˆ’1 is
     closer to π‘’π‘–βˆ’1 than 𝑒 π‘–βˆ’1 and visited[ π‘“π‘–βˆ’1 ] = π‘’π‘–βˆ’1 0
                                                              . By Lemma 3.6 there is an edge in 𝐻 between
     π‘’π‘–βˆ’1 and tail(𝑃𝑖 ) as well. Now if head(𝑃𝑖 ) is a vertex in 𝐢 then it will be marked after the
       0

     𝑖-th iteration in Line 26 by querying the digraph 𝐻[π‘ˆ βˆͺ {π‘’π‘–βˆ’1           0
                                                                                , head(𝑃𝑖 )}]. On the other
     hand if 𝑒 𝑖 = (head(𝑃𝑖 ), tail(𝑃𝑖+1 )) is an edge that crosses some edge 𝑓𝑖 = (𝑒𝑖 , 𝑣 𝑖 ) ∈ 𝐢 then in
     the 𝑖-th iteration in Line 16, AuxReach queries the digraph 𝐻[π‘ˆ βˆͺ {π‘’π‘–βˆ’1           0
                                                                                         , 𝑒𝑖0 }] and marks a
     vertex 𝑒𝑖 such that, 𝑔 𝑖 = (𝑒𝑖 , 𝑣 𝑖 ) is the closest edge to 𝑒𝑖 that crosses 𝑓𝑖 and there is a path
                0                   0 0

     from π‘’π‘–βˆ’10
                  to 𝑒𝑖0.                                                                                  

    Our subroutine solves reachability in a subgraph 𝐻 (having size β„Ž) of Aux𝛼 (𝐺). We do
not explicitly store a component of cc(𝐻  𝐢), since it might be too large. Instead, we identify
a component with the lowest indexed vertex in it and use Reingold’s algorithm on 𝐻  𝐢
to determine if a vertex is in that component. We require 𝑂(β„Ž      e 1/2+𝛽/2 ) space to compute
a β„Ž 1βˆ’π›½ -pseudoseparator by Theorem 4.10. We can potentially mark all the vertices of the
pseudoseparator and for each edge of the pseudoseparator we mark at most one additional
vertex. Since the size of the pseudoseparator is at most 𝑂(β„Ž 1/2+𝛽/2 ), we require 𝑂(β„Že 1/2+𝛽/2 )
space. The algorithm recurses on a digraph with β„Ž      1βˆ’π›½ vertices. Since we stop the recursion
when β„Ž ≀ π‘š 1/8 (Line 1 of Algorithm 3), the depth of the recursion is at most dβˆ’3/log(1 βˆ’ 𝛽)e,
which is a constant.
    Since the digraph 𝐻 is given implicitly in our algorithm, an additional polynomial overhead
is involved in obtaining its vertices and edges. However, the total time complexity remains a
polynomial in the number of vertices since the recursion depth is constant.

                       T HEORY OF C OMPUTING, Volume 19 (2), 2023, pp. 1–23                                18
             O N S OLVING R EACHABILITY IN G RID D IGRAPHS U SING A P SEUDOSEPARATOR

Lemma 5.2. Let 𝐺 be an π‘š Γ— π‘š grid digraph and 𝐻 beaninduced subgraph of Aux𝛼 (𝐺) with β„Ž vertices.
For every 𝛽 > 0, AuxReach runs in 𝑂(β„Ž
                                  e 1/2+𝛽/2 ) space and polynomial time.

Proof. Since the size of a component π‘ˆ in cc(𝐻  𝐢) might be too large, we will not explicitly
store it. Instead we identify a component by the lowest index vertex in it and use Reingold’s
algorithm on 𝐻  𝐢 to determine if a vertex is in π‘ˆ. Let 𝑆(π‘š, β„Ž) and 𝑇(π‘š, β„Ž) denote the space
and time complexity functions respectively of AuxReach, where 𝐺 is an π‘š Γ— π‘š grid digraph and
β„Ž is the number of vertices in the digraph 𝐻. As noted earlier the depth of the recursion is at
most 𝑑 := dβˆ’3/log(1 βˆ’ 𝛽)e.
    Consider 𝑆(π‘š, β„Ž) for any β„Ž > π‘š 1/8 . By Theorem 4.10, we require 𝑂(β„Že 1/2+𝛽/2 ) space to execute
Line 3. We can potentially mark all the vertices of 𝐢 and for each edge 𝑒 of 𝐢 we store at
most one additional vertex in visited[𝑒]. Since the size of 𝐢 is at most 𝑂(β„Ž 1/2+𝛽/2 ), we require
e 1/2+𝛽/2 ) space to store 𝐢. By induction, a call to AuxReach in line 16 and 26 requires 𝑆(π‘š, β„Ž 1βˆ’π›½ )
𝑂(β„Ž
space which can be subsequently reused. Hence the space complexity satisfies the following
recurrence. Then,                  (
                                     𝑆(π‘š, β„Ž 1βˆ’π›½ ) + 𝑂(β„Ž
                                                    e 1/2+𝛽/2 ) β„Ž > π‘š 1/8
                        𝑆(π‘š, β„Ž) =
                                     𝑂(β„Ž)
                                     e                          otherwise.

Solving we get 𝑆(π‘š, β„Ž) = 𝑂(β„Ž
                          e 1/2+𝛽/2 + π‘š 1/4 ).
    Next we measure the time complexity of AuxReach. Consider the case when β„Ž > π‘š 1/8 . The
total number of steps in AuxReach is some polynomial in β„Ž, say 𝑝. Moreover AuxReach makes π‘ž
calls to AuxReach, where π‘ž is some other polynomial in β„Ž. Hence π‘ž(β„Ž) ≀ 𝑝(β„Ž). Then,
                                         (
                                             π‘ž Β· 𝑇(β„Ž 1βˆ’π›½ ) + 𝑝   β„Ž > π‘š 1/8
                             𝑇(π‘š, β„Ž) =
                                             𝑂(β„Ž)                otherwise.

Solving the above recurrence we get 𝑇(π‘š, β„Ž) = 𝑂(𝑝 Β· π‘ž 𝑑 + π‘š 1/4 ) = 𝑂(𝑝 2𝑑 + π‘š 1/4 ).               


6   Solving grid digraph
Let 𝐺 be an π‘š Γ— π‘š grid digraph . As mentioned in the introduction, our objective is to run the
algorithm 3 on the digraph Aux𝛼 (𝐺). Consider two vertices π‘₯ and 𝑦 of Aux𝛼 (𝐺). Note that, by
definition, 𝑦 is reachable from π‘₯ in Aux𝛼 (𝐺) if and only if 𝑦 is reachable from π‘₯ in 𝐺. Hence it is
sufficient to work with the digraph Aux𝛼 (𝐺). However, we do not have explicit access to the
edges of Aux𝛼 (𝐺). Note that we can obtain the edges of Aux𝛼 (𝐺) by solving the corresponding
subgrid of 𝐺 to which that edge belongs. If the subgrid is small enough, then we use a standard
linear space-traversal algorithm. Otherwise, we use our algorithm recursively on the subgrid.
Algorithm 4 outlines this method.
    Consider an π‘š  bΓ—π‘š b grid digraph 𝐺.
                                       b Let 𝑆(π‘š b ) be the space complexity and 𝑇(π‘š b ) be the time
complexity of executing GridReach on 𝐺. Note that the size of Aux𝛼 (𝐺) is at most π‘š
                                          b                                b              b 1+𝛼 . For
π‘š
b > π‘š , the space required to solve the grid digraph
        1/8



                      T HEORY OF C OMPUTING, Volume 19 (2), 2023, pp. 1–23                         19
                               R AHUL JAIN AND R AGHUNATH T EWARI


    Input: A grid digraph 𝐺   b and two vertices b   𝑠, b
                                                        𝑑 of 𝐺
                                                             b and a positive integer π‘š
    Output: true if there is a path from 𝑠 to 𝑑 in 𝐺 and false otherwise
    if 𝐺
       b is smaller than π‘š 1/8 Γ— π‘š 1/8 grid then
        Use Depth-First Search to solve the problem;
    end
    else
        Use ImplicitAuxReach(Aux𝛼 (𝐺), b   𝑠, b
                                              𝑑) to solve the problem;
             /* ImplicitAuxReach executes the same way as AuxReach except for the
        case when it queries an edge (𝑒, 𝑣) in a block 𝐡 of Aux𝛼 (𝐺). In this
        case, the query is answered by calling GridReach(𝐡, 𝑒, 𝑣, π‘š) where 𝐡 is
        the subgrid in which edge (𝑒, 𝑣) might belong. */
    end
                                Algorithm 4: GridReach(𝐺,     bb𝑠, b
                                                                   𝑑, π‘š)


   is 𝑆(π‘š
        b ) = 𝑆(π‘š
                b 1βˆ’π›Ό ) + 𝑂((
                           e π‘š  b 1+𝛼 )1/2+𝛽/2 ). This is because, a query whether (𝑒, 𝑣) ∈ 𝐺invokes
                                                                                            b        a
recursion which requires 𝑆(π‘š    b ) space and the main computation of ImplicitAuxReach can be
                                   1βˆ’π›Ό

done using 𝑂((
            e π‘š b 1+𝛼 )1/2+𝛽/2 ) space. Hence we get the following recurrence for space complexity.
                                 (
                                     𝑆(π‘š
                                       b 1βˆ’π›Ό ) + 𝑂((
                                                 e π‘š b 1+𝛼 )1/2+𝛽/2 ) π‘š
                                                                      b > π‘š 1/8
                        𝑆(π‘š
                          b) =
                                     𝑂(
                                     eπ‘š b 1/4 )                       otherwise

Similar to the analysis of AuxReach, for appropriate polynomials 𝑝 and π‘ž, the time complexity
satisfies the following recurrence:
                                     (
                                         π‘ž(π‘š
                                           b ) Β· 𝑇(π‘š
                                                   b 1βˆ’π›Ό ) + 𝑝(π‘š
                                                               b)   π‘š
                                                                    b > π‘š 1/8
                          𝑇(π‘š
                            b) =
                                         𝑂(π‘š
                                           b)                       otherwise.

Solving we get 𝑆(π‘š) = 𝑂(π‘š
                      e 1/2+𝛽/2+𝛼/2+𝛼𝛽/2 ) and 𝑇(π‘š) = poly(π‘š). For any constant πœ– > 0, we can
chose 𝛼 and 𝛽 such that 𝑆(π‘š) = 𝑂(π‘š 1/2+πœ– ).


7   Conclusion
Our result improves upon the known time–space bounds on the grid digraph . Asano et al. [4]
used a clever idea of exploiting the grid structure of the input digraph to reduce its size. Their
exploitation destroyed the grid structure of the input digraph , but they did not go far enough
to destroy its planar structure as well. Our exploitation goes a step further. We get a non-planar
auxiliary digraph that is smaller as a result and has just enough structure to solve reachability
in a space-efficient manner. It remains to be seen if the structure could be further exploited to
get a smaller auxiliary-like digraph in which reachability can be solved.
    It is known that reachability in planar digraph s can be reduced to reachability in grid
digraph s in logarithmic space [1]. However, such a reduction results in at least a quadratic

                      T HEORY OF C OMPUTING, Volume 19 (2), 2023, pp. 1–23                         20
             O N S OLVING R EACHABILITY IN G RID D IGRAPHS U SING A P SEUDOSEPARATOR

blow-up in the size of the digraph . In principle, it would seem that an improvement to the state
of the art for the planar digraph can be obtained by improving the result for grid digraph s.
However, we feel that this would be a difficult direction to go. Note that we solve an β„Ž-vertex
auxiliary digraph in 𝑂(β„Ž 1/2+𝛽/2 ) space as a subroutine for our griddigraph algorithm. A planar
digraph with its embedding can be thought of as an auxiliary digraph , and hence our algorithm
contains within itself a solution to the planar digraph as well. For this reason, we feel that
directly solving a planar digraph would be easier than going down the grid digraph routine.
A significantly different approach would be required to directly design an algorithm for grid
digraph , one which does not use a solution for the class of planar digraph s, or its superclass, as
a subroutine.


References
 [1] Eric Allender, David A. Mix Barrington, Tanmoy Chakraborty, Samir Datta, and Sambud-
     dha Roy: Planar and grid graph reachability problems. Theory Computing Sys., 45(4):675–723,
     2009. [doi:10.1007/s00224-009-9172-z] 2, 20

 [2] Eric Allender and Meena Mahajan: The complexity of planarity testing. Inform. Comput.,
     189(1):117–134, 2004. Preliminary version in STACS’00. [doi:10.1016/j.ic.2003.09.002] 4

 [3] Tetsuo Asano and Benjamin Doerr: Memory-constrained algorithms for shortest path
     problem. In Proc. 23rd Canad. Conf. Comput. Geom. (CCCG’11), pp. 1–4, 2011. cccg.ca. 3
                                                                                        √
 [4] Tetsuo Asano, David Kirkpatrick, Kotaro Nakagawa, and Osamu Watanabe: 𝑂(         ˜ 𝑛)-space
     and polynomial-time algorithm for planar directed graph reachability. In Proc. Internat.
     Symp. Math. Foundations of Comp. Sci. (MFCS’14), pp. 45–56. Springer, 2014. [doi:10.1007/978-
     3-662-44465-8_5, ECCC:TR14-071] 2, 3, 20

 [5] Ryo Ashida and Kotaro Nakagawa: 𝑂(𝑛    ˜ 1/3 )-space algorithm for the grid graph reachability
     problem. In Proc. 34th Internat. Symp. Comput. Geom. (SoCG’18), pp. 5:1–13. Schloss Dagstuhl–
     Leibniz-Zentrum fuer Informatik, 2018. [doi:10.4230/LIPIcs.SoCG.2018.5, arXiv:1803.07097]
     3

 [6] Greg Barnes, Jonathan F. Buss, Walter L. Ruzzo, and Baruch Schieber: A sublinear space,
     polynomial time algorithm for directed s-t connectivity. SIAM J. Comput., 27(5):1273–1282,
     1998. Preliminary version in SCT’92. [doi:10.1137/S0097539793283151] 2

 [7] Diptarka Chakraborty, Aduri Pavan, Raghunath Tewari, N. V. Vinodchandran, and
     Lin F. Yang: New time-space upperbounds for directed reachability in high-genus
     and 𝐻-minor-free graphs. In Proc. 34th Found. Softw. Techn. Theoret. Comp. Sci. Conf.
     (FSTTCS’14), pp. 585–595. Schloss Dagstuhl–Leibniz-Zentrum fuer Informatik, 2014.
     [doi:10.4230/LIPIcs.FSTTCS.2014.585, ECCC:TR14-035] 2

 [8] Diptarka Chakraborty and Raghunath Tewari: An 𝑂(𝑛 πœ– ) space and polynomial time
     algorithm for reachability in directed layered planar graphs. ACM Trans. Comput. Theory,

                     T HEORY OF C OMPUTING, Volume 19 (2), 2023, pp. 1–23                        21
                              R AHUL JAIN AND R AGHUNATH T EWARI

     9(4):19:1–11, 2017. Preliminary version in ISAAC’15. [doi:10.1145/3154857, arXiv:1501.05828,
     ECCC:TR15-016] 2

 [9] Tatsuya Imai, Kotaro Nakagawa, Aduri Pavan, N. V. Vinodchandran, and Osamu Watanabe:
     An 𝑂(𝑛 2 +πœ– )-space and polynomial-time algorithm for directed planar reachability. In
              1


     Proc. 28th IEEE Conf. on Comput. Complexity (CCC’13), pp. 277–286. IEEE Comp. Soc., 2013.
     [doi:10.1109/CCC.2013.35] 2, 3, 8, 11

[10] Rahul Jain and Raghunath Tewari: An 𝑂(𝑛 1/4+πœ– ) space and polynomial algorithm
     for grid graph reachability. In Proc. 39th Found. Softw. Techn. Theoret. Comp. Sci. Conf.
     (FSTTCS’19), pp. 19:1–14. Schloss Dagstuhl–Leibniz-Zentrum fuer Informatik, 2019.
     [doi:10.4230/LIPIcs.FSTTCS.2019.19] 1

[11] Sampath Kannan, Sanjeev Khanna, and Sudeepa Roy:            STCON in directed
     unique-path graphs. In Proc. 28th Found. Softw. Techn. Theoret. Comp. Sci. Conf.
     (FSTTCS’08), pp. 256–267. Schloss Dagstuhl–Leibniz-Zentrum fuer Informatik, 2008.
     [doi:10.4230/LIPIcs.FSTTCS.2008.1758] 2

[12] Gary L. Miller: Finding small simple cycle separators for 2-connected planar graphs. J.
     Comput. System Sci., 32(3):265–279, 1986. Preliminary version in STOC’84. [doi:10.1016/0022-
     0000(86)90030-9] 13

[13] Omer Reingold: Undirected connectivity in log-space. J. ACM, 55(4):17:1–24, 2008. Prelimi-
     nary version in STOC’05. [doi:10.1145/1391289.1391291] 2, 4

[14] Walter J. Savitch: Relationships between nondeterministic and deterministic tape com-
     plexities. J. Comput. System Sci., 4(2):177–192, 1970. [doi:10.1016/S0022-0000(70)80006-X]
     2

[15] Derrick Stolee and N. V. Vinodchandran: Space-efficient algorithms for reachability in
     surface-embedded graphs. In Proc. 27th IEEE Conf. on Comput. Complexity (CCC’12), pp.
     326–333. IEEE Comp. Soc., 2012. [doi:10.1109/CCC.2012.15, ECCC:TR10-154] 2

[16] Avi Wigderson: The complexity of graph connectivity. In Proc. Internat. Symp. Math.
     Foundations of Comp. Sci. (MFCS’92), pp. 112–132. Springer, 1992. [doi:10.1007/3-540-55808-
     X_10] 2




                     T HEORY OF C OMPUTING, Volume 19 (2), 2023, pp. 1–23                     22
          O N S OLVING R EACHABILITY IN G RID D IGRAPHS U SING A P SEUDOSEPARATOR

AUTHORS

    Rahul Jain
    Research associate
    Department of Theoretical Computer Science
    FernuniversitΓ€t in Hagen
    Germany
    rahul jain fernuni-hagen de
    https://www.fernuni-hagen.de/ti/en/team/rahul.jain


    Raghunath Tewari
    Associate professor
    Department of Computer Science and Engineering
    Indian Institute of Technology Kanpur
    rtewari cse iit ac in
    https://www.cse.iitk.ac.in/users/rtewari


ABOUT THE AUTHORS

    Rahul Jain is a postdoctoral research associate at FernuniversitΓ€t in Hagen, Germany.
      He obtained his doctorate at the Indian Institute of Technology Kanpur, India in
      2020 under Dr. Raghunath Tewari.


    Raghunath Tewari is an Associate Professor in the Computer Science and Engi-
      neering Department at the Indian Institute of Technology Kanpur. He obtained
      his undergraduate degree in mathematics and computer science from Chennai
      Mathematical Institute in 2005. Thereafter he did his Masters in 2007 and Ph. D. in
      2011 in computational complexity theory at the University of Nebraska – Lincoln
      under Dr. N. V. Vinodchandran. He is interested in computational complexity
      theory, algorithms and graph theory.




                   T HEORY OF C OMPUTING, Volume 19 (2), 2023, pp. 1–23                     23