We study the classical NodeDisjoint Paths (NDP) problem: given an undirected vertex graph , together with a set of pairs of its vertices, called sourcedestination, or demand pairs, find a maximumcardinality set of mutually nodedisjoint paths that connect the demand pairs. The best current approximation for the problem is achieved by a simple greedy approximation algorithm. Until recently, the best negative result was an hardness of approximation, for any fixed , under standard complexity assumptions. A special case of the problem, where the underlying graph is a grid, has been studied extensively. The best current approximation algorithm for this special case achieves an approximation factor. On the negative side, a recent result by the authors shows that NDP is hard to approximate to within factor , even if the underlying graph is a subgraph of a grid, and all source vertices lie on the grid boundary. In a very recent followup work, the authors further show that NDP in grid graphs is hard to approximate to within factor for any constant under standard complexity assumptions, and to within factor under randomized ETH.
In this paper we study the NDP problem in grid graphs, where all source vertices appear on the grid boundary. Our main result is an efficient randomized approximation algorithm for this problem. Our result in a sense complements the hardness of approximation for subgraphs of grids with sources lying on the grid boundary, and should be contrasted with the abovementioned almost polynomial hardness of approximation of NDP in grid graphs (where the sources and the destinations may lie anywhere in the grid). Much of the work on approximation algorithms for NDP relies on the multicommodity flow relaxation of the problem, which is known to have an integrality gap, even in grid graphs, with all source and destination vertices lying on the grid boundary. Our work departs from this paradigm, and uses a (completely different) linear program only to select the pairs to be routed, while the routing itself is computed by other methods. We generalize this result to instances where the source vertices lie within a prescribed distance from the grid boundary.
1 Introduction
We study the classical NodeDisjoint Paths (NDP) problem, where the input consists of an undirected vertex graph and a collection of pairs of its vertices, called sourcedestination or demand pairs. We say that a path routes a demand pair iff the endpoints of are and . The goal is to compute a maximumcardinality set of nodedisjoint paths, where each path routes a distinct demand pair in . We denote by NDPPlanar the special case of the problem when the underlying graph is planar, and by NDPGrid the special case where is a square grid^{1}^{1}1We use the standard convention of denoting , and so the grid has dimensions ; we assume that is an integer.. We refer to the vertices in set as source vertices; to the vertices in set as destination vertices, and to the vertices in set as terminals.
NDP is a fundamental graph routing problem that has been studied extensively in both graph theory and theoretical computer science communities. Robertson and Seymour [RS90, RS95] explored the problem in their Graph Minor series, providing an efficient algorithm for NDP when the number of the demand pairs is bounded by a constant. But when is a part of input, the problem becomes NPhard [Kar75, EIS76], even in planar graphs [Lyn75], and even in grid graphs [KvL84]. The best current approximation factor of for NDP is achieved by a simple greedy algorithm [KS04]. Until recently, this was also the best approximation algorithm for NDPPlanar and NDPGrid. A natural way to design approximation algorithms for NDP is via the multicommodity flow relaxation: instead of connecting each routed demand pair with a path, send maximum possible amount of (possibly fractional) flow between them. The optimal solution to this relaxation can be computed via a standard linear program. The approximation algorithm of [KS04] can be cast as an LProunding algorithm of this relaxation. Unfortunately, it is wellknown that the integrality gap of this relaxation is , even when the underlying graph is a grid, with all terminals lying on its boundary. In a recent work, Chuzhoy and Kim [CK15] designed an approximation for NDPGrid, thus bypassing this integrality gap barrier. Their main observation is that, if all terminals lie close to the grid boundary (say within distance ), then a simple dynamic programmingbased algorithm yields an approximation. On the other hand, if, for every demand pair, either the source or the destination lies at a distance at least from the grid boundary, then the integrality gap of the multicommodity flow relaxation improves, and one can obtain an approximation via LProunding. A natural question is whether the integrality gap improves even further, if all terminals lie further away from the grid boundary. Unfortunately, the authors show in [CK15] that the integrality gap remains at least , even if all terminals lie within distance from the grid boundary. The approximation algorithm for NDPGrid was later extended and generalized to an approximation algorithm for NDPPlanar [CKL16].
On the negative side, until recently, only an hardness of approximation was known for the general version of NDP, for any constant , unless [AZ06, ACG10], and only APXhardness was known for NDPPlanar and NDPGrid [CK15]. In a recent work [CKN17], the authors have shown that NDP is hard to approximate to within a factor unless , even if the underlying graph is a planar graph with maximum vertex degree at most , and all source vertices lie on the boundary of a single face. The result holds even when the input graph is a vertexinduced subgraph of a grid, with all sources lying on the grid boundary. In a very recent work [CKN18], the authors show that NDPGrid is hard to approximate for any constant assuming , and moreover, assuming randomized ETH, the hardness of approximation factor becomes . We note that the instances constructed in these latter hardness proofs require all terminals to lie far from the grid boundary.
In this paper we explore NDPGrid. This important special case of NDP was initially motivated by applications in VLSI design, and has received a lot of attention since the 1960’s. We focus on a restricted version of NDPGrid, that we call Restricted NDPGrid: here, in addition to the graph being a square grid, we also require that all source vertices lie on the grid boundary. We do not make any assumptions about the locations of the destination vertices, that may appear anywhere in the grid. The best current approximation algorithm for Restricted NDPGrid is the same as that for the general NDPGrid, and achieves a approximation [CK15]. Our main result is summarized in the following theorem.
Theorem
There is an efficient randomized approximation algorithm for Restricted NDPGrid.
This result in a sense complements the hardness of approximation of NDP on subgraphs of grids with all sources lying on the grid boundary of [CKN17]^{2}^{2}2Note that the two results are not strictly complementary: our algorithm only applies to grid graphs, while the hardness result is only valid for subgraphs of grids., and should be contrasted with the recent almost polynomial hardness of approximation of [CKN18] for NDPGrid mentioned above. Our algorithm departs from previous work on NDP in that it does not use the multicommodity flow relaxation. Instead, we define sufficient conditions that allow us to route a subset of demand pairs via disjoint paths, and show that there exists a subset of demand pairs satisfying these conditions, whose cardinality is at least , where is the value of the optimal solution. It is then enough to compute a maximumcardinality subset of the demand pairs satisfying these conditions. We write an LPrelaxation for this problem and design a approximation LProunding algorithm for it. We emphasize that the linear program is only used to select the demand pairs to be routed, and not to compute the routing itself.
We then generalize the result to instances where the source vertices lie within a prescribed distance from the grid boundary.
Theorem
For every integer , there is an efficient randomized approximation algorithm for the special case of NDPGrid where all source vertices lie within distance at most from the grid boundary.
We note that for instances of NDPGrid where both the sources and the destinations are within distance at most from the grid boundary, it is easy to obtain an efficient approximation algorithm (see, e.g. [CK15]).
A problem closely related to NDP is the EdgeDisjoint Paths (EDP) problem. It is defined similarly, except that now the paths chosen to route the demand pairs may share vertices, and are only required to be edgedisjoint. The approximability status of EDP is very similar to that of NDP: there is an approximation algorithm [CKS06], and an hardness of approximation for any constant , unless [AZ06, ACG10]. As in the NDP problem, we can use the standard multicommodity flow LPrelaxation of the problem, in order to obtain the approximation algorithm, and the integrality gap of the LPrelaxation is even in planar graphs. Recently, Fleszar et al. [FMS16] designed an approximation algorithm for EDP, where is the feedback vertex set number of the input graph — the smallest number of vertices that need to be deleted from in order to turn it into a forest.
Several special cases of EDP have better approximation algorithms: an approximation is known for evendegree planar graphs [CKS05, CKS04, Kle05], and an approximation is known for nearlyEulerian uniformly highdiameter planar graphs, and nearlyEulerian densely embedded graphs, including grid graphs [AR95, KT98, KT95]. Furthermore, an approximation algorithm is known for EDP on 4edgeconnected planar, and Eulerian planar graphs [KK13]. It appears that the restriction of the graph to be Eulerian, or nearEulerian, makes the EDP problem on planar graphs significantly simpler, and in particular improves the integrality gap of the standard multicommodity flow LPrelaxation.
The analogue of the grid graph for the EDP problem is the wall graph (see Figure 1): the integrality gap of the multicommodity flow relaxation for EDP on wall graphs is . The approximation algorithm of [CK15] for NDPGrid extends to EDP on wall graphs, and the hardness of approximation of [CKN17] for NDPPlanar also extends to EDP on subgraphs of walls, with all sources lying on the top boundary of the wall. The recent hardness result of [CKN18] for NDPGrid also extends to an hardness of EDP on wall graphs, assuming , and to hardness assuming randomized ETH. We extend our results to EDP and NDP on wall graphs:
Theorem
There is an efficient randomized approximation algorithm for EDP and for NDP on wall graphs, when all source vertices lie on the wall boundary.
Other related work.
Cutler and Shiloach [CS78] studied an even more restricted version of NDPGrid, where all source vertices lie on the top row of the grid, and all destination vertices lie on a single row of the grid, far enough from its top and bottom boundaries. They considered three different settings of this special case. In the packedpacked setting, all sources appear consecutively on , and all destinations appear consecutively on (but both sets may appear in an arbitrary order). They show a necessary and a sufficient condition for all demand pairs to be routable via nodedisjoint paths in this setting. The second setting is the packedspaced setting. Here, the sources again appear consecutively on , but all destinations are at a distance at least from each other. For this setting, the authors show that if , then all demand pairs can be routed. We note that [CK15] extended their algorithm to a more general setting, where the destination vertices may appear anywhere in the grid, as long as the distance between any pair of the destination vertices, and any destination vertex and the boundary of the grid, is at least . Robertson and Seymour [RS88] provided sufficient conditions for the existence of nodedisjoint routing of a given set of demand pairs in the more general setting of graphs drawn on surfaces, and they designed an algorithm whose running time is for finding the routing, where is at least exponential in . Their result implies the existence of the routing in grids, when the destination vertices are sufficiently far from each other and from the grid boundaries, but it does not provide an efficient algorithm to compute such a routing. The third setting studied by Cutler and Shiloach is the spacedspaced setting, where the distances between every pair of source vertices, and every pair of destination vertices are at least . The authors note that they could not come up with a better algorithm for this setting, than the one provided for the packedspaced case. Aggarwal, Kleinberg, and Williamson [AKW00] considered a special case of NDPGrid, where the set of the demand pairs is a permutation: that is, every vertex of the grid participates in exactly one demand pair. They show that demand pairs are routable in this case via nodedisjoint paths. They further show that if all terminals are at a distance at least from each other, then at least pairs are routable.
A variation of the NPD and EDP problems, where small congestion is allowed, has been a subject of extensive study, starting with the classical paper of Raghavan and Thompson [RT87] that introduced the randomized rounding technique. We say that a set of paths causes congestion , if at most paths share the same vertex or the same edge, for the NDP and the EDP settings respectively. A recent line of work [CKS05, Räc02, And10, RZ10, Chu16, CL16, CE13, CC] has lead to an approximation for both NDP and EDP problems with congestion . For planar graphs, a constantfactor approximation with congestion 2 is known [SCS11].
Organization.
We start with a highlevel intuitive overview of our algorithm in Section 2. We then provide Preliminaries in Section 3 and the algorithm for Restricted NDPGrid in Section 4, with parts of the proof being deferred to Sections 5–9. We extend our algorithm to EDP and NDP on wall graphs in Section 10. We generalize our algorithm to the setting where the sources are within some prescribed distance from the grid boundary in Section 11.
2 HighLevel Overview of the Algorithm
The goal of this section is to provide an informal highlevel overview of the main result of the paper – the proof of Theorem 1. With this goal in mind, the values of various parameters are given imprecisely in this section, in a way that best conveys the intuition. The following sections contain a formal description of the algorithm and the precise settings of all parameters.
We first consider an even more restricted special case of NDPGrid, where all source vertices appear on the top boundary of the grid, and all destination vertices appear far enough from the grid boundary, and design an efficient randomized approximation algorithm for this problem. We later show how to reduce Restricted NDPGrid to this special case of the problem; we focus on the description of the algorithm for now.
We assume that our input graph is the grid, and we denote by the number of its vertices. We further assume that the set of the demand pairs is , with the vertices in set called source vertices; the vertices in set called destination vertices; and the vertices in called terminals. Let denote the value of the optimal solution to the NDP instance . We assume that the vertices of lie on the top boundary of the grid, that we denote by , and the vertices of lie sufficiently far from the grid boundary – say, at a distance at least from it. For a subset of the demand pairs, we denote by and the sets of the source and the destination vertices of the demand pairs in , respectively. As our starting point, we consider a simple observation of Chuzhoy and Kim [CK15], that generalizes the results of Cutler and Shiloach [CS78]. Suppose we are given an instance of NDPGrid with demand pairs, where the sources lie on the top boundary of the grid, and the destination vertices may appear anywhere in the grid, but the distance between every pair of the destination vertices, and every destination vertex and the boundary of the grid, is at least – we call such instances spacedout instances. In this case, all demand pairs in can be efficiently routed via nodedisjoint paths, as follows. Consider, for every destination vertex , a square subgrid of , of size , such that lies roughly at the center of . We construct a set of nodedisjoint paths, that originate at the vertices of , and traverse the subgrids onebyone in a snakelike fashion (see a schematic view on Figure 2(a)). We call this part of the routing global routing. The local routing needs to specify how the paths in traverse each box . This is done in a straightforward manner, while ensuring that the unique path originating at vertex visits the vertex (see Figure 2(b)). By suitably truncating the final set of paths, we obtain a routing of all demand pairs in via nodedisjoint paths.
Unfortunately, in our input instance , the destination vertices may not be located sufficiently far from each other. We can try to select a large subset of the demand pairs, so that every pair of destination vertices in appear at a distance at least from each other; but in some cases the largest such set may only contain demand pairs (for example, suppose all destination vertices lie consecutively on a single row of the grid). One of our main ideas is to generalize this simple algorithm to a number of recursive levels.
For simplicity, let us first describe the algorithm with just two recursive levels. Suppose we partition the top row of the grid into disjoint intervals, . Let be a set of demand pairs that we would like to route. Denote , and assume that we are given a collection of square subgrids of , of size each (that we call squares), such that every pair of distinct squares is at a distance at least from each other. Assume further that each such subgrid is assigned a color , such that, if is assigned the color , then all demand pairs whose destination lies in have their source (so intuitively, each color represents an interval ). Let be the set of all demand pairs with . We would like to ensure that is roughly , and that all destination vertices of are at a distance at least from each other. We claim that if we could find the collection of the intervals of the first row, a collection of subgrids of , a coloring , and a subset of the demand pairs with these properties, then we would be able to route all demand pairs in .
In order to do so, for each square , we construct an augmented square , by adding a margin of rows and columns around . Our goal is to construct a collection of nodedisjoint paths routing the demand pairs in . We start by constructing a global routing, where all paths in originate from the vertices of and then visit the squares in in a snakelike fashion, just like we did for the spacedout instances described above (see Figure 2(a)). Consider now some square and the corresponding augmented square . Assume that , and let be the set of paths originating at the source vertices that lie in . While traversing the square , we ensure that only the paths in enter the square ; the remaining paths use the margins on the left and on the right of in order to traverse . This can be done because the sources of the paths in appear consecutively on , relatively to the sources of all paths in . In order to complete the local routing inside the square , observe that the destination vertices appear far enough from each other, and so we can employ the simple algorithm for spacedout instances inside .
In order to optimize the approximation factor that we achieve, we extend this approach to recursive levels. Let . We define auxiliary parameters . Roughly speaking, we can think of as being a constant (say ), of as being comparable to , and for all , . The setup for the algorithm consists of three ingredients: (i) a hierarchical decomposition of the grid into square subgrids (that we refer to as squares); (ii) a hierarchical partition of the first row of the grid into intervals; and (iii) a hierarchical coloring of the squares in with colors that correspond to the intervals of , together with a selection of a subset of the demand pairs to route. We define sufficient conditions on the hierarchical system of squares, the hierarchical partition of into intervals, the coloring and the subset of the demand pairs, under which a routing of all pairs in exists and can be found efficiently. For a fixed hierarchical system of squares, a triple satisfying these conditions is called a good ensemble. We show that a good ensemble with a large enough set of demand pairs exists, and then design an approximation algorithm for computing a good ensemble maximizing . We now describe each of these ingredients in turn.
2.1 A Hierarchical System of Squares
A hierarchical system of squares consists of a sequence of sets of subgrids of . For each , is a collection of disjoint subgrids of (that we refer to as level squares); every such square has size , and every pair of distinct squares are within distance at least from each other (see Figure 3). We require that for each , for every square , there is a unique square (called the parentsquare of ) that contains . We say that a demand pair belongs to the hierarchical system of squares iff . We show a simple efficient algorithm to construct such hierarchical systems of squares, so that every demand pair belongs to at least one of them. Each such system of squares induces an instance of NDP— the instance is defined over the same graph , and the set of demand pairs that belong to the system . It is then enough to obtain a factor approximation algorithm for each resulting instance separately. From now on we fix one such hierarchical system of squares, together with the set of demand pairs, containing all pairs that belong to , and focus on designing an approximation algorithm for instance .
2.2 A Hierarchical Partition of the Top Grid Boundary
Recall that denotes the first row of the grid. A hierarchical partition of is a sequence of sets of subpaths of , such that for each , the paths in (that we refer to as level intervals) partition the vertices of . We also require that for all , every level interval is contained in a unique level interval , that we refer to as the parentinterval of . For every level , we define a collection of colors, containing one color for each level interval . If is a parentinterval of , then we say that color is a parentcolor of .
2.3 Coloring the Squares and Selecting Demand Pairs to Route
The third ingredient of our algorithm is an assignment of colors to the squares, and a selection of a subset of the demand pairs to be routed. For every level , for every level square , we would like to assign a single level color to , denoting . Intuitively, if color is assigned to , then the only demand pairs with that we may route are those whose source vertex lies on the level interval . We require that the coloring is consistent across levels: that is, for all , if a level square is assigned a level color , and its parentsquare is assigned a level color , then must be a parentcolor of . We call such a coloring a valid coloring of with respect to .
Finally, we would like to select a subset of the demand pairs to route. Consider some demand pair and some level . Let be the level interval to which belongs. Then we say that has the level color . Therefore, for each level , vertex is assigned the unique level color , and for , is the parentcolor of . Let be the level square to which belongs. We may only add to if the level color of is (that is, it is the same as the level color of ). Notice that in particular, this means that for every level , if is the level square containing , and it is assigned the color , then is assigned the same level color, and so . Finally, we require that for all , for every level color , the total number of all demand pairs , such that the level color of is , is no more than (if , then the number is no more than ). If has all these properties, then we say that it respects the coloring . We say that is a good ensemble iff is a hierarchical partition of into intervals; is a valid coloring of the squares in with respect to ; and is a subset of the demand pairs that respects the coloring . The size of the ensemble is .
2.4 The Routing
We show that, if we are given a good ensemble , then we can route all demand pairs in . The routing itself follows the highlevel idea outlined above. We gradually construct a collection of nodedisjoint paths routing the demand pairs in . At the highest level, all these paths depart from their sources and then visit the level squares onebyone, in a snakelike fashion, as in Figure 2(a). Consider now some level square , and assume that its level color is , where is some level1 interval of . Then only the paths that originate at the vertices of will enter the square ; the remaining paths will exploit the spacing between the level squares in order to bypass it; the spacing between the level squares is sufficient to allow this. Once we have defined this global routing, we need to specify how the routing is carried out inside each square. We employ the same procedure recursively. Consider some level square , and let be the set of all paths that visit . Assume further that the level color of is . Since we are only allowed to have at most demand pairs in whose level1 color is , . Let be the set of all level squares contained in . The paths in will visit the squares of onebyone in a snakelike fashion (but this part of the routing is performed inside ). As before, for every level2 square , if the level color of is , then only those paths of that originate at the vertices of will enter ; the remaining paths will use the spacing between the level squares to bypass . Since , and all level squares are at distance at least from each other, there is a sufficient spacing to allow this routing. We continue this process recursively, until, at the last level of the recursion, we route at most one path per color, to its destination vertex.
In order to complete the proof of the theorem, we need to show that there exists a good ensemble of size , and that we can find such an ensemble efficiently.
2.5 The Existence of the Ensemble
The key notion that we use in order to show that a large good ensemble exists is that of a shadow property. Suppose is some subgrid of , and let be some subset of the demand pairs. Among all demand pairs with , let be the one with appearing earliest on the first row of , and let be the one with appearing latest on . The shadow of with respect to is the subpath of between and . Let be the number of all demand pairs with lying in the shadow of (that is, lies between and on ). We say that has the shadow property with respect to iff . We say that has the shadow property with respect to the hierarchical system of squares, iff has the shadow property with respect to every square in . Let be the optimal solution to the instance of NDP, where only includes the demand pairs that belong to . Let be the set of the demand pairs routed by . For every demand pair , let be the path routing this demand pair. Intuitively, it feels like should have the shadow property. Indeed, let be some square of size , and let be defined for as before, so that the shadow of with respect to is the subpath of between and . Let be any path of length at most connecting to in , and let be the closed curve consisting of the union of , , , and the shadow of . Consider the disc whose boundary is . The intuition is that, if is a demand pair whose source lies in the shadow of , and destination lies outside of , then must cross the path , as it needs to escape the disc . Since path is relatively short, only a small number of such demand pairs may exist. The main difficulty with this argument is that we may have a large number of demand pairs , whose source lies in the shadow of , and the destination lies in the disc . Intuitively, this can only happen if and “capture” a large area of the grid. We show that, in a sense, this cannot happen too often, and that there is a subset of at least demand pairs, such that has the shadow property with respect to .
Finally, we show that there exists a good ensemble with . We construct the ensemble over the course of iterations, starting with . In the th iteration we construct the set of the level intervals of , assign level colors to all level squares of , and discard some demand pairs from . Recall that . In the first iteration, we let be a partition of the row into intervals, each of which contains roughly vertices of . Assume that these intervals are , and that they appear in this lefttoright order on . We call all intervals where is odd interesting intervals, and the remaining intervals uninteresting intervals. We discard from all demand pairs , where lies on an uninteresting interval. Consider now some level square , and let be the set of all demand pairs whose destinations lie in . Since the original set of demand pairs had the shadow property with respect to , it is easy to verify that all source vertices of the demand pairs in must belong to a single interesting interval of . Let be that interval. Then we color the square with the level color corresponding to the interval . This completes the first iteration. Notice that for each level1 color , at most demand pairs have . In the following iteration, we similarly partition every interesting level interval into level intervals that contain roughly source vertices of each, and then define a coloring of all level squares similarly, while suitably updating the set of the demand pairs. We continue this process for iterations, eventually obtaining a good ensemble . Since we only discard a constant fraction of the demand pairs of in every iteration, at the end, .
2.6 Finding the Good Ensemble
In our final step, our goal is to find a good ensemble maximizing . We show an efficient randomized approximation algorithm for this problem. First, we show that, at the cost of losing a small factor in the approximation ratio, we can restrict our attention to a small collection of hierarchical partitions of into intervals, and that it is enough to obtain a approximate solution for the problem of finding the largest ensemble for each such partition separately.
We then fix one such hierarchical partition , and design an LPrelaxation for the problem of computing a coloring of and a collection of demand pairs, such that is a good ensemble, while maximizing . Finally, we design an efficient randomized LProunding approximation algorithm for the problem.
2.7 Completing the Proof of Theorem 1
So far we have assumed that all source vertices lie on the top boundary of the grid, and all destination vertices are at a distance at least from the grid boundary. Let be the randomized efficient approximation algorithm for this special case. We now extend it to the general Restricted NDPGrid problem. For every destination vertex , we identify the closest vertex that lies on the grid boundary. Using standard grouping techniques, and at the cost of losing an additional factor in the approximation ratio, we can assume that all source vertices lie on the top boundary of the grid, all vertices in lie on a single boundary edge of the grid (assume for simplicity that it is the bottom boundary), and that there is some integer , such that for every destination vertex , . We show that we can define a collection of disjoint square subgrids of , and a collection of disjoint subintervals of , such that the bottom boundary of each subgrid is contained in the bottom boundary of , the top boundary of is within distance at least from , appear in this lefttoright order in , and appear in this lefttoright order on . For each , we let denote the set of all demand pairs with the sources lying on and the destinations lying in . For each , we then obtain a new instance of the NDP problem. We show that there exist a collection of squares and a collection of intervals, such that the value of the optimal solution to each instance , that we denote by , is at most , while . Moreover, it is not hard to show that, if we can compute, for each , a routing of some subset of demand pairs in , then we can also route all demand pairs in simultaneously in .
There are two problems with this approach. First, we do not know the set of subgrids of and the set of intervals of . Second, it is not clear how to solve each resulting problem . To address the latter problem, we define a simple mapping of all source vertices in to the top boundary of grid , obtaining an instance of Restricted NDPGrid, where all source vertices lie on the top boundary of the grid , and all destination vertices lie at a distance at least from its boundary. We can then use algorithm in order to solve this problem efficiently. It is easy to see that, if we can route some subset of the demand pairs via nodedisjoint paths in , then we can extend this routing to the corresponding set of original demand pairs, whose sources lie on .
Finally, we employ dynamic programming in order to find the set of subgrids of and the set of intervals of . For each such potential subgrid and interval , we use algorithm in order to find a routing of a large set of demand pairs of the corresponding instance defined inside , and then exploit the resulting solution values for each such pair in a simple dynamic program, that allows us to compute the set of subgrids of , the set of intervals of , and the final routing.
3 Preliminaries
All logarithms in this paper are to the base of .
For a pair of integers, we let denote the grid of height and length . The set of its vertices is , and the set of its edges is the union of two subsets: the set of horizontal edges and the set of vertical edges. The subgraph of induced by the edges of consists of paths, that we call the rows of the grid; for , the th row is the row containing the vertex . Similarly, the subgraph induced by the edges of consists of paths that we call the columns of the grid, and for , the th column is the column containing . We think of the rows as ordered from top to bottom and the columns as ordered from left to right. Given two vertices and of the grid, the shortestpath distance between them in is denoted by . Given two vertex subsets , the distance between them is . Given a vertex of the grid, we denote by and the row and the column, respectively, that contain . The boundary of the grid is . We sometimes refer to and as the top and the bottom boundaries of the grid respectively, and to and as the left and the right boundaries of the grid. We say that is a square grid iff .
Given a set of consecutive rows of a grid and a set of consecutive columns of , we let be the subgraph of induced by the set of vertices. We say that is the subgrid of spanned by the set of rows and the set of columns. A subgraph is called a subgrid of iff there is a set of consecutive rows and a set of consecutive columns of , such that . If additionally for some integer , then we say that is a square of size .
In the NDPGrid problem, the input is a grid and a set of pairs of its vertices, called demand pairs. We refer to the vertices in set as source vertices, to the vertices in set as destination vertices, and to the vertices of as terminals. The solution to the problem is a set of nodedisjoint paths in , where each path connects some demand pair in . The goal is to maximize the number of the demand pairs routed, that is, . In this paper we consider a special case of NDPGrid, that we call Restricted NDPGrid, where all source vertices appear on the boundary of the grid. We denote by the number of vertices in the input graph .
Given a subset of the demand pairs, we denote by and the sets of all source and all destination vertices participating in the pairs in , respectively.
4 The Algorithm
Throughout, we assume that we know the value of the optimal solution; in order to do so, we simply guess the value (that is, we go over all such possible values), and run our approximation algorithm for each such guessed value. It is enough to show that the algorithm returns a factorapproximate solution whenever the value has been guessed correctly. We use a parameter . We first further restrict the problem and consider a special case where the destination vertices appear far from the grid boundary. We show an efficient randomized algorithm for approximately solving this special case of the problem, by proving the following theorem, which is one of our main technical contributions.
Theorem
There is an efficient randomized algorithm , that, given an instance of Restricted NDPGrid and an integer , such that the value of the optimal solution to is at least , and every destination vertex lies at a distance at least from , returns a solution that routes at least demand pairs, with high probability.
In Section 9 we complete the proof of Theorem 1 using algorithm from Theorem 4 as a subroutine, by reducing the given instance of Restricted NDPGrid to a number of instances of the form required by Theorem 4, and then applying algorithm to each of them. In this section, we focus on the proof of Theorem 4.
Recall that our input grid has dimensions . Throughout, for an integer , we denote . Notice that by losing a factor in the approximation guarantee, we can assume w.l.o.g. that all sources lie on the top row of , and that .
Parameters.
The following parameters are used throughout the algorithm. Let be a large constant, whose value will be set later. Recall that . Let be the largest integer, for which . Intuitively, we will route no more than demand pairs, and it is helpful that this number is significantly smaller than . The parameter will be used as the number of recursive levels in the hierarchical system of squares, and in the algorithm overall. Clearly, , and . In particular, , where is the size of the side of the grid .
It would be convenient for us if we could assume that is an integral multiple of . Since this is not true in general, below we define a subgrid of of dimensions , where is a large enough integral multiple of . We show that can be defined so that, in a sense, we can restrict our attention to the subproblem induced by , without paying much in the approximation factor.
To this end, we let be the largest integral multiple of with , so . Let be the subgrid of spanned by its first columns and all its rows, and let be the subgrid of spanned by its last columns and all its rows. Finally, let and be the subsets of the demand pairs contained in and , respectively. Notice that, since we have assumed that all destination vertices lie at a distance at least from , all vertices of are contained in both and . Consider two instances of the NDP problem, both of which are defined on the original graph ; the first one uses the set of the demand pairs, and the second one uses the set of demand pairs. Clearly, one of these instances has a solution of value at least , as for each demand pair , both and must belong to either or to (or both). We assume without loss of generality that the problem induced by the set of demand pairs has solution of value at least . In particular, we assume that all source vertices lie on the first row of , that we denote by from now on. Notice however that we are only guaranteed that a routing of at least demand pairs of exists in the original graph . For convenience, abusing the notation, from now on we will denote by and by .
For each , we let , so that and ; ; and for all . Throughout, we assume that is large enough, so that, for example, .
One of the main concepts that we use is that of a hierarchical decomposition of the grid into squares, that we define next. Recall that is the subgrid of spanned by its first columns and all its rows. We let be the subgrid of , that is spanned by all its columns and its bottommost rows. Notice that since , the top row of , where the source vertices reside, is disjoint from .
4.1 Hierarchical Systems of Squares
A subset of consecutive integers is called an interval. We say that two intervals are disjoint iff , and we say that they are separated iff for every pair of integers , . A collection of intervals of is called canonical, iff for each interval , , and every pair of intervals in is separated.
Consider now the grid . Given two intervals of , we denote by the subgraph of induced by all vertices in . Given two sets of intervals of , we let be the corresponding set of subgraphs of , that is, .
Definition.
Let be any collection of subgraphs of , and let be an integer. We say that is a canonical family of squares iff there are two canonical sets of intervals, such that . In particular, each subgraph in is a square of size , and for every pair of distinct squares, for every pair of vertices, .
We are now ready to define a hierarchical system of squares. We use the integral parameters and defined above, as well as the parameters .
Definition.
A hierarchical system of squares is a sequence of sets of squares, such that:

for all , is a canonical family of squares; and

for all , for every square , there is a square , such that .
Given a hierarchical system , of squares we denote by the set of all vertices lying in the squares of , that is,