Abstract
In this paper, we introduce a directed variant of the classical Bandwidthproblem and study it from the view-point of moderately exponential time algorithms, both exactly and approximately. Motivated by the definitions of the directed variants of the classical Cutwidth and Pathwidth problems, we define Digraph Bandwidth as follows. Given a digraph \(\varvec{D}\) and an ordering \(\varvec{\sigma }\) of its vertices, the digraph bandwidth of \(\varvec{\sigma }\) with respect to \(\varvec{D}\) is equal to the maximum value of \(\varvec{\sigma (v)}-\varvec{\sigma (u)}\) over all arcs \(\varvec{(u,v)}\) of \(\varvec{D}\) going forward along \(\varvec{\sigma }\) (that is, when \(\varvec{\sigma (u)} < \varvec{\sigma (v)}\)). The Digraph Bandwidth problem takes as input a digraph \(\varvec{D}\) and asks to output an ordering with the minimum digraph bandwidth. The undirected Bandwidtheasily reduces to Digraph Bandwidth and thus, it immediately implies that Digraph Bandwidth is NP-hard. While an \(\varvec{\mathcal {O}}^{\star }\varvec{(n!)}\) time algorithm for the problem is trivial, the goal of this paper is to design algorithms for Digraph Bandwidth which have running times of the form \(\varvec{2}^{\varvec{\mathcal {O}(n)}}\). In particular, we obtain the following results. Here, \(\varvec{n}\) and \(\varvec{m}\) denote the number of vertices and arcs of the input digraph \(\varvec{D}\), respectively.
-
Digraph Bandwidth can be solved in \(\varvec{\mathcal {O}}^\star (\varvec{3}^{\varvec{n}} \cdot \varvec{2}^{\varvec{m}})\) time. This result implies a \(\varvec{2}^{\varvec{\mathcal {O}}(\varvec{n})}\) time algorithm on sparse graphs, such as graphs of bounded average degree (planar graphs).
-
Let \(\varvec{G}\) be the underlying undirected graph of the input digraph. If the treewidth of \(\varvec{G}\) is at most \(\varvec{t}\), then Digraph Bandwidth can be solved in time \(\varvec{\mathcal {O}}^\star (\varvec{2}^{\varvec{n} + (\varvec{t}+\varvec{2})\, \varvec{\log }\, \varvec{n}})\). This result implies a \(\varvec{2}^{\varvec{n}+\varvec{\mathcal {O}}(\sqrt{\varvec{n}}\, \varvec{\log }\, \varvec{n})}\) algorithm, for directed planar graphs and, in general, for the class of digraphs whose underlying undirected graph excludes some fixed graph \(\varvec{H}\) as a minor.
-
Digraph Bandwidth can be solved in \(\varvec{\min } \{ \varvec{\mathcal {O}}^{\star }(\varvec{4}^{\varvec{n}} \cdot \varvec{b}^{\varvec{n}}), \varvec{\mathcal {O}}^{\star }(\varvec{4}^{\varvec{n}} \cdot \varvec{2}^{\varvec{b}\, \varvec{\log }\, \varvec{b}\, \varvec{\log }\, \varvec{n}})\}\) time, where \(\varvec{b}\) denotes the optimal digraph bandwidth of \(\varvec{D}\). This allow us to deduce a \(\varvec{2}^{\varvec{\mathcal {O}}(\varvec{n})}\) algorithm in many cases, for example when \(\varvec{b} \le \frac{\varvec{n}}{\varvec{\log }^{\varvec{2}}\,\varvec{n}}\).
-
Finally, we give a (Single) Exponential Time Approximation Scheme for Digraph Bandwidth. In particular, we show that for any fixed real \(\varvec{\epsilon } > \varvec{0}\), we can find an ordering whose digraph bandwidth is at most \((\varvec{1}+\varvec{\epsilon })\) times the optimal digraph bandwidth, in time \(\varvec{\mathcal {O}}^{{\star }}(\varvec{4}^{\varvec{n}} \cdot (\lceil \varvec{4}/{\varvec{\epsilon }} \rceil )^n)\).
Similar content being viewed by others
Avoid common mistakes on your manuscript.
1 Introduction
The Bandwidth problem is a famous combinatorial problem, where given an undirected graph G on n vertices, the goal is to embed its vertices onto an integer line such that the maximum stretch of any edge of G is minimized. More formally, given a graph G on n vertices and an ordering \(\sigma : V(G) \rightarrow [n]\), the bandwidth of \(\sigma \) with respect to G is \(\max _{(u,v) \in E(G)} \{\vert \sigma (u) - \sigma (v) \vert \}\). In the Bandwidth problem, given a graph G, the goal is to find an ordering \(\sigma : V(G) \rightarrow [n]\), which has minimum bandwidth with respect to G. The bandwidth problem has found applications in an array of fields including, but not limited to, the design of faster matrix operations computation on sparse matrices, VLSI circuit design, reducing the search space of constraint satisfaction problems and problems from molecular biology [1]. In many of the real world applications, a fundamental principle that the Bandwidth problem captures is that of delays that occur as a result of allocation of tasks on the time interval that have dependencies among them. An ordering in many scenarios represent the allocation of tasks/objects on a time-line/one-dimensional hardware, and the stretch of an edge captures the delay/effort/expense incurred to reach the other end of the edge.
One restriction on the kind of models captured by Bandwidth is that, the models cannot be tuned to allow for asymmetry or bias. More specifically, what happens when the connections available between the tasks/objects are unidirectional? What happens when there is a bias in terms of delay/expense based on the direction of communication on the time-line/one-dimensional hardware? The above inquisitivities lead to our first contribution to this article, which is the concept of Digraph BandwidthFootnote 1. Given a directed graph D on n vertices and an ordering \(\sigma : V(D) \rightarrow [n]\), the digraph bandwidth of \(\sigma \) with respect to D is the maximum stretch of the forward arcs in the ordering, that is, \(\max _{\begin{array}{c} (u,v) \in E(D) \\ \sigma (u) < \sigma (v) \end{array}} \{\sigma (v) - \sigma (u)\}\). The Digraph Bandwidth problem takes as input a digraph D and outputs an ordering \(\sigma : V(D) \rightarrow [n]\) with the least possible digraph bandwidth with respect to D.
Observe that, with the introduction of directions in the input graph, Digraph Bandwidth allows us to capture one-way dependencies, that can help in modelling scenarios where the links available for modelling the communication are one-directional. Also, by allowing to care only about the stretch of the forward arcs in the ordering, one can model channels where communication in one direction is cheaper/easier than the other. The later scenarios can occur while modelling an uphill-downhill communication, where the cost of going up is a matter of real concern whereas, the cost of going down is almost negligibleFootnote 2.
Note that Digraph Bandwidth is indeed a generalization of the notion of undirected bandwidth, as for any graph G, if \(\overleftrightarrow {G}\) denotes the digraph obtained from G by replacing each edge of G by one arc in both direction, then the bandwidth of G is equal to the directed bandwidth of \(\overleftrightarrow {G}\). We would like to remark here that on the theoretical front, the way we lift the definition of bandwidth in undirected graphs to directed graphs, by considering the stretches of only the forward arcs, is not something unique that we do for Bandwidth. The idea of only considering arcs going in one direction for “optimizing some function” is very common to the directed setting. The simplest such example is the notion of a directed cut. If D is a digraph and X, Y are two disjoint subsets of vertices of D, then the directed cut of X and Y, \(\texttt{dcut}(X,Y)\), is defined as the set of arcs (u, v) in E(D), where \(u\in X\) and \(v\in Y\). Another closely related notion is the notion of Directed Cutwidth introduced by Chudnovsky et al. [2]. A digraph D on n vertices has cutwidth at most k if there exists an ordering of the vertices \(\sigma \) such that for every \(i \in [n-1]\), \(\texttt{dcut}(\{\sigma (1), \dots , \sigma (i) \}, \{\sigma (i+1), \dots , \sigma (n) \})\) is at most k. Note that our notion of directed bandwidth is a stronger notion than cutwidth, as for any ordering \(\sigma \), the cutwidth associated to \(\sigma \) is at most the digraph bandwith of \(\sigma \). There is also a similar notion of Directed Pathwidth [2]. Observe that similar to Directed Cutwidth and Directed Pathwidth, Digraph Bandwidthis 0 on directed acyclic graphs (dags).
We would like to remark that ours is not the first attempt in generalising the definition of bandwidth for digraphs. A notion of bandwidth for directed graphs appeared in 1978 in the paper by Garey et al. [3]. But the notion was defined only for dags. In their problem, which they call Directed Bandwidth (DAG-BW), given a dag D, one is interested in finding a topological ordering (a linear ordering of vertices such that for every directed arc (u, v) from vertex u to vertex v, u comes before v in the ordering) of minimum bandwidth. Note that this is very different from our notion of Digraph Bandwidth which is always 0 for dags.
Algorithmic Perspective
Bandwidth is one of the most well-known and extensively studied graph layout problems [4]. The Bandwidth problem is NP-hard [5] and remains NP-hardeven on very restricted subclasses of trees, like caterpillars of hair length at most 3 [6]. Furthermore, the bandwidth of a graph is NP-hardto approximate within a constant factor for trees [7]. Polynomial-time algorithms for the exact computation of bandwidth are known for a few graph classes including caterpillars with hair length at most 2 [8], cographs [9], interval graphs [10] and bipartite permutation graphs [11]. A classical algorithm by Saxe [12] solves Bandwidth in time \(2^{\mathcal {O}(k)}n^{k+1}\), which is polynomial when k is a constant. In the realm of parameterized complexity, Bandwidth is known to be W[t]-hard for all \(t\ge 1\), when parameterized by the bandwidth k of the input graph [13]. However, on trees it admits a parameterized approximation algorithm [14] and an algorithm with running time \(2^{\mathcal {O}(k \log k )}n^{\mathcal {O}(1)}\) on AT-free graphs [15]. Unger showed in [16] that the problem is APX-hard. The best known approximation algorithm for this problem is due to Krauthgamer et al. [17] and it provides an \(\mathcal {O}(\log ^3 n)\) factor approximation.
The Bandwidth problem is one of the test-bed problems in the area of moderately exponential time algorithms and has been studied intensively. Trying all possible permutations of the vertex set yields a simple \(\mathcal {O}^{\star }(n!)\) time algorithm while the known algorithms for the problem with running time \(2^{\mathcal {O}(n)}\) are far from straightforward. The \(\mathcal {O}^{\star }(n!)\) barrier was broken by Feige and Kilian [18] who gave an algorithm with running time \(\mathcal {O}^{\star }(10^n)\). This result was subsequently improved by Cygan and Pilipczuk [19] down to \(\mathcal {O}^{\star }(5^n)\). After a series of improvements, the current fastest known algorithm, due to Cygan and Pilipczuk [20, 21] runs in time \(\mathcal {O}^{\star }(4.383^n)\). We also refer the readers to [22] for the best known exact algorithm running in polynomial space. For graphs of treewidth t, one can design an algorithm with running time \(2^n n^{\mathcal {O}(t)}\) [21, 23]. On the other hand, Feige and Talwar [24] showed that the bandwidth of a graph of treewidth at most t can be \((1+\varepsilon )\)-approximated in time \(2^{\mathcal {O}(\log n(t+\sqrt{\frac{n}{\varepsilon }}))}\). Vassilevska et al. [25] gave a hybrid algorithm which after a polynomial time test, either computes the bandwidth of a graph in time \(4^{n+o(n)}\), or provides \(\gamma (n) \log ^2 n\log \log n\)-approximation in polynomial time for any unbounded \(\gamma \). Moreover, for any two positive integers \(k\ge 2\), \(r\ge 1\), Cygan and Pilipczuk presented a \((2kr -1)\)-approximation algorithm that solves Bandwidthfor an arbitrary input graph in \(\mathcal {O}(k^{\frac{n}{(k-1)r}} n^{\mathcal {O}(1)} ) \) time and polynomial space [21]. Finally, Fürer et al. [26] gave a factor 2-approximate algorithm for Bandwidthrunning in time \(\mathcal {O}(1.9797^n)\). DAG-BW, as defined by Garey et al. [3] for dags, was shown to admit a polynomial time algorithm for testing if a dag has bandwidth at most 2. Also, it was proved that the problem to determine if the directed bandwidth of a dag is at most k, for any \(k > 2\), is NP-hardeven in the case of oriented trees. This notion of directed bandwidth reappeared in [27], where it was studied for dense digraphs.
Our Results
The main objective of this paper is to introduce a directed variant of the Bandwidthproblem for general digraphs and study it from the view point of moderately exponential time algorithms, both exactly and approximately. Throughout the remaining, n, m denote the number of vertices and arcs in the input digraph, respectively. For many linear layout problems on graphs on n vertices, beating even the trivial \(\mathcal {O}^{\star }(n!)\) algorithm asymptotically remains a challenge. In this article we design \(2^{\mathcal {O}(n)}\) time algorithms for Digraph Bandwidth. Below we mention the challenges that Digraph Bandwidth imposes when we try to apply the techniques used in the design of \(2^{\mathcal {O}(n)}\) algorithm for Bandwidth, and how we bend our ways to overcome them to design the desired algorithms.
The \(2^{\mathcal {O}(n)}\) time algorithms for Bandwidth that exist in literature (cited above), all follow a common principle of bucket-then-order. Suppose one is interested in checking whether the input graph has an ordering of bandwidth b. The bucket-then-order procedure is a 2-step procedure, where in the first step, instead of directly guessing the position of the vertex in the ordering, for a range of consecutive positions (called buckets) of size \(\mathcal {O}(b)\), one guesses the set of vertices that will occupy these positions in the final ordering. This process of allocating a set of vertices to a range of consecutive positions is called bucketing. Since one can always assume that the graph is connected, once a bucket for the first vertex is guessed using n trials, its neighbours only have a choice of some c buckets for a small constant c depending on the constant in the order notation of the size of the bucket. This, makes the bucketing step run in time \(2^{\mathcal {O}(n)}\). The outcome of the first step is a collection of bucketings which contains a bucketing that is “consistent” with the final ordering. In the second step, given such a consistent bucketing, one can find the final ordering using either a recursive divide and conquer technique or a dynamic programming procedure or a measure and conquer kind of an analysis.
In the case of Digraph Bandwidth, finding a bucketing that is consistent with the final ordering becomes a challenge as even the information that a vertex is placed in some fixed bucket does not decrease the options of the number of buckets in which its neighbours can be placed. This is because there could be some out-neighbours (resp. in-neighbours) of it that need to be placed before (resp. after) it thereby contributing to backward arcs, which eventually results in the need for allocating them to far off buckets. We cope up with this challenge of bucketing in two ways - both of which lead to interesting algorithms that run in \(2^{\mathcal {O}(n)}\) time in different cases. As a first measure of coping up, we take the strategy of “kill what cause you trouble”. Formally speaking, it is the set of backward arcs in the final ordering that have unbounded stretch and hence, make the bucketting process difficult. One way to get back to the easy bucketting case is to guess the set of arcs that will appear as backward arcs in the final ordering. Having guessed these arcs, one can remove them from the graph and preserve the information that the arcs which remain all go forward in the final ordering. This problem becomes similar to the DAG-BW problem defined on dags by Garey et al. [3]. We show that one can do the bucketing tricks similar to the undirected case here to design a \(2^{\mathcal {O}(n)}\) algorithm for this problem (Theorem 1.1). This together with the initial guessing of the backward arcs gives Theorem 1.2.
Theorem 1.1
DAG-BW on dags can be solved in \(\mathcal {O}^\star (3^n)\) time.
Theorem 1.2
Digraph Bandwidth can be solved in \(\mathcal {O}^\star (3^n \cdot 2^m)\) time.
Note that even though the \(2^m\) in the running time of Theorem 1.2 looks expensive, it already generates an algorithm better that \(\mathcal {O}^\star (n!)\) for any digraph that has at most \(o(n \log n)\) arcs. In particular, this implies an exact algorithm with running time \(2^{\mathcal {O}(n)}\) whenever \(\vert E(D) \vert = \mathcal {O}(\vert V(D) \vert )\), for example for digraphs with bounded average degree like planar digraphs.
We will now briefly explain about our second way of dealing with the bucketing phase. As discussed earlier, getting a hold over the arcs which will go backward in the final ordering, eases out the remaining process. In this strategy, instead of guessing the arcs that goes backward by a brute force way (that takes \(2^m\)), we exploit the fact that guessing a partition of the vertex set into two parts, left and right - which corresponds to the first n/2 vertices in the final ordering and the last n/2 vertices in the final ordering, also gives hold on some if not all backward arcs in the final ordering. We place this simple observation into the framework of a divide and conquer algorithm to get a bucketting that is not necessarily “consistent” with the final ordering, but is not too far away to yield a “close enough” approximation to the optimal ordering. This result is formalized in Theorem 1.3. Effectively, the result states that one can find an ordering whose digraph bandwidth is at most \((1+ \epsilon )\) times the optimal in time \(\mathcal {O}^{\star }((1/\epsilon )^n)\). Note that, this result is in contrast with the result of Feige and Talwar [24] for undirected bandwidth where they gave an exponential time approximation scheme that run in time which had a dependence on the treewidth of the graph(\(2^{\mathcal {O}(\log n(t+\sqrt{\frac{n}{\varepsilon }}))}\)). As a side result of our strategy, we can also design an algorithm for solving Digraph Bandwidth optimally on general digraphs in time \(\mathcal {O}^{\star }( 2^{\mathcal {O}(n)} \cdot {OPT}^n)\) or \(\mathcal {O}^{\star } (2^{\mathcal {O}(n)} \cdot 2^{OPT \log OPT \log n})\), where OPT is the optimal digraph bandwidth of the input digraph. This result is stated in Theorem 1.4. Note that, on one hand where \(\mathcal {O}(OPT^n)\) is easy to get for the undirected case (because fixing the position of one vertex in the ordering leaves only \(2 \cdot OPT\) choices for its neighbours), it is not trivial for the directed case. Also, observe that Theorem 1.4 gives a \(2^{\mathcal {O}(n)}\) algorithm whenever \(b \le {n}/{\log ^2n}\).
Theorem 1.3
For any real number \(\epsilon > 0\), for any digraph D, one can find an ordering of digraph bandwidth at most \((1+\epsilon )\) times the optimal, in time \(\mathcal {O}^{\star }(4^n \cdot (\lceil {4}/{\epsilon } \rceil )^n)\).
Theorem 1.4
Digraph Bandwidth can be solved in \(\min \{ \mathcal {O}^{\star }(4^n \cdot b^n), \mathcal {O}^\star (4^n \cdot 2^{b \log b \log n})\}\) time, where b is the optimal digraph bandwidth of the input digraph.
Our last result is based on the connection of the Bandwidth problem with a subgraph isomorphism problem. Amini et al. [23] viewed the Bandwidth problem, on undirected graphs, as a subgraph isomorphism problem, and using an inclusion-exclusion formula with the techniques of counting homomorphisms on graphs of bounded treewidth, they showed that an optimal bandwidth ordering of a graph on n vertices of treewidth at most t can be computed in time \(\mathcal {O}^{\star }(2^{t\log n + n})\) and space \(\mathcal {O}^{\star }(2^{t\log n })\). Using this approach and by relating Digraph Bandwidth via directed homomorphisms to directed path-like-structures, we obtain the following result.
Theorem 1.5
Let D be a digraph on n vertices and \(D'\) be the underlying undirected graph. If the treewidth of \(D'\) is at most t, then Digraph Bandwidth can be solved in time \(\mathcal {O}^\star (2^{n + (t+2) \log n})\).
Observe that Theorem 1.5 provides \(\mathcal {O}^{\star }(2^{n+\mathcal {O}(\sqrt{n} \log n)})\) algorithm for directed planar graphs and for digraph whose underlying undirected graph excludes some fixed graph H as a minor. This algorithm in fact, yields a \(2^{\mathcal {O}(n)}\) time algorithm even when the treewidth of the underlying undirected graph of the given digraph is \(\mathcal {O}(n/\log n)\). Notice that Theorem 1.2 gives \(2^{\mathcal {O}(n)}\) time algorithm for digraphs of constant average degree, while Theorem 1.5 will not apply to these cases as these digraphs could contain expander graphs of constant degree whose treewidth of the underlying undirected graph could be n/c, for some fixed constant c. On the other hand Theorem 1.5 could give \(2^{\mathcal {O}(n)}\) time algorithm for digraphs that have \(\mathcal {O}(n^2/ \log n)\) arcs but treewidth is \(\mathcal {O}(n/\log n)\). Thus, Theorems 1.2 and 1.5 give \(2^{\mathcal {O}(n)}\) time algorithm for different families of digraphs.
2 Preliminaries
For positive integers i, j, \([i] =\{1,\cdots ,i\}\) and \([i,j]=\{i,\cdots ,j\}\).
Sets and Functions: We denote the set of natural numbers by \(\mathbb {N}\). For \(i,j \in \mathbb {N}\), [i] and [i, j] denote the sets \(\{1,\cdots ,i\}\) and \(\{i,\cdots ,j\}\), respectively. For any set X, by \(X=(X_1,X_2)\) we denote an ordered partition of X, that is \(X_1 \cup X_2 = X\), \(X_1 \cap X_2= \emptyset \) and, \((X_1,X_2)\) \((X_2,X_1)\) are two different partitions of X. Let \(f:X\rightarrow Y\) be a function. For \(y\in Y\), \(f^{-1}(y)=\{x\in X \mid f(x)=y\}\). The function f is called injective if for each \(x,y\in X\), \(f(x)=f(y)\) implies \(x=y\). The function \(f: \emptyset \rightarrow Y\) is denoted by \(\phi \). For \(S\subseteq X\), \(f\vert _S:S\rightarrow Y\) is a function such that for \(s\in S\), we have \(f\vert _S(s)=f(s)\). For any functions \(f_1: X_1 \rightarrow Y_1\) and \(f_2: X_2 \rightarrow Y_2\), we say that \(f_1\) is consistent with \(f_2\) if for each \(x \in X_1 \cap X_2\), \(f_1(x) = f_2(x)\). If \(f_1\) and \(f_2\) are consistent, the \(f_1 \cup f_2:X_1\cup X_2 \rightarrow Y_1\cup Y_2\) is defined as \((f_1 \cup f_2)(x) = f_i(x)\), if \(x \in X_i\).
Digraphs: Consider a digraph D. By V(D) and E(D), we denote the set of vertices and (arcs) edges in D, respectively. Throughout the paper, \(n=\vert V(D)\vert \) and \(m=\vert E(D)\vert \). For any \(v \in V(D)\), by \(N^+(v)\) (resp. \(N^-(v)\)) we refer to the out-neighbours (resp. in-neighbours) of v. A digraph D is called weakly connected, if the underlying undirected graph is connected. For any \((u,v) \in E(D)\), u is an in-neighbour of v and v is an out-neighbour of u. For any set V of size n, we call a function \(\sigma :V\rightarrow [n]\) as an ordering of V. Given a function \(\sigma \), we call \(\sigma (u)\) as the position of u in \(\sigma \). Given an ordering \(\sigma \) of V(D), an arc \((u,v)\in E(D)\) is called a forward arc in \(\sigma \) if \(\sigma (u)<\sigma (v)\), otherwise it is called a backward arc in \(\sigma \). For a natural number \(b\in \mathbb {N}\), we call \(\sigma \) as a b-ordering of D if for any forward arc \((u,v)\in E(D)\), \(\sigma (v)-\sigma (u)\le b\). An ordering \(\sigma \) of V(D) is called a topological ordering if every arc \((u,v)\in E(D)\) is a forward arc in \(\sigma \). A digraph D is called a directed acyclic graph (DAG), if D has a topological ordering. Let \(\sigma \) be an ordering of V(D). By \(\sigma _i\), we denote the vertex \(\sigma ^{-1}(i)\). Given two orderings \(\sigma _1:V(D_1)\rightarrow [n_1]\) and \(\sigma _2:V(D_2)\rightarrow [n_2]\), we define the concatenation of \(\sigma _1\) and \(\sigma _2\) as the ordering \(\sigma _1\cdot \sigma _2 :V(D_1)\cup V(D_2) \rightarrow [n_1+n_2]\) where \(\sigma _1 \cdot \sigma _2(u) = \sigma _1(u)\) if \(u \in V(D_1)\) and \(\sigma _1 \cdot \sigma _2 (u) = n_1 + \sigma _2(u)\) if \(u \in V(D_2)\).
Bucketting: Given a set V and an integer b, a b-bucketing of V is a function \(\texttt{B}: V \rightarrow [p,q]\), such that \(p,q \in \mathbb {N}\) and for each \(i \in [p,q-1]\), \(\vert \texttt{B}^{-1}(i) \vert =b\) and \(\vert \texttt{B}^{-1}(q) \vert \le b\). Note that, if \(\vert V \vert \) is a multiple of b, then \(\texttt{B}^{-1}(q) =b\) and \((q-p+1) \cdot b = \vert V \vert \). If for each \(i \in [p,q]\), \(\vert \texttt{B}^{-1}(i) \vert \le b\), we call \(\texttt{B}\) a partial b-bucketing of V. Note that, for any b, every b-bucketing is a partial b-bucketing. For a (partial) b-bucketing \(\texttt{B}: V \rightarrow [p,q]\), we say that an element \(v\in V\) is assigned the i-th bucket of \(\texttt{B}\) if \(\texttt{B}(v)=i\) and \(\texttt{B}(v)\) is called the bucket of v. Also, b is called the size of the bucket \(\texttt{B}(v)\). If \(\texttt{B}(u)=i\) and \(\texttt{B}(v)=j\) and \(j>i\), then the number of buckets between the buckets of u and v is equal to \(j-i-1\). Also, the number of elements of V in the buckets between i and j is \((j-i-1) \cdot b\). In explanations, we sometimes drop b and call \(\texttt{B}\) a (partial) bucketing to mean that it is a b-bucketing for some b that should be clear from the context. Given a set V, an integer b and an ordering \(\sigma \) of V, one can associate a b-bucketing with \(\sigma \) which assigns the first b elements in \(\sigma \) the 1-st bucket, the next b-elements the next and so on. This is formalized below. Given a set V, an integer b and an ordering \(\sigma \) of V, we say a b-bucketing \(\texttt{B}\) respects \(\sigma \) if \(\texttt{B}: V \rightarrow [\lceil {\vert V \vert }/{b}\rceil ]\) is defined as follows. For any \(x \in [\vert V \vert ]\), if \(x=ib+j\) for some \(i \in \mathbb {N}\) such that \(j < b\), then \(\texttt{B}(\sigma _x) = i+1\) if \(j>0\), and \(\texttt{B}(\sigma _x) = i\) if \(j=0\).
Tree decomposition: A tree decomposition of a graph G is a pair \(\mathcal {T}=(T,X)\), where T is a rooted tree and \(X=\{X_t \mid t\in V(T)\}\). Every node t of T is assigned a subset \(X_t\subseteq V(H)\) such that following conditions are satisfied:
-
\(\bigcup \limits _{t\in V(T)}X_t=V(G)\), i.e. each vertex in G is in at least one bag;
-
For every edge \(uv\in E(G)\), there is \(t\in V(T)\) such that \(u,v \in X_t\);
-
For every vertex \(v\in V(G)\) the graph \(T[\{t\in V(T)\mid v\in X_t\}]\) is a connected subtree of T.
The width of tree decomposition \(\mathcal {T}\) is \(\max _{t \in V(T)} \vert X_t \vert -1\). The treewidth of a graph G is the minimum possible width of a tree decomposition of G.
3 Exact Algorithm for Directed Bandwidth for dags
The goal of this section is to prove Theorem 1.1. The algorithm follows the ideas of Cygan and Pilipczuk [28]. We give the details here for the sake of completeness and to mention the little details where we deviate from the algorithm of [28]. Throughout this section, without loss of generality, we can assume that the input digraph D is weakly connected, as otherwise, one can solve the problem on each of the weakly connected components of D and concatenate the orderings obtained from each of them, in any order, to get the final ordering. Also, instead of working on the optimization version of the problem, we work on the decision problem, where together with the input digraph D, one is given an integer b, and the goal is to decide whether there exists a topological ordering of V(D) of bandwidth at most b. It is easy to see that designing an algorithm for this decision version with the desired running time is enough to prove Theorem 1.1. In the following, we abuse notation a little and call (D, b) as an instance of DAG-BW.
Throughout the remaining section, we call a topological ordering of D of bandwidth b as a \(b-topological\,\,ordering\). A b-bucketing of V(D) is called a b-topological bucketing if for all \((u,v)\in E(D)\), either \(\texttt{B}(u)=\texttt{B}(v)\) or \(\texttt{B}(v)=\texttt{B}(u)+1\). Our algorithm, like the algorithm of [28], has two phases \(:\) Bucketingand Ordering. The Bucketingphase of the algorithm is described by Lemma 3.1.
Lemma 3.1
Given an instance (D, b) of DAG-BW, one can find a collection \(\mathcal {B}\), of \((b+1)\)-topological bucketings of V(D) of size at most \(2^{n-1} \cdot \lceil {n}/{b+1} \rceil \), in time \(\mathcal {O}^\star (2^n)\), such that for every \(b\)-topological ordering\(\sigma \) of D, there exists a bucketing \(\texttt{B} \in \mathcal {B}\) such that \(\texttt{B}\) respects \(\sigma \).
Proof
The pseudocode of the algorithm to construct a collection of \((b+1)\)-topological bucketingsis given in Algorithm 1. In Algorithm 1, \(\texttt{B}(v)=\star \) denotes that we have not assigned a bucket to v. In Step 3 of Algorithm 1, queue is an ordered set. In Step 19 of Algorithm 1, we add a vertex at the end of ordered set queue. In Step 23 of Algorithm 1, we remove the first element of queue.
Suppose that (D, b) is a YES instance of DAG-BW. Let \(\sigma \) be a \(b\)-topological orderingof (D, b). Let \({\mathtt B}_\sigma \) be the unique bucketing induced by \(\sigma \). We compute a collection \(\mathcal {B}\), of \((b+1)\)-bucketings of D using Algorithm 1. We claim that at each iteration of the algorithm, there exists a bucketing \({\mathtt B} \in \mathcal {B}\) such that if \(\texttt{B}(v)\ne \star \), then \(\texttt{B}(v)=\texttt{B}_\sigma (v)\). We prove it by induction on the number of iterations. Note that in the first iteration of the algorithm, \(\mathcal {B}\) contains all possible \((b+1)\)-bucketings of v. Therefore, there exists a bucketing \(\texttt{B}\in \mathcal {B}\) such that \(\texttt{B}(v)=\texttt{B}_\sigma (v)\). Now, let X be a set of vertices whose bucket has been decided till \((i+1)^{\text{th}}\) iterations of the algorithm. Let x be a vertex that is placed at the \((i+1)^{\text{th}}\) iteration of the algorithm. Let q be the element of queue corresponding to which we execute Step 6 of the algorithm for x. Note that if \(x\in N^+(q)\), then \(x\in \{{\mathtt B}_\sigma (q),{\mathtt B}_\sigma (q)+1\}\), otherwise \(x\in \{{\mathtt B}_\sigma (q),{\mathtt B}_\sigma (q)-1\}\). Note that we have constructed all these bucketings for x in Step 9 to 18 of the algorithm. By induction hypothesis, there exists \(\texttt{B}\in \mathcal {B}\) such that \(\texttt{B}(u)=\texttt{B}_\sigma (u)\) for all \(u\in X\setminus \{x\}\). Hence, there exists \(\texttt{B} \in \mathcal {B}\) such that \(\texttt{B}(u)=\texttt{B}_\sigma (u)\) for all \(u\in X\). Note that since D is a weakly connected digraph, when \(queue = \emptyset \), there does not exist \(v\in V(D)\) such that \(\texttt{B}(v) = \star \), \(\texttt{B}\in \mathcal {B}\). Now, we prove that \(\vert \mathcal {B}\vert =\mathcal {O}^\star (2^n)\). Note that in Step 2 of the algorithm, we construct \({n}/{(b+1)}\) bucketings for v. Then, for each \(u\in V(D)\setminus \{v\}\), we construct at most two \((b+1)\)-bucketings. Therefore, \(\vert {\mathcal {B}}\vert \le 2^{n-1}\cdot {n}/{(b+1)}\). Since each step of the algorithm can be executed in polynomial time, the running time of the algorithm is \(\mathcal {O}^\star (2^n)\) time.\(\square \)
In the Orderingphase, given a \((b+1)\)-topological bucketing\(\texttt{B}\), the algorithm finds a \(b\)-topological ordering\(\sigma \) of D, if it exists, such that \(\texttt{B}\) respects \(\sigma \). From Lemma 3.1, the family \(\mathcal {B}\) guarantees the existence of a \((b+1)\)-topological bucketing\(\texttt{B}\) of the final desired ordering, if it exists.
To execute this step, we use the idea of finding a sequence of lexicographically embeddibe sets using dynamic programming as used in [28]. To define lexicographically embeddible set, the authors first defined the notion of lexicographic ordering of slots. We use the same definition in this paper.
Definition 3.1
(Lexicographic ordering of slots) Given an integer b, let \({\texttt{bucket}}:[n]\) \(\rightarrow \lceil {n}/{(b+1)} \rceil \) be a function such that \({\texttt{bucket}}(i)= \lceil {i}/{(b+1)} \rceil \) and \({\texttt{pos}}:[n] \rightarrow [b+1]\) be a function such that \({\texttt{pos}}(i)= ((i-1)\mod (b+1))+1\). We define the lexicographic ordering of slots as the lexicographic ordering of \(({\texttt{pos}}(i),{\texttt{bucket}}(i))\), where \(i \in [n]\).
For the Bandwidthproblem, the authors of [28] proceed as follows. Given a graph \(G=(V,E)\), and a \((b+1)\)-bucketing, \(\texttt{B}\) of V(G), they prove that there exists an ordering \(\sigma \) of G such that \(\texttt{B}\) respects \(\sigma \) if and only if there exists a sequence of subsets of V(G), \( \emptyset \subset S_1 \subset \cdots \subset S_n\), \(|S_i |= i\), for all \(i\in [n]\), such that each \(S_i\) satisfies the following properties: (i) for each \(S_i\), there is a mapping \(\gamma _{S_i}:S_i \rightarrow [n]\) such that \({\texttt{bucket}}(\gamma _{S_i}(v))=\texttt{B}(v)\), and the set \(\{({\texttt{pos}}(\gamma _{S_i}(v)),{\texttt{bucket}}(\gamma _{S_i}(v)))\mid v\in S_i\}\) is the set of first \(\vert S_i\vert \) elements in the lexicographic ordering of slots, and (ii) if \(u\in S_i\) and \(v\notin S_i\), then \(\texttt{B}(v)\le \texttt{B}(u)\). They call such a set \(S_i\) as a lexicographically embeddible set. They then obtain \(\gamma _{S_{i+1}}\) by extending \(\gamma _{S_i}\) as follows. If \(v\in S_i \cap S_{i+1}\), then \(\gamma _{S_{i+1}}(v)=\gamma _{S_i}(v)\), otherwise \(({\texttt{pos}}(\gamma _{S_{i+1}}(v)),{\texttt{bucket}}(\gamma _{S_{i+1}}(v)))\) is the \(\vert S_{i+1}\vert ^{\text {th}}\) element in the lexicographic embedding of slots. Recall that there is only one vertex v in \(S_{i+1}\setminus S_i\). Furthermore, if v has a neighbor u in \(S_i\), then \(\texttt{B}(v)\le \texttt{B}(u)\). If \(\texttt{B}(v)=\texttt{B}(u)\), then since bucket size is at most \(b+1\), \(|\gamma _{S_{i+1}}(v)-\gamma _{S_{i+1}}(u)|\le b\). If \(\texttt{B}(v)<\texttt{B}(u)\), then by construction of \(\gamma _{S_{i+1}}\), \({\texttt{pos}}(\gamma _{S_{i+1}}(v))>{\texttt{pos}}(\gamma _{S_{i+1}}(u))\). Now, again since each bucket size is at most \(b+1\), \(|\gamma _{S_{i+1}}(v)-\gamma _{S_{i+1}}(u)|\le b\). Therefore, \(\gamma _{S_i}\) can be extended to \(\gamma _{S_{i+1}}\). Thus, \(\gamma _{S_n}\) will yield the final ordering. Hence, the goal reduces to finding a sequence \( S_1 \subset \cdots \subset S_n\), \(|S_i |= i\), for all \(i\in [n]\), such that each \(S_i\) is a lexicographically embeddible set. We will call such a sequence as a lexicographically embeddible sequence(les, in short).
We proceed in a similar way for Directed Bandwidth. We first note that one cannot use the same definition of lexicographically embeddible set as defined above due to the following reason. Suppose that \(S_i\) is a lexicographical embeddible set. Consider a vertex \(u\in S_i\). Suppose that there exists a vertex \(v\notin S_i\) that is an in-neighbor of u, then v cannot belong to the bucket of u as it will not lead to the topological ordering using the method defined above. Also, if v is an out-neighbor of u, then since we are working with topological bucketing, v does not belong to the bucket that precedes the bucket of u. Hence, v belongs to the bucket of u. We also want \(\gamma \) as a topological ordering. Therefore, we redefine the notion of lexicographically embeddible set for Directed Bandwidthas follows.
Definition 3.2
(Lexicographically embeddible set for digraphs) Given a \((b+1)\)-topological bucketing\(\texttt{B}\), of V(D), we say that \(S\subseteq V(D)\) is a lexicographically embedibble set if the following condition holds.
-
(C1)
For each arc \((u,v)\in E(D)\) such that \(u\in S\) and \(v\notin S\), \(\texttt{B}(u)=\texttt{B}(v)\).
-
(C2)
For each arc \((u,v)\in E(D)\) such that \(v\in S\) and \(u\notin S\), \(\texttt{B}(u)=\texttt{B}(v)-1\).
-
(C3)
There exists a \(b\)-topological ordering\(\gamma :S\rightarrow [n]\) such that for all \(v\in S\), \({\texttt{bucket}}(\gamma (v))=\texttt{B}(v)\), and \(({\texttt{pos}}(\gamma (v)),{\texttt{bucket}}(\gamma (v)))\) belongs to the first \(\vert S\vert \) elements in the lexicographic ordering of slots. We refer \(\gamma \) as a partial \(b\)-topological orderingthat respects lexicographic ordering of slots.
Now we prove that given a \((b+1)\)-topological bucketing\({\mathtt B}\) of V(D), to find a \(b\)-topological ordering\(\sigma \) such that \(\texttt{B}\) respects \(\sigma \), it is sufficient to find a les. We prove this in the following lemma.
Lemma 3.2
Given a \((b+1)\)-topological bucketing\(\texttt{B}\) of V(D), the following are equivalent. (i) There exists a \(b\)-topological ordering\(\sigma \) of the digraph D such that the unique \((b+1)\)-bucketing induced by \(\sigma \), that is \(\texttt{B}_\sigma \), is \({\mathtt B}\). In other words, \(\texttt{B}_\sigma (v)=\texttt{B}(v)\), for all \(v\in V(D)\), (ii)There exists a les, \(\emptyset \subset S_1 \subset \cdots \subset S_n =V\).
Proof
Suppose that there exists a \(b\)-topological ordering\(\sigma \) of the digraph D such that \(\texttt{B}_\sigma (v)=\texttt{B}(v)\), for all \(v\in V(D)\). Let \(\Upsilon _{slots}\) be the lexicographic ordering of slots. Let \(i\in [n]\). We define the set \(S_i\) as follows.
Clearly, \(\vert S_i\vert =i\). We claim that \(S_i\) is a lexicographically embeddible subset. We first prove (C1). Consider an arc \((u,v)\in E(D)\) such that \(u\in S_i\) and \(v\notin S_i\). For the contradiction, suppose that \(\texttt{B}(u)\ne \texttt{B}(v)\). Since \(u\in S_i\) and \(v\notin S_i\), by the definition of \(S_i\), \({\texttt{pos}}(\sigma (u))\le {\texttt{pos}}(\sigma (v))\). Since \(\texttt{B}\) is a topological bucketingand \(\texttt{B}(u)\ne \texttt{B}(v)\), \(\texttt{B}(u)=\texttt{B}(v)-1\). Moreover, since \(\texttt{B}\) is a \((b+1)\)-bucketing, we obtained that \(\sigma (v)-\sigma (u)\ge b+1\), a contradiction to the fact that \(\sigma \) is a b-ordering. Now, we will prove (C2). Consider an arc \((u,v)\in E(D)\) such that \(v\in S_i\) and \(u\notin S_i\). For the contradiction, suppose that \(\texttt{B}(u)\ne \texttt{B}(v)-1\). Since \(\sigma \) is a \(b\)-topological ordering, and \(\texttt{B}\) is \((b+1)\)-bucketing, we have that either \(\texttt{B}(u)= \texttt{B}(v)\) or \(\texttt{B}(u)= \texttt{B}(v)-1\). Thus, \(\texttt{B}(u)= \texttt{B}(v)\). Moreover, since \(v\in S_i\) and \(u\notin S_i\), by the definition of \(S_i\), we infer that \({\texttt{pos}}(\sigma (v))< {\texttt{pos}}(\sigma (u))\). Hence, \(\sigma (v)<\sigma (u)\), a contradiction to the fact that \(\sigma \) is a topological ordering of D. Note that \(\sigma \vert _{S_i}\) is a \(b\)-topological orderingthat satisfies (C3) by the construction of \(S_i\).
Now, suppose that there exists a les, \(\emptyset \subset S_1 \subset \cdots \subset S_n =V\). We construct an ordering \(\sigma \) as follows. Let \(v\in S_i\setminus S_{i-1}\). We set \(\sigma (v)=k\), where \(({\texttt{pos}}(k),{\texttt{bucket}}(k))\) is at \(i^{\text {th}}\) position in \(\Upsilon _{slots}\). We claim that \(\sigma \) is a \(b\)-topological orderingof the digraph D such that for all \(v\in V(D)\), \(\texttt{B}_\sigma (v)=\texttt{B}(v)\). Since each \(S_i\) is a lexicographically embeddible set, if a vertex \(v\in S_i\setminus S_{i-1}\), then \(\texttt{B}(v) = ((i-1) \mod \nicefrac {n}{(b+1)})+1\). Therefore, \(\texttt{B}_\sigma (v)=\texttt{B}(v)\), for all \(v\in V(D)\) by the construction of \(\sigma \). Now, we show that \(\sigma \) is a topological ordering of D. For the contradiction, suppose that \((u,v)\in E(D)\) such that \(\sigma (u)=p\), \(\sigma (v)=q\) and \(q<p\). Since \(q<p\), either \({\texttt{pos}}(q)\le {\texttt{pos}}(p)\) or \({\texttt{bucket}}(q)<{\texttt{bucket}}(p)\). Suppose that \({\texttt{pos}}(q)\le {\texttt{pos}}(p)\). Then, there exists a lexicographical embeddible set S such that \(v\in S\) and \(u\notin S\). Therefore, by condition (C2), \(\texttt{B}(u)= \texttt{B}(v)-1\). Hence, \(\texttt{B}_\sigma (u)<\texttt{B}_\sigma (v)\) as \(\texttt{B}_\sigma = \texttt{B}\). Since \(q<p\), \(\texttt{B}_\sigma (v)\le \texttt{B}_\sigma (u)\), a contradiction. Now, suppose that \({\texttt{pos}}(q)> {\texttt{pos}}(p)\). Then, there exists a lexicographical embeddible set S such that \(u\in S\) and \(v\notin S\). Then, by condition (C1), \(\texttt{B}(u)=\texttt{B}(v)\). Since \(q<p\) and \({\texttt{pos}}(q)> {\texttt{pos}}(p)\), we have that \({\texttt{bucket}}(q)<{\texttt{bucket}}(p)\). Since by the definition of \(\texttt{B}\) and \({\texttt{bucket}}\), \(\texttt{B}_\sigma (w)=\texttt{B}(w)={\texttt{bucket}}(\sigma (w))\), for all \(w\in V(D)\), we have that \(\texttt{B}(v)<\texttt{B}(u)\), a contradiction. Therefore, \(\sigma \) is a topological ordering. Now, we prove that \(\sigma \) is a b-ordering. Let \((u,v)\in E(D)\). Since \(\sigma \) is a topological ordering of V(D), \(\sigma (u)<\sigma (v)\). If \(\texttt{B}_\sigma (u)=\texttt{B}_\sigma (v)\), then \(\sigma (v)-\sigma (u) \le b\). Now, suppose that \(\texttt{B}_\sigma (u)\ne \texttt{B}_\sigma (v)\). Since \(\sigma \) is a topological ordering and \(\sigma (u)<\sigma (v)\), \(\texttt{B}_\sigma (u)<\texttt{B}_\sigma (v)\). If \({\texttt{pos}}(u)>{\texttt{pos}}(v)\), then \(\sigma (v)-\sigma (u) \le b\). Now, suppose that \({\texttt{pos}}(u)\le {\texttt{pos}}(v)\). Then, there exists a lexicographical embeddible set S such that \(u\in S\) and \(v\notin S\). Since \(\texttt{B}_\sigma =\texttt{B}\), we have that \(\texttt{B}(u)<\texttt{B}(v)\). Moreover, since \((u,v)\in E(D)\), this contradicts that S is a lexicographically embeddible set (condition (C1) does not hold).\(\square \)
Due to Lemma 3.2, our goal is reduced to find a les. Cygan and Pilipczuk [28] find a les using dynamic programming over subsets of the vertex set of given graph. We use a similar dynamic programming approach with appropriate modification because of the revised definition of a lexicographically embeddible set. In the dynamic programming table, for each \(S \subseteq V(D)\), \(c[S]=1\), if and only if S is a lexicographically embeddible set. To compute the value of c[S], we first find a vertex \(v\in S\) such that \(S\setminus \{v\}\) is a lexicographically embeddible set, that is, \(c[S\setminus \{v\}]=1\), and v satisfies the following properties \(:\) (i) for all the arcs \((v,u)\in E(D)\) such that \(u\notin S\), \(\texttt{B}(v)=\texttt{B}(u)\); (ii) for all the arcs \((u,v)\in E(D)\) such that \(u\notin S\), \(\texttt{B}(u)= \texttt{B}(v)-1\); and (iii) \(\texttt{B}(v)=((\vert S\vert -1)\mod \lceil {n}/{(b+1)} \rceil )+1\). We compute the value of c[S] for every subset \(S\subseteq V(D)\). Note that if \(c[V(D)]=1\), then V(D) is a lexicographically embeddible set. Also, we can compute a les by backtracking in the dynamic programming table.
Lemma 3.3
Given an instance (D, b) of DAG-BW, and a \((b+1)\)-topological bucketing\(\texttt{B}\) of V(D) that respects some \(b\)-topological orderingof D (if it exists), one can compute a les in time \(\mathcal {O}^{\star }(2^n)\).
Proof
We find a les using a dynamic programming algorithm. We define our dynamic programming table as follows. For each subset \(S\subseteq V(D)\), c[S] is 1, if S is a lexicographically embeddible set, otherwise 0. We compute c[S] for all \(2^n\) subsets of V(D). Base case of our algorithm is \(c[\emptyset ]=1\). Clearly, \(\emptyset \) is vacuously a lexicographically embeddible set. Now, for recursive computation, let \(S\subseteq V(D)\). We compute c[S] using the following formula.
In the above formula, \(\texttt{In}(v)=1\) if for all the arcs \((v,u)\in E(D)\) such that \(u\notin S\), \(\texttt{B}(v)=\texttt{B}(u)\), otherwise 0; \(\texttt{Out}(v)=1\) if for all the arcs \((u,v)\in E(D)\) such that \(u\notin S\), \(\texttt{B}(u)< \texttt{B}(v)\), otherwise 0; and \(\texttt{SB}(v)=1\) if \(\texttt{B}(v)\) is equal to \(((\vert S\vert -1)\mod n/{(b+1)})+1\), otherwise 0. Note that \(\texttt{In}(v)\) and \(\texttt{Out}(v)\) indicates whether condition (C1) and condition (C2) are satisfied for the incoming and outgoing arcs incident on v. Now, we prove that \(c[S]=1\) if and only if S is a lexicographically embeddible set, where \(S\subseteq V(D)\). In the forward direction, suppose that \(c[S]=1\). This implies that there exists \(v\in S\) such that \(c[S\setminus \{v\}]=1\), \(\texttt{In}(v)=1\), \(\texttt{Out}(v)=1\) and \(\texttt{SB}(v)=1\). Note that by the definition of \(\texttt{In}(v)\) and \(\texttt{Out}(v)\) and the fact that \(S\setminus \{v\}\) is a lexicographically embeddible set, conditions (C1) and (C2) in Definition 3.2 are satisfied by S. Since \(c[S\setminus \{v\}]=1\), there exists an ordering, \(\rho :S\setminus \{v\}\rightarrow [n]\) that respects lexicographic ordering of slots. We define a function \(\gamma :S\rightarrow [n]\) such that \(\gamma (u)=\rho (u)\) for all \(u\in S\setminus \{v\}\) and \(\gamma (v)=k\), where \(({\texttt{pos}}(k),{\texttt{bucket}}(k))\) is \(\vert S\vert ^{\text{ t }h}\) element in the lexicographic ordering of slots. Since \({\texttt{bucket}}(\rho (u))=\texttt{B}(u)\), for all \(u \in S\setminus \{v\}\) and \(\texttt{SB}(v)=1\), we obtained that \({\texttt{bucket}}(\gamma (u))=\texttt{B}(u)\), for all \(u \in S\). Now, we argue that \(\gamma \) is a topological ordering. Consider an arc \((x,y)\in E(D)\) such that \(x,y \in S\). Suppose that \(x\in S\setminus \{v\}\). If \(y \in S\setminus \{v\}\), then since \(\rho \) is a topological ordering, \(\gamma (x)<\gamma (y)\). Suppose that \(y\notin S\setminus \{v\}\), that is, \(y=v\). Since \(S\setminus \{v\}\) is a lexicographically embediddble set, using condition (C1), \(\texttt{B}(x)=\texttt{B}(v)\). Hence, by the construction of \(\gamma \), \(\gamma (x)<\gamma (v)\). Now, suppose that \(x\notin S\setminus \{v\}\), that is, \(x=v\). This implies that \(y\in S\setminus \{v\}\). Since \(S\setminus \{v\}\) is a lexicographically embeddible set, \(\texttt{B}(v)=\texttt{B}(y)-1\) (condition (C2) in Definition 3.2). Hence, \(\gamma \) is a topological ordering. Now, we prove that \(\gamma \) is a b-ordering. Consider an arc \((x,y)\in E(D)\) such that \(x,y \in S\). If \(x,y\in S\setminus \{v\}\), then \(|\gamma (x) -\gamma (y)|\le b\) as \(\rho \) is a b-ordering. Suppose that \(x=v\). Since \(y\in S\setminus \{v\}\) and \(S\setminus \{v\}\) is a lexicographically embeddible set, using condition (C2) in Definition 3.2, \(\texttt{B}(v)=\texttt{B}(y)-1\). Therefore, by the construction of \(\gamma \), \({\texttt{pos}}(\gamma (v))> {\texttt{pos}}(\gamma (y))\). Hence, \(|\gamma (x) -\gamma (y)|\le b\). Now, suppose that \(y=v\). Recall that we are considering arc (x, v). Since \(x\in S\setminus \{v\}\), using condition (C1) in Definition 3.2, we have that \(\texttt{B}(v)=\texttt{B}(x)\). Since \(\texttt{B}\) is a \((b+1)\)-bucketing, we obtained that \( \vert \gamma (v) - \gamma (x) \vert \le b\). Hence, S is a lexicographically embeddible set. This completes the proof in the forward direction. In the backward direction, suppose that S is a lexicographically embeddible set. Then, there exists an ordering \(\rho :S\rightarrow [n]\) that respects lexicographic ordering of slots. Let v be the vertex in S for which \(({\texttt{pos}}(\rho (v)),{\texttt{bucket}}(\rho (v)))\) is largest among all the vertices in S. We claim that \(c[S\setminus \{v\}]=1\), \(\texttt{In}(v)=1\), \(\mathtt {Out(v)}=1\) and \(\texttt{SB}(v)=1\). Note that since S is a lexicographically embeddible set, \(\texttt{In}(v)=1\), \(\mathtt {Out(v)}=1\) and \(\texttt{SB}(v)=1\). Now, we prove that \(S\setminus \{v\}\) is a lexicographically embeddible set. We first prove (C1). Suppose that \((u,u')\in E(D)\) such that \(u \in S\setminus \{v\}\) and \(u' \in V(D)\setminus (S\setminus \{v\})\). For the contradiction, suppose that \(\texttt{B}(u)\ne \texttt{B}(u')\). If \(u'\ne v\), then since \(u'\notin S\), this contradicts that S is a lexicographically embeddible set. Now, suppose that \(u'=v\). Since \(\texttt{B}\) is a topological bucketing and \(\texttt{B}(u)\ne \texttt{B}(v)\), \(\texttt{B}(u)< \texttt{B}(v)\). By the choice of v, \(({\texttt{pos}}(\rho (u)),{\texttt{bucket}}(\rho (u)))<({\texttt{pos}}(\rho (v)),{\texttt{bucket}}(\rho (v)))\). Therefore, \({\texttt{pos}}(\rho (u))\le {\texttt{pos}}(\rho (v))\). Hence, \(\rho (v)-\rho (u)\ge b+1\), a contradiction to that \(\rho \) is a b-ordering. Now, we prove condition (C2). Suppose that there exists an arc \((u,u')\in E(D)\) such that \(u'\in S\setminus \{v\}\) and \(u\in V(D)\setminus (S\setminus \{v\})\). For the contradiction suppose that \(\texttt{B}(u)\ge \texttt{B}(u')\). Since \(\texttt{B}\) is topological bucketing, \(\texttt{B}(u)\le \texttt{B}(u')\). Therefore, \(\texttt{B}(u)=\texttt{B}(u')\). If \(u \ne v\), then this contradicts that S is a lexicographically embeddible set. Suppose that \(u=v\). As argued above \({\texttt{pos}}(\rho (u'))\le {\texttt{pos}}(\rho (v))\). Moreover, since \(\texttt{B}(v)=\texttt{B}(u')\), we obtained that \({\texttt{pos}}(\rho (u'))< {\texttt{pos}}(\rho (v))\). Since, \((v,u')\in E(D)\), this contradicts that \(\rho \) is a topological ordering. Note that \(\rho \vert _{S\setminus \{v\}}\) is a \(b\)-topological orderingthat satisfies condition (C3).\(\square \)
Note that using Lemmas 3.1, 3.2 and 3.3, one can solve DAG-BWin \(\mathcal {O}^\star (4^n)\) time. The desired running time of \(\mathcal {O}^\star (3^n)\) in Theorem 1.1 can be proved by careful analysis of two steps in the algorithm as done in Theorem 12 of [28]. Since the proof of this is the same as Theorem 12 of [28], we defer the proof here.
4 Exact Algorithm for Digraph Bandwidthvia Directed Bandwidth
In this section, we prove Theorem 1.2. We call an ordering of the vertex set of a digraph a b-ordering if its digraph bandwidth is at most b. In order to prove Theorem 1.2 observe the following. Let (D, b) be an instance of (the decision version of) Digraph Bandwidth. If it is a Yes instance, then let \(\sigma \) be a b-ordering of D. Let R be the set of backward arcs in \(\sigma \). Note that \(\sigma \) is a topological ordering of \(D-R\). If we guess the set of backward arcs R in a b-ordering of D (which takes time \(2^m\)), then the goal is reduced to finding a \(b\)-topological ordering, \(\sigma \), of \(D-R\) such that if \((u,v)\in R\), then \(\sigma (u)>\sigma (v)\). In fact, one can also observe that it is sufficient to find a \(b\)-topological ordering, \(\rho \), of \(D-R\) such that for all \((u,v)\in R\) either \(\rho (u)>\rho (v)\) or \(\rho (v)-\rho (u) \le b\). We claim that we can find the required ordering of \(D-R\) using the algorithm for Directed Bandwidthfor dags given in Section 3. Suppose that \(\sigma \) is a b-ordering of D. Let \(\texttt{B}_\sigma \) be a \((b+1)\)-bucketing that respects \(\sigma \). Let R be the set of backward arcs in \(\sigma \). Since \(\sigma \) is a \(b\)-topological orderingof \(D-R\), using Lemma 3.1, \(\texttt{B}_\sigma \) belongs to the collection of \((b+1)\)-bucketings \(\mathcal {B}\). Now, using Lemmas 3.3 and 3.2, we obtain a \(b\)-topological ordering\(\rho \) of \(D-R\) that respects \(\texttt{B}_\sigma \). Note that \(\rho \) is a b-ordering of D, as for each arc \((u,v) \not \in R\), \(\rho (v) - \rho (u) \le b\) because \(\rho \) is a \(b\)-topological orderingof \(D-R\). Also, if \((u,v) \in R\), then observe that if \(\texttt{B}_\sigma (u) \ne \texttt{B}_\sigma (v)\), then since both \(\sigma \) and \(\rho \) respect \(\texttt{B}_{\sigma }\) and (u, v) is a backward arc in \(\sigma \), thus, (u, v) is a backward arc in \(\rho \) too, that is, \(\rho (u) > \rho (v)\). Otherwise, if \((u,v) \not \in R\) and \(\texttt{B}_\sigma (u) = \texttt{B}_\sigma (v)\), then since \(\rho \) respects \(\texttt{B}_{\sigma }\) and the size of the buckets of \(\texttt{B}_{\sigma }\) is \((b+1)\), therefore, \(\vert \rho (u) - \rho (v) \vert \le b\). Thus, the algorithm of Theorem 1.2 runs the algorithm for DAG-BWfor each \(R \subseteq V(D)\), to obtain the desired running time.
5 (Single) Exponential Time Approximation Scheme for Digraph Bandwidth
The goal of this section is to prove Theorems 1.3 and 1.4. Let (D, b) be an instance of (the decision version of) Digraph Bandwidth. The algorithm relies on an interesting property of a b-bucketing that respects a b-ordering of D. Let \(\sigma \) be a b-ordering of D and let \(\texttt{B}\) be a b-bucketing of V(D) that respects \(\sigma \). An interesting property of such a bucketing \(\texttt{B}\) is that if \((u,v) \in E(D)\), then either \(\texttt{B}(u) >\texttt{B}(v)\) or \(\texttt{B}(v) \le \texttt{B}(u)+1\). This is because the size of each bucket in \(\texttt{B}\) is b and \(\sigma \) is a b-ordering of D. Let us call this property of a b-bucketing useful. What we saw in the previous section is that if we somehow have a bucketing that respects \(\sigma \), then one can design an algorithm to fetch \(\sigma \) from this bucketing. In this section, instead of seeking for a bucketing that respects \(\sigma \) we seek for a bucketing with the above mentioned useful property. Observe that, while the existence of such a bucketing with this useful property might not necessarily imply the existence of some b-ordering of D, but having such a bucketing with, for example buckets of size b, definitely yields a 2b-ordering of D. This is because, given such a bucketing one can assign positions to vertices in the ordering by choosing any arbitrary ordering amongst the vertices that belong to the same bucket and concatenating these orderings in the order of the bucket numbers. By changing the bucket size in the described bucketing, one can yield an ordering of digraph bandwidth at most \((1+\epsilon )\) times the optimal. This procedure, as we will see, also give an optimal digraph bandwidth ordering when we use the bucket sizes to be 1. Below we give the description of the algorithm used to find a bucketing with the useful property.
We begin by formulating the useful property of a bucketing described above. Since the size of buckets is uniform in a bucketing, instead of defining the property in terms of bucket numbers, we describe it in terms of the number of vertices that can appear between the two buckets corresponding to the end points of a forward arc in the ordering. Such a shift in definition helps us to get slightly better bounds in our running time. For any positive integers b, s and a digraph D, given \(X \subseteq V(D)\) and a (partial) b-bucketing of X, say \(\texttt{B}: X \rightarrow [p,q]\) for some \(p,q \in \mathbb {N}\), we say that the external stretch of \(\texttt{B}\) is at most s if for each arc \((u,v) \in E(D[X])\), either \(\texttt{B}(u) \ge \texttt{B}(v)\), or \((\texttt{B}(v) - \texttt{B}(u) -1) \cdot b \le s\). Recall that \(\texttt{B}(u) - \texttt{B}(v) -1\) denote the number of buckets between the bucket of u and the bucket of v. Our major goal now is to prove Lemma 5.1.
Lemma 5.1
Given a digraph D and positive integers b, s, there is an algorithm, that runs in time \(\min \{ \mathcal {O}^{\star }(4^n \cdot (\lceil {s+1}/{b} \rceil )^n), \mathcal {O}^{\star }(4^n \cdot (\lceil {s+1}/{b} \rceil )^{2(b+s )\log n}) \}\), and computes a b-bucketing of V(D), \(\texttt{B}: V(D) \rightarrow [\lceil {\vert V(D) \vert }/{b} \rceil ]\), of external stretch at most s.
We give a recursive algorithm for Lemma 5.1 (Algorithm 2). Since Algorithm 2 is recursive, the input of the algorithm will contain a few more things in addition to D, b, s to maintain the invariants at the recursive steps. We give the description of the input to Algorithm 2 in Definition 5.1.
Definition 5.1
(Legitimate input for Algorithm 2) The input \((D,b,s,\texttt {first},\texttt {last}, {\texttt {left}-\texttt {bor}}(V(D)), \texttt {right}-\texttt {bor}(V(D)), \texttt{B}_{in})\) is called legitimate for Algorithm 2 if the following holds. Let \(\delta = \lceil {s+1}/{b} \rceil \).
-
(P1)
D is a digraph, b, s are positive integers and \(\vert V(D) \vert =2^{\eta } \cdot b \cdot \delta \), where \(\eta \ge 0\) is a positive integer.
-
(P2)
\(\texttt {first}\) and \(\texttt {last}\) are positive integers such that \(\texttt {last}- \texttt {first}+ 1 =2^{\eta }\), where \(\eta \) is such that \(\vert V \vert = 2^{\eta } \cdot b\cdot \delta \).
-
(P3)
\({\texttt {left}-\texttt {bor}}(V(D)), \texttt {right}-\texttt {bor}(V(D)) \subseteq V(D)\),
-
(P4)
\(\texttt{B}_{in} : {\texttt {left}-\texttt {bor}}(V(D)) \cup \texttt {right}-\texttt {bor}(V(D)) \rightarrow [\texttt {first},\texttt {last}]\) is a partial b-bucketing such that for each \(v \in {\texttt {left}-\texttt {bor}}(V(D))\), \(\texttt{B}_{in}(v) \in [\texttt {first},\texttt {first}+\delta -1 ]\), for each \(v \in \texttt {right}-\texttt {bor}(V(D))\), \(\texttt{B}_{in}(v) \in [\texttt {last}-\delta +1,\texttt {last}]\) and the external stretch of \(\texttt{B}_{in}\) is at most s.
Observe that \(\delta -1\) represents the number of buckets that can appear between the buckets of u and v in any b-bucketing of external stretch at most s, where the bucket of u precedes the bucket of v and \((u,v) \in E(D)\). We would like to remark that the condition of (P1) is not serious as we could have worked without it. We state it like the way we do for the sake of notational and argumentative convenience in the proofs. All it states is that the number of vertices is a power of 2 multiplied by b and \(\delta \). The \(\texttt {first}\) and \(\texttt {last}\) in (P2) represents the bucket number of the first and last buckets in the bucketing to be outputted. The relation between \(\texttt {first}\) and \(\texttt {last}\) in (P2) is there to ensure that there are enough buckets to hold the vertices of D. At any recursive call, the sets \({\texttt {left}-\texttt {bor}}(V(D))\) and \(\texttt {right}-\texttt {bor}(V(D))\) represent the sets of vertices whose buckets have already been fixed in the previous recursive calls. The set \({\texttt {left}-\texttt {bor}}(V)\) represents the set of vertices in V that have an in-neighbour to the vertices that have been decided to be placed in the buckets before the bucket numbered \(\texttt {first}\) in the earlier recursive calls. Similarly, \(\texttt {right}-\texttt {bor}(V)\) represents the set of vertices in V that have an out-neighbour to the vertices that have been decided to be placed in the buckets after the bucket numbered \(\texttt {last}\) in the earlier recursive calls. Thus, in order to give the final bucketing of external stretch at most s, it is necessary that \({\texttt {left}-\texttt {bor}}(V)\) are placed in the first \(\delta \) buckets and \(\texttt {right}-\texttt {bor}(V)\) are placed in the last \(\delta \) buckets. This is captured in (P4). The next definition describes the properties of the bucketing that would be outputted by Algorithm 2.
Definition 5.2
(Look-out bucketing for a legitimate instance) Given a legitimate instance \(\mathcal {I}=(D,b,s,\texttt {first},\texttt {last}, {\texttt {left}-\texttt {bor}}(V(D)), \texttt {right}-\texttt {bor}(V(D)), \texttt{B}_{in})\), we say a bucketing \(\texttt{B}\) is a look-out bucketing for \(\mathcal {I}\), if \(\texttt{B}\) is a b-bucketing \(\texttt{B}_{out}: V \rightarrow [\texttt {first},\texttt {last}]\) of external stretch at most b that is consistent with \(\texttt{B}_{in}\).
Observe that, for the algorithm of Lemma 5.1, a call to Algorithm 2 on \((D,b,s,1, {\vert V \vert }/{b}, \emptyset , \emptyset , \phi )\) is enough. The formal proof of correctness for the same can be found in the Section 5.2. To give the formal description of Algorithm 2, we will use the following definition.
Definition 5.3
For any integers p, q and \(X' \subseteq X\), let \(\texttt{B}: X' \rightarrow [p,q]\) be a partial bucketing of \(X'\). Let \((X_1,X_2)\) be some partition of X. We say that \(\texttt{B}\) validates \((X_1,X_2)\) if the following holds. Let \(r=\lfloor {(p+q)}/{2} \rfloor \). For each \(v \in X_1 \cap X'\), \(\texttt{B}(v) \in [p,r]\) and for each \(v \in X_2 \cap X'\), \(\texttt{B}(v) \in [r+1,q]\).
For the formal description of Algorithm 2 refer to the pseudocode. We give the informal description of Algorithm 2 here. Also see Fig. 1. In a legitimate instance when the number of vertices is \(b \cdot \delta \), the number of buckets is \(\delta \). Recall that \(\delta = \lceil {s+1}/{b}\rceil \). Note that in this case, every b-bucketing of the vertex set has external stretch at most s. This is because the number of buckets between any two buckets is at most \(\delta -2\) and hence, the number of vertices that appear in the buckets between any two buckets is at most \((\delta -2) \cdot b \le s\).
When the number of vertices is larger, the algorithm first guesses which vertices will be assigned a bucket from the first half buckets of the final bucketing (this corresponds to the set L) and which will be assigned the last half (this corresponds to the set R). Since the final bucketing has to be consistent with \(\texttt{B}_{in}\), from the description of \(\texttt{B}_{in}\) in Definition 5.1, the vertices of \({\texttt {left}-\texttt {bor}}(V)\) should belong to the first half buckets and the vertices of \(\texttt {right}-\texttt {bor}(V)\) should belong to the last half buckets. Thus, the algorithm only considers those partitions (guesses) which \(\texttt{B}_{in}\) validates (Line 6).
Fix a guessed partition (L, R) of V. The set \(\texttt {bor}_L\) represents the set of vertices in L that have an out-neighbour in R. Similarly, the set \(\texttt {bor}_R\) represents the set of vertices in R with an in-neighbour in L. Since in any b-bucketing of external stretch at most s, the number of buckets that can appear between the buckets of the end points of a forward arc is at most \(\delta -1\), the vertices of \(\texttt {bor}_L\) can only be placed in the \(\delta \) buckets closest to the middle bucket and before it. Similarly, the vertices of \(\texttt {bor}_R\) can only be placed in the \(\delta \) buckets closest to the middle bucket and after it. The algorithm goes over all possible partial b-bucketings of these vertices in the described buckets, that are consistent with \(\texttt{B}_{in}\), and themselves have external stretch at most \(\delta \) (Line 9).
For a fixed partial b-bucketing enumerated above, the algorithm recursively finds a bucketing of the L vertices in the first half buckets and the bucketing of the R vertices in the last half buckets that is consistent with \(\texttt{B}_{in}\) and the partial b-bucketing of the \(\texttt {bor}_L\) and \(\texttt {bor}_R\) vertices guessed. This final bucketing is then obtained by combing the two bucketings from the two disjoint sub-problems (Lines 10 to 20).
The buckets of Algorithm 2. The rectangles denote the buckets; \(\texttt {mid}\) denote the middle bucket; \(\texttt {bor}_L\) are those vertices to the left of the middle bucket that have an arc to a vertex which is to the right of the middle bucket; \(\texttt {bor}_R\) are the vertices to the right of the middle bucket which have an arc from a vertex to the left of the middle bucket. In Line 9 of Algorithm 2 partial b-buckettings that assign \(\texttt {bor}_L\) to the red buckets and \(\texttt {bor}_L\) to the blue buckets are considered
Lemma 5.2
Algorithm 2 on a legitimate input \((D, b, s, \texttt {first}, \texttt {last}, {\texttt {left}-\texttt {bor}}(V), \texttt {right}-\texttt {bor}(V), B_{in})\), runs in time \(\min \{ \mathcal {O}^{{\star }}(4^n \cdot {\lceil {s+1}/{b} \rceil }^n), \mathcal {O}^{{\star }}(4^n \cdot {\lceil {s+1}/{b} \rceil }^{2(b+s) \log n}) \}\), and returns a look-out bucketing for \(\mathcal {I}\), if it exists.
Section 5.1 is dedicated to the proof of Lemma 5.2. Section 5.2 then summarizes the proofs of Lemma 5.1 and, Theorems 1.3 and 1.4.
5.1 Proof of Lemma 5.2
Lemma 5.3
Let \(\mathcal {I}=(D,b,s,\texttt {first}, \, \texttt {last}, \, {\texttt {left}-\texttt {bor}}(V(D)), \texttt {right}-\texttt {bor}(V(D)), \texttt{B}_{in})\) be a legitimate instance for Algorithm 2. If Algorithm 2 returns a bucketing, then it is a look-out bucketing for \(\mathcal {I}\).
Proof
Recall, from Line 1 of Algorithm 2 that \(V = V(D)\) and \(\delta =\lceil {s+1}/{b} \rceil \). Since \(\mathcal {I}\) is a legitimate instance of Algorithm 2, \(\vert V \vert = 2^{\eta } \cdot b \cdot \delta \), for some positive integer \(\eta \ge 0\). We prove the lemma by induction on \(\eta \). When \(\eta =0\), \(\vert V \vert = b \cdot \delta \). In this case, since the total number of buckets in the instance \(\mathcal {I}\) is \(\texttt {last}-\texttt {first}+1 = \delta \) (from (P2) of Definition 5.1), a b-bucketing of V always exists. Also, the external stretch of any b-bucketing is at most \((\delta -2) \cdot b \le s\). Thus, a look-out bucketing for \(\mathcal {I}\) always exists.
Henceforth, \(\eta >1\). Observe from the pseudo-code of Algorithm 2 that, it returns a bucketing only at Line 3 and at Line 20. Since \(\eta >1\), \(\vert V \vert > b \cdot \delta \), it remains to prove that the bucketing returned at Line 20 is a look-out bucketing for \(\mathcal {I}\). Observe, again from the pseudo-code of Algorithm 2, that a bucketing is returned at Line 20 only when the following conditions hold.
-
1.
At Line 6 there exists a partition, say (L, R) of V, such that \(\vert L \vert = \vert R \vert \), \(\texttt{B}_{in}\) validates (L, R).
-
2.
During the run of the iteration of for loop at Line 6 for the (L, R) described above, at Line 10 there exists \(\texttt{B} \in \mathcal {B}\) such that the instances \(\mathcal {I}_L^{\texttt{B}}\) and \(\mathcal {I}_R^{\texttt{B}}\) defined at Lines 16 and 17 are legitimate and, \(Algorithm~2(\mathcal {I}_L^{\texttt{B}})\) \(!=\) NO and \(Algorithm~2 (\mathcal {I}_R^{\texttt{B}})\) \(!=\) NO.
Let \(\texttt{B}_{out}^L =Algorithm~2(\mathcal {I}_L^{\texttt{B}})\) and \(\texttt{B}_{out}^R =Algorithm~2(\mathcal {I}_L^{\texttt{B}})\). Since \(\vert L \vert = \vert R \vert \) and \(\vert V \vert = 2^{\eta } \cdot b \cdot \delta \), we have that \(\vert L \vert = \vert R \vert =2^{\eta -1} \cdot b \cdot \delta \). Thus, from the induction hypothesis, \(\texttt{B}_{out}^L\) is a look-out bucketing for \(\mathcal {I}_L^{\texttt{B}}\) and \(\texttt{B}_{out}^R\) is a look-out bucketing for \(\mathcal {I}_R^{\texttt{B}}\). We remain to show that \(\texttt{B}_{out} = \texttt{B}_{out}^L \cup \texttt{B}_{out}^R\) is a look-out bucketing for \(\mathcal {I}\). We prove this below.
-
Bucketing:
Since \(\texttt{B}_{out}^L: L \rightarrow [\texttt {first},\texttt {mid}]\) and \(\texttt{B}_{out}^R: R \rightarrow [\texttt {mid}+1,\texttt {last}]\) are b-bucketings, and \(L \cap R = \emptyset \), \(L \cup R =V\), \([\texttt {first},\texttt {mid}] \cap [\texttt {mid}+1,\texttt {last}] = \emptyset \) and \([\texttt {first},\texttt {mid}] \cup [\texttt {mid}+1,\texttt {last}] = [\texttt {first},\texttt {last}]\), \(\texttt{B}_{out}: V \rightarrow [\texttt {first},\texttt {last}]\) is a b-bucketing of V.
-
Consistent:
We now prove that \(\texttt{B}_{out}\) is consistent with \(\texttt{B}_{in}\). Since \(\mathcal {I}\) is a legitimate instance, from (P4) of Definition 5.1, for each \(v \in {\texttt {left}-\texttt {bor}}(V)\), \(\texttt{B}_{in}(v) \in [\texttt {first},\texttt {first}+\delta -1]\) and for each \(v \in \texttt {right}-\texttt {bor}(V)\), \(\texttt{B}_{in}(v) \in [\texttt {last}-\delta +1,\texttt {last}]\). Since \(\mathcal {I}_L^{\texttt{B}}\) and \(\mathcal {I}_R^{\texttt{B}}\) are legitimate instances, \({\texttt {left}-\texttt {bor}}(L) \subseteq L\) and \(\texttt {right}-\texttt {bor}(R) \subseteq R\). Also, for each \(v \in {\texttt {left}-\texttt {bor}}(L)\), \(\texttt{B}_{in}^{newL}(v) \in [\texttt {first}, \texttt {first}+\delta -1]\) and for each \(v \in \texttt {right}-\texttt {bor}(R)\), \(\texttt{B}_{in}^{newR}(v) \in [\texttt {last}-\delta +1,\texttt {last}]\). Since \(\texttt{B}_{out}^{L}\) (respectively \(\texttt{B}_{out}^{R}\)) is a look-out bucketing for \(\mathcal {I}_L^{\texttt{B}}\) (respectively \(\mathcal {I}_R^{\texttt{B}}\)), \(\texttt{B}_{out}^{L}\) (respectively \(\texttt{B}_{out}^{R}\)) is consistent with \(\texttt{B}_{in}^{newL}\) (respectively \(\texttt{B}_{in}^{newR}\)). Since, \(\texttt{B}_{out} = \texttt{B}_{out}^L \cup \texttt{B}_{out}^R\), and \({\texttt {left}-\texttt {bor}}(L) = {\texttt {left}-\texttt {bor}}(V)\) and \(\texttt {right}-\texttt {bor}(R) = \texttt {right}-\texttt {bor}(V)\) (from the construction in Lines 14 and 15), we have that, for \(v \in {\texttt {left}-\texttt {bor}}(V)\), \(\texttt{B}_{out}(v) \in [\texttt {first}, \texttt {first}+\delta -1]\) and \(v \in \texttt {right}-\texttt {bor}(V)\), \(\texttt{B}_{out}(v) \in [\texttt {first}+\delta -1,\texttt {last}]\). Thus, \(\texttt{B}_{out}\) is consistent with \(\texttt{B}_{in}\).
-
External Stretch:
Consider any arc \((u,v) \in E(D)\).
-
(a)
If \(u,v \in L\) (respectively \(u,v \in R\)), then since \(\texttt{B}_{out} = \texttt{B}_{out}^L \cup \texttt{B}_{out}^R\) and the external stretch of \(\texttt{B}_{out}^L\) (respectively \(\texttt{B}_{out}^R\)) is at most s, we have that either \(\texttt{B}_{out}(u) \ge \texttt{B}_{out}(v)\) or \((\texttt{B}_{out}(v) - \texttt{B}_{out}(u) -1) \cdot b\le s\).
-
(b)
If \( u\in R\) and \(v \in L\), then since \(\texttt{B}_{out} =\texttt{B}_{out}^L \cup \texttt{B}_{out}^R\), \(\texttt{B}_{out}(u) \ge \texttt{B}_{out}(v)\).
-
(c)
If \(u \in L\) and \(v \in R\). In this case, first observe, from the construction of \(\texttt {bor}_L\) and \(\texttt {bor}_R\) in Lines 7 and 8 of Algorithm 2, that \(u \in \texttt {bor}_L\) and \(v \in \texttt {bor}_R\). Since \(\texttt{B} \in \mathcal {B}\) (from Line 10), from Line 9, \(\texttt{B}\) is a partial b-bucketing of \(\texttt {bor}_L\cup \texttt {bor}_R\) of external stretch at most s and \(\texttt{B}(u) < \texttt{B}(v)\), therefore, \((\texttt{B}(v) - \texttt{B}(u) -1) \cdot b\le s\). Since \(\texttt{B}\) is consistent with \(\texttt{B}_{in}\) (from Line 9), and \(\texttt{B}_{in}\) is consistent with \(\texttt{B}_{out}\) (as proved above), we conclude that \((\texttt{B}_{out}(v) - \texttt{B}_{out}(u) -1) \cdot b \le s\). \(\square \)
Lemma 5.4
Let \(\mathcal {I}=(D,b,s, \texttt {first}, \texttt {last},{\texttt {left}-\texttt {bor}}(V(D)), \texttt {right}-\texttt {bor}(V(D)), \texttt{B}_{in})\) be a legitimate instance for Algorithm 2 such that a look-out bucketing for \(\mathcal {I}\) exists. Then, on input \(\mathcal {I}\), Algorithm 2 does not return NO.
Proof
Recall that \(V = V(D)\) and \(\delta = \lceil {s+1}/{b} \rceil \). Since \(\mathcal {I}\) is a legitimate instance, \(\vert V \vert = 2^{\eta } \cdot b \cdot \delta \), \(\eta \ge 0\) is a positive integer. We prove this lemma by induction on \(\eta \). When \(\eta =0\), Algorithm 2 always returns a look-out bucketing of \(\mathcal {I}\) (Line 3). Henceforth, \(\eta \ge 1\). From the pseudo-code of Algorithm 2, to prove the lemma it is enough to prove the following.
-
1.
There exists a partition of \(V= (L,R)\), \(\vert L \vert = \vert R \vert \) such that \(\texttt{B}_{in}\) validates (L, R),
-
2.
The family \(\mathcal {B}\) constructed at Line 9 (during the iteration of the for loop at Line 6 for (L, R)) contains a \(\texttt{B}\) such that the following holds.
-
(Q1)
\(\texttt{B}\) is a partial b-bucketing of \(\texttt {bor}_L\cup \texttt {bor}_R\), \(\texttt{B}: \texttt {bor}_L\cup \texttt {bor}_R\rightarrow [\texttt {mid}-\delta +1,\texttt {mid}+\delta ]\),
-
(Q2)
For each \(v\in \texttt {bor}_L\), \(\texttt{B}(v) \in [\texttt {mid}-\delta +1,\texttt {mid}]\) and for each \(v \in \texttt {bor}_R\), \(\texttt{B}(v) \in [\texttt {mid}+1,\texttt {mid}+\delta ]\),
-
(Q3)
the external stretch of \(\texttt{B}\) is at most s,
-
(Q4)
\(\texttt{B}\) is consistent with \(\texttt{B}_{in}\),
-
(Q5)
The instances \(\mathcal {I}_L^{\texttt{B}}\) and \(\mathcal {I}_R^{\texttt{B}}\) defined at Lines 16 and 17 are legitimate, and
-
(Q6)
\(Algorithm~2(\mathcal {I}_L^{\texttt{B}})\) \(!=\) NO, and \(Algorithm~2 (\mathcal {I}_R^{\texttt{B}})\) \(!=\) NO.
Proof
Let \(\texttt{B}_{opt}: V \rightarrow [\texttt {first},\texttt {last}]\) be a look-out bucketing for \(\mathcal {I}\). Let \(\texttt {mid}= {(\texttt {first}+\texttt {last}-1)}/{2}\). Since \(\mathcal {I}\) is a legitimate instance, from (P2) of Definition 5.1, \(\texttt {last}- \texttt {first}+ 1 =2^{\eta } \cdot \delta \). Therefore, \( \texttt {mid}={(\texttt {first}+\texttt {last}-1)}/{2} = \texttt {first}+ 2^{\eta -1} \cdot \delta -1\). Thus, \(\texttt {mid}\) is an integer. Let \(L = \bigcup _{i \in [\texttt {mid}]} \texttt{B}_{opt}^{-1}(i)\) and \(R = \bigcup _{i \in [\texttt {mid}+1,\texttt {last}]} \texttt{B}_{opt}^{-1}(i)\). Clearly, (L, R) is a partition of V. Also, \(\vert L \vert = \vert R \vert \) because \(\texttt{B}_{opt}\) is a b-bucketing of V and \(\vert V \vert \) is divisible by b.
Claim 5.1
\(\texttt{B}_{in}\) validates (L, R).
Proof
Since \(\mathcal {I}\) is a legitimate instance, from (P4) of Definition 5.1, for each \(v \in {\texttt {left}-\texttt {bor}}(V)\), \(\texttt{B}_{in}(v) \in [\texttt {first}, \texttt {first}+ \delta -1]\) and for each \(v \in \texttt {right}-\texttt {bor}(V)\), \(\texttt{B}_{in}(v) \in [\texttt {last}- \delta +1, \texttt {last}]\).
From (P2) of Definition 5.1, \(\texttt {last}- \texttt {first}+ 1= 2^{\eta } \cdot \delta \). Since \(\eta \ge 1\) and \(\texttt {mid}= {(\texttt {first}+ \texttt {last}-1)}/{2}\), we have that \(\texttt {first}+ \delta -1 \le \texttt {mid}< \texttt {last}- \delta +1\). Since \(\texttt{B}_{opt}\) is consistent with \(\texttt{B}_{in}\), from the description of \(\texttt{B}_{in}\) in (P4) of Definition 5.1, and from the construction of L and R, we have that, for each \(v \in {\texttt {left}-\texttt {bor}}(V)\), \(v \in L\) and for each \(v \in \texttt {right}-\texttt {bor}(V)\), \(v \in R\). Thus, \(\texttt{B}_{in}\) validates (L, R).\(\square \)
Consider the execution of Lines 7 to 9 during the iteration of the for loop for the (L, R) constructed above. Consider the sets \(\texttt {bor}_L= \{v \in L \mid \text { there exists } u \in R \text { such that } (v,u) \in E(D)\}\) and \(\texttt {bor}_R= \{v \in R \mid \text { there exists } u \in L \text { such that } (u,v) \in E(D)\}\).
Claim 5.2
For each \(v \in \texttt {bor}_L\), \(\texttt {mid}- \delta +1 \le \texttt{B}_{opt}(v) \le \texttt {mid}\), and for each \(v \in \texttt {bor}_R\), \(\texttt {mid}+1 \le \texttt{B}_{opt}(v) \le \texttt {mid}+ \delta \).
Proof
From the construction of L and R and the fact that \(\texttt {bor}_L\subseteq L\) and \(\texttt {bor}_R\subseteq R\), we have that, for each \(v \in \texttt {bor}_L\), \(\texttt{B}_{opt}(v) \le \texttt {mid}\), and for each \(v \in \texttt {bor}_R\), \(\texttt{B}_{opt}(v) \ge \texttt {mid}+1\). We now prove that for each \(v \in \texttt {bor}_L\), \(\texttt{B}_{opt}(v) \ge \texttt {mid}- \delta +1\). The proof of \(\texttt{B}_{opt}(v) \le \texttt {mid}+\delta \) for \(v \in \texttt {bor}_R\) follows using symmetric arguments.
Let \(\texttt{B}_{opt}(v)=i\). Suppose, for the sake of contradiction, that \(i \le \texttt {mid}- \delta \). Since \(v \in \texttt {bor}_L\), there exists \(u \in R\) such that \((v,u) \in E(D)\). Let \(\texttt{B}_{opt}(u) =j\). Since \(u \in R\), \(j \ge \texttt {mid}+1\). Since the external stretch of \(\texttt{B}_{opt}\) is at most s and \(\texttt{B}_{opt}(u) < \texttt{B}_{opt}(v)\), we have that \((j-i-1) \cdot b \le s\). Since \(i \le \texttt {mid}- \delta \) and \(j \ge \texttt {mid}+1\), we have that \((j-i -1) \ge \delta \). Thus, we have that \(\delta \cdot b \le s\), that is \(\lceil {s+1}/{b} \rceil \cdot b \le s\), which is a contradiction. \(\square \)
Define a partial b-bucketing \(\texttt{B}: \texttt {bor}_L\cup \texttt {bor}_R\rightarrow [\texttt {mid}- \delta +1, \texttt {mid}+ \delta ]\) as follows: for each \(v \in \texttt {bor}_L\cup \texttt {bor}_R\), \(\texttt{B}(v) = \texttt{B}_{opt}(v)\). Then Claim 5.2 proves 5.1 and 5.1. Since, the stretch of \(\texttt{B}_{opt}\) is at most s and \(\texttt{B}_{opt}\) is consistent with \(\texttt{B}_{in}\), from the construction of \(\texttt{B}\), 5.1 and 5.1 follow. Consider the execution of the for loop at Line 10 for the partial bucketing \(\texttt{B}\) constructed above. Let \(\mathcal {I}_L^{\texttt{B}}\) and \(\mathcal {I}_R^{\texttt{B}}\) be the instances as constructed at Lines 16 and 17 respectively.
Claim 5.3
\(\mathcal {I}_L^{\texttt{B}}\) and \(\mathcal {I}_R^{\texttt{B}}\) are legitimate instances of Algorithm 2.
Proof
We will prove the claim for \(\mathcal {I}_L^{\texttt{B}}\). The claim for \(\mathcal {I}_R^{\texttt{B}}\) follows from symmetric arguments. Recall that \(\mathcal {I}_L^{\texttt{B}} = (D[L],b,s,\texttt {first},\texttt {mid},{\texttt {left}-\texttt {bor}}(L), \texttt {right}-\texttt {bor}(L), \texttt{B}_{in}^{newL})\). The following points prove that \(\mathcal {I}_L^{\texttt{B}}\) is a legitimate instance.
-
1.
Since \(\vert V \vert = 2^{\eta } \cdot b \cdot \delta \), \(\eta \ge 1\) and \(\vert L \vert = {\vert V \vert }/{2}\), \(\vert L \vert = 2^{\eta -1} \cdot b \cdot \delta \).
-
2.
Since \(\mathcal {I}\) is a legitimate instance, from (P2) of Definition 5.1, we have that \(\texttt {last}- \texttt {first}+ 1 = 2^{\eta } \cdot \delta \). Since, \(\texttt {mid}= {(\texttt {first}+\texttt {last}-1)}/{2}\), we have that \(\texttt {mid}-\texttt {first}+ 1 =2^{\eta -1} \cdot \delta \).
-
3.
Recall the construction of \({\texttt {left}-\texttt {bor}}(L)\) and \(\texttt {right}-\texttt {bor}(L)\) from Line 14: \({\texttt {left}-\texttt {bor}}(L) = {\texttt {left}-\texttt {bor}}(V)\) and \(\texttt {right}-\texttt {bor}(L) = \texttt {bor}_L\). Since \({\texttt {left}-\texttt {bor}}(V) \subseteq L\) because \(\texttt{B}_{in}\) validates (L, R), and \(\texttt {bor}_L\subseteq L\) by definition, we have that \({\texttt {left}-\texttt {bor}}(L), \texttt {right}-\texttt {bor}(L) \subseteq L\).
-
4.
Recall, from Lines 11 and 12, that \(\texttt{B}_{in}^{newL} = {\texttt{B}_{in}^{new}}_{\vert L}\), where \(\texttt{B}_{in}^{new}= \texttt{B} \cup \texttt{B}_{in}\). First note that, since \(\texttt{B}\) is a function from \(\texttt {bor}_L\cup \texttt {bor}_R\), \(\texttt{B}_{in}\) is a function from \({\texttt {left}-\texttt {bor}}(V) \cup \texttt {right}-\texttt {bor}(V)\) and \({\texttt {left}-\texttt {bor}}(L) ={\texttt {left}-\texttt {bor}}(V)\), \(\texttt {right}-\texttt {bor}(L) =\texttt {bor}_L\), we have that \(\texttt{B}_{in}^{newL}\) is a function from \({\texttt {left}-\texttt {bor}}(L) \cup \texttt {right}-\texttt {bor}(L)\). Since \(\texttt{B}\) is consistent with \(\texttt{B}_{opt}\) (from the construction of \(\texttt{B}\)) and \(\texttt{B}_{in}\) is consistent with \(\texttt{B}_{opt}\) (because \(\texttt{B}_{opt}\) is a look-out bucketing for \(\mathcal {I}\)), we have that \(\texttt{B}_{in}^{new}= \texttt{B} \cup \texttt{B}_{in}\) is consistent with \(\texttt{B}_{opt}\). Thus, since \(\texttt{B}_{opt}\) is a b-bucketing of V and has external stretch at most s, we have that the \(\texttt{B}_{in}^{newL}\) is a partial b-bucketing and has external stretch at most s. Also, since \(\texttt{B}_{in}^{newL}\) is consistent with \(\texttt{B}_{in}\) and \({\texttt {left}-\texttt {bor}}(L) = {\texttt {left}-\texttt {bor}}(V)\), we have that for each \(v \in {\texttt {left}-\texttt {bor}}(L)\), \(\texttt{B}_{in}^{newL}(v) \in [\texttt {first}, \texttt {first}+ \delta -1]\). Similarly, since \(\texttt{B}_{in}^{newL}\) is consistent with \(\texttt{B}\), \(\texttt {right}-\texttt {bor}(L) = \texttt {bor}_L\) and for each \(v \in \texttt {bor}_L\), \(\texttt{B}(v) \in [\texttt {mid}-\delta +1,\texttt {mid}]\), we have that, for each \(v \in \texttt {right}-\texttt {bor}(L)\), \(\texttt{B}_{in}^{newL}(v) \in [\texttt {mid}-\delta +1,\texttt {mid}]\). This proves that \(\texttt{B}_{in}^{newL}\) satisfies (P4) of Definition 5.1. \(\square \)
Claim 5.4
\(Algorithm~{2}\ (\mathcal {I}_L^{\texttt{B}})\) \( != \) NO and \(Algorithm~2(\mathcal {I}_R^{\texttt{B}}) \) \(!= \) NO.
Proof
We will prove the claim for \(\mathcal {I}_L^{\texttt{B}}\). The claim for \(\mathcal {I}_R^{\texttt{B}}\) follows from symmetric arguments. We will now show that \({\texttt{B}_{opt}}_{\vert L}\) is a look-out bucketing of \(\mathcal {I}_L^{\texttt{B}}\). The proof of the claim then follows from induction hypothesis.
Since \(\mathcal {B}_{opt}\) is a b-bucketing, so is \({\texttt{B}_{opt}}_{\vert L}\). From the construction of L, \({\texttt{B}_{opt}}_{\vert L}: L \rightarrow [\texttt {first},\texttt {mid}]\). Since \(\texttt{B}_{in}^{newL}= {\texttt{B}_{in}^{new}}_{\vert L}\), where \(\texttt{B}_{in}^{new}= \texttt{B} \cup \texttt{B}_{in}\), and \(\texttt{B}_{out}\) is consistent with \(\texttt{B}_{in}\) and \(\texttt{B}\), we conclude that \({\texttt{B}_{opt}}_{\vert L}\) is consistent with \(\texttt{B}_{in}^{newL}\). Since the external stretch of \(\texttt{B}_{opt}\) is at most s, so is the external stretch of \({\texttt{B}_{opt}}_{\vert L}\).\(\square \)
Claims 5.3 and 5.4 prove 5.1 and 5.1. This finishes the proof of the lemma.\(\square \)
Lemma 5.5
On a legitimate input \((D, b, s, \texttt {first}, \texttt {last}, {\texttt {left}-\texttt {bor}}(V(D)), \texttt {right}-\texttt {bor}(V(D)), \texttt{B}_{in})\), Algorithm 2 returns a look-out bucketing for \(\mathcal {I}\), if it exists.
Proof
The proof follows from Lemma 5.3 and 5.4.\(\square \)
Lemma 5.6
Algorithm 2 on a legitimate input \((D,b,s,\texttt {first},\texttt {last},{\texttt {left}-\texttt {bor}}(V),\texttt {right}-\texttt {bor}(V), B_{in})\), runs in time \(\min \{ \mathcal {O}^{{\star }}(4^n \cdot {\lceil {s+1}/{b} \rceil }^n),\mathcal {O}^{{\star }}(4^n \cdot {\lceil {s+1}/{b} \rceil }^{2(b+s) \log n}) \}\), where n is the number of vertices of D.
Proof
Recall that \(\delta = \lceil {s+1}/{b} \rceil \). We begin by analysing the size and the time taken to compute the family \(\mathcal {B}\) at Line 9 for a fixed partition (L, R) of V. For this, we can safely assume that \(\vert V \vert = 2^{\eta } \cdot b \cdot \delta \) where \(\eta \ge 1\). Recall that \(\texttt{B}_{in}: {\texttt {left}-\texttt {bor}}(V) \cup \texttt {right}-\texttt {bor}(V) \rightarrow [\texttt {first},\texttt {last}]\). Let \(b_L= \vert \texttt {bor}_L\setminus {\texttt {left}-\texttt {bor}}(V) \vert \) and let \(b_R = \vert \texttt {bor}_R\setminus \texttt {right}-\texttt {bor}(V) \vert \). Observe that the number of functions from \(\texttt {bor}_L\cup \texttt {bor}_R\) that map each vertex of \(\texttt {bor}_L\) in the range \([\texttt {mid}- \delta +1,\texttt {mid}]\) and map each vertex of \(\texttt {bor}_R\) in the range \([\texttt {mid}+1,\texttt {mid}+\delta ]\) and are consistent with \(\texttt{B}_{in}\) is \(\delta ^{b_L} \cdot \delta ^{b_R}\). Thus, the size of the family \(\mathcal {B}\) at the iteration of the for loop at Line 6 corresponding to (L, R) is at \(\delta ^{b_L} \cdot \delta ^{b_R}\). Also, the time taken to compute such a family is \(\mathcal {O}(\delta ^{b_L} \cdot \delta ^{b_R})\).
Since \(\mathcal {I}\) is a legitimate instance, from (P2) in Definition 5.1, \(\texttt {last}- \texttt {first}+ 1 = 2^{\eta } \cdot b\cdot \delta \). Since \(\eta \ge 1\), we have that \(\texttt {first}+ \delta -1 < \texttt {last}- \delta +1\). Thus, from (P4) of Definition 5.1, \({\texttt {left}-\texttt {bor}}(V) \cap \texttt {right}-\texttt {bor}(V) = \emptyset \).
Again, for a fixed partition (L, R) of V considered during an iteration of the for loop at Line 6, consider the instances \(\mathcal {I}_L^{\texttt{B}}\) and \(\mathcal {I}_R^{B}\) constructed at Lines 16 and 17, for any \(\texttt{B} \in \mathcal {B}\) at Line 10. Let \(\mathcal {I}\) be the input instance. Let us denote by u the number of vertices that are not in \({\texttt {left}-\texttt {bor}}(V) \cup \texttt {right}-\texttt {bor}(V)\), that is, \(u = \vert V(D) \setminus ({\texttt {left}-\texttt {bor}}(V) \cup \texttt {right}-\texttt {bor}(V))\vert \). We call these vertices the unplaced vertices for \(\mathcal {I}\). Similarly, let \(u_L\) (respectively \(u_R\)) denote the number of unplaced vertices for \(\mathcal {I}_L^{\texttt{B}}\) (respectively \(\mathcal {I}_R^{\texttt{B}}\)), that is \(u_L = \vert L \setminus ({\texttt {left}-\texttt {bor}}(L) \cup \texttt {right}-\texttt {bor}(L))\vert \) (respectively \(u_R = \vert R \setminus ({\texttt {left}-\texttt {bor}}(R) \cup \texttt {right}-\texttt {bor}(R))\vert \)). \(\square \)
Claim 5.5
\(u = u_L + u_R + b_L + b_R\).
Proof
For ease of notation, let \(x_1 = \vert {\texttt {left}-\texttt {bor}}(V) \vert \) and let \(x_2 = \vert \texttt {right}-\texttt {bor}(V) \vert \). Since \({\texttt {left}-\texttt {bor}}(V) \cap \texttt {right}-\texttt {bor}(V) = \emptyset \), we have that \(u = \vert V \vert - (x_1 + x_2)\). Also, \(u_L = \vert L \vert - (b_L + x_1)\) and \(u_R = \vert R \vert - (b_R + x_2)\). Since \(\vert V \vert = \vert L \vert + \vert R \vert \) (because \(\vert V \vert \) is a power of 2 and (L, R) is a partition of V), we have that \(u = u_L + u_R + b_L + b_R\).
Running time analysis 1: We are now equipped to analyse the running time of Algorithm 2. Let T(n, u) denote the time taken by Algorithm 2 on input \(\mathcal {I}\), where the number of vertices in the digraph in the instance is n and the number of unplaced vertices is u. In the following, c is some fixed constant. From Lines 2 to 4, we have that \(T(b \cdot \delta ) \le c\). Since the time taken to execute Lines 7 to 9 is at most \(\mathcal {O}(\vert \mathcal {B} \vert + n)\le c \cdot ( \vert \mathcal {B} \vert +n)\), and for a fixed partition (L, R), \(\vert \mathcal {B} \vert \le \delta ^{b_L + b_R}\), we have the following recurrence.
By induction on n, we can prove that for any \(u \le n\), \(T(n,u) =\mathcal {O}^{\star }(4^n \cdot \delta ^{n})\).
Running time analysis 2: One can do the running time analysis of the algorithm a little differently to get a different running time. The crucial point of this analysis is the fact that in each iteration of the for loop at Line 6, if the set constructed at Line 9 is not empty, that is the for loop at Line 10 is executed, then the sizes of the sets \(\texttt {bor}_L\) and \(\texttt {bor}_R\) are bounded. This is formalized below.
Claim 5.6
Consider any arbitrary iteration of the for loop at Line 6. Let (L, R) be the partition considered during this iteration. Then if \(\mathcal {B} \ne \emptyset \), then \(\vert \texttt {bor}_L\vert , \vert \texttt {bor}_R\vert \le b+s\).
Proof
For the sake of contradiction, suppose that \(\vert \texttt {bor}_L\vert > b+s-1\) (symmetric arguments hold for bounding the size of \(\texttt {bor}_R\)). Since \(\mathcal {B} \ne \emptyset \), there exists a b-bucketing \(\texttt{B}: \texttt {bor}_L\cup \texttt {bor}_R\rightarrow [\texttt {mid}- \delta +1,\texttt {mid}+\delta ]\) such that for each \(v \in \texttt {bor}_L\), \(\texttt{B}(v) \in [\texttt {mid}-\delta +1,\texttt {mid}]\) and for each \(v \in \texttt {bor}_R\), \(\texttt{B}(v) \in [\texttt {mid}+1, \texttt {mid}+\delta ]\). Let \(v \in \texttt {bor}_L\) be the vertex such that \(\texttt{B}(v)\) is minimum. Let \(\texttt{B}=i\). Then all the vertices of \(\texttt {bor}_L\) appear in the buckets numbered i to \(\texttt {mid}\). Since \(v \in \texttt {bor}_L\), there exists a vertex \(u \in R\) such that \((v,u) \in E(D)\), and the external stretch of \(\texttt{B}\) is at most s, the number of vertices that appear in the buckets numbered from \(i+1\) to \(\texttt {mid}\) is at most s. Since the size of each bucket is b, the total number of vertices that appear in the buckets numbered between i and \(\texttt {mid}\) is at most \(b+s\). Thus, the size of the set \(\texttt {bor}_L\) is at most \(b+s\).\(\square \)
Since an alternate (and easier) bound on the size of the family \(\mathcal {B}\) constructed at Line 9 is \(\delta ^{\vert \texttt {bor}_L\vert + \vert \texttt {bor}_R\vert }\), from Claim 5.6, we conclude that \(\vert \mathcal \vert \le \delta ^{2(b+s)}\). Let T(n) denote the time taken by the algorithm to solve an instance \(\mathcal {I}\) where the digraph has n vertices. Let c be some fixed constant. Then, we have the following recurrence.
By induction on n, one can prove that \(T(n) = \mathcal {O}^{\star }(4^n \cdot \delta ^{2(b+s) \cdot \log n})\).\(\square \)
Proof
The proof of the lemma follows from Lemmas 5.5 and 5.6.\(\square \)
5.2 Proofs of Lemma 5.1 and Theorems 1.3 and 1.4
Proof of Lemma 5.1. Given a digraph D and positive integers b, s, create an instance \(\mathcal {I}=(D,b,s,1, {\vert V \vert }/{b}, \emptyset , \emptyset , \phi )\). Note that if \(\vert V \vert = 2^{\eta } \cdot b \cdot \delta \), where \(\delta = \lceil {s+1}{b}\rceil \) and \(\eta \ge 0\), then clearly \(\mathcal {I}\) is a legitimate instance of Algorithm 2 and the proof of the lemma follows from Lemmas 5.5 and 5.6. In the other case, when the number of vertices is not as described above, then it is not difficult to see that an additional set of isolated vertices (at most the same number as the original number of vertices) can be added to the digraph without changing the solution or the running time of Algorithm 2 (beyond a multiplicative factor of 2).\(\square \)
Lemma 5.1 forms the basis of the proofs of both Theorem 1.4 and Theorem 1.3. We give the proofs of these theorems below.
Proof of Theorem 1.4 Let (D, b) be an instance of Digraph Bandwidth. Then run the algorithm of Lemma 5.1 on the instance where the digraph is D, the bucket size is 1 and the external stretch is \(b-1\). The algorithm of Lemma 5.1 then returns a 1-bucketing of V(D) of external stretch at most \(b-1\), if it exists. Observe that such a bucketing of V(D) is also an ordering of V(D) of directed bandwidth at most b, and vice-versa. Thus, the proof of the theorem follows from Lemma 5.1.
We now ready to prove Theorem 1.3.
Lemma 5.7
Let D be a digraph, b be a positive integer and \(\epsilon >0\) be a real. Then, there is an algorithm, that given \((D,b,\epsilon )\), runs in time \(\mathcal {O}^{{\star }}(4^n \cdot (\lceil {4}/{\epsilon } \rceil )^n)\), and either concludes that the directed bandwidth of D is strictly greater than b, or outputs an ordering whose directed bandwidth is at most \((1+\epsilon ) \cdot b\).
Proof
If \(b < {4}/{\epsilon }\), run the algorithm of Theorem 1.4 on the instance (D, b). Note that it takes time \(\mathcal {O}^{\star }{4^n \cdot (\lceil {4}/{\epsilon } \rceil )^n}\). Henceforth, we are in the case when \(b \ge {4}/{\epsilon }\). Let \(b' = \lfloor {b \epsilon }/{2} \rfloor \). Then use the algorithm of Lemma 5.1 on the instance containing the digraph D, bucket size \(b'\) and external stretch \(b-1\). Note that, \(\lceil {b}/{\lfloor b' \rfloor } \rceil \le \lceil {4}/{\epsilon }\rceil \), whenever \(b \ge \lceil {4}/{\epsilon } \rceil \). We now prove that if D has directed bandwidth at most b, then the algorithm of Lemma 5.1 does not report NO.
Claim 5.7
If the directed bandwidth of D is at most b, then there is a \(b'\)-bucketing of V(D) of external stretch at most \(b-1\).
Proof
Let \(\sigma \) be an ordering of D of directed bandwidth at most b. Consider the unique \(b'\)-bucketing induced by \(\sigma \), say \(\texttt{B}\). We show that the external stretch of \(\texttt{B}\) is at most \(b-1\). For this, consider any arc \((u,v) \in E(D)\) such that \(\texttt{B}(u) < \texttt{B}(v)\). Then, \(\sigma (u) < \sigma (v)\). Let \(\texttt{B}(u)=i\) and \(\texttt{B}(v) =j\). For the sake of contradiction, suppose that \((j-i-1)\cdot b' \ge b\). From the construction of \(\texttt{B}\), we have that \(\sigma (u) \in [(i-1) \cdot b', i \cdot b]\) and \(\sigma (v) \in [(j-1) \cdot b', j \cdot b]\). Thus, \(\sigma (v) - \sigma (u) -1 \ge (j-i-1) \cdot b' \ge b\), that is, \(\sigma (v) - \sigma (u) \ge b+1\), which contradicts that the directed bandwidth of \(\sigma \) is at most b.\(\square \)
Proof
Thus, from Claim 5.7, we conclude that, if the algorithm of Lemma 5.1 reports NO, then the directed bandwidth of D is strictly greater than b. Otherwise, let \(\texttt{B}_{out}\) be the b-bucketing outputted by the algorithm of Lemma 5.1. For each \(i \in [1, \texttt{B}{\vert V \vert }{b'}]\), let \(\sigma ^i\) be some ordering of \(\texttt{B}_{out}^{-1}(i)\). Let \(\sigma = \sigma ^1 \cdot \ldots \cdot \sigma ^{{ns}/{b}}\).
Claim 5.8
The bandwidth of \(\sigma \) is at most \((1+\epsilon ) \cdot b\).
Proof
Consider any arc \((u,v) \in E(D)\) such that \(\sigma (u) < \sigma (v)\). Let \(\texttt{B}_{out}(u) =i\) and \(\texttt{B}_{out}(v) =j\). Then \(\sigma (v) - \sigma (u) \le (j-i-1) \cdot b' + \vert \texttt{B}_{out}^{-1}(i) \vert + \vert \texttt{B}_{out}^{-1}(i) \vert \). Since, the external stretch of \(\texttt{B}\) is at most \(b-1\), we have that \((j-i-1) \cdot b' \le b\). Thus, \(\sigma (v) - \sigma (u) \le b + 2 \cdot b' = b + 2 \cdot \lfloor {b \cdot \epsilon }/{2} \rfloor \le b + b \cdot \epsilon = (1+\epsilon ) \cdot b\).
This proves the lemma.\(\square \)
Proof of Theorem 1.3 Recall D is the input digraph and \(\epsilon >0\) is a real. We initial \(b=0\). Then run the algorithm of Lemma 5.7 on the instance \((D,b,\epsilon )\). If the algorithm outputs an ordering then we output the same ordering, otherwise we increment b by 1 are repeat this procedure. Let OPT denote the directed bandwidth of D. Then, for some \(b \le OPT\), algorithm of Lemma 5.7 returns an ordering whose bandwidth is at most \((1+ \epsilon ) \cdot b \le (1+ \epsilon ) \cdot OPT\). This proves the theorem.
6 Exact Algorithm for Digraph Bandwidthvia Directed Homomorphisms
The goal of this section is to prove Theorem 1.5. Towards this, we give a reduction from Digraph Bandwidthto a subgraph homomorphism problem for digraphs. Given two digraphs D and H, a directed homomorphism from D to H is a function \(h: V(D) \rightarrow V(H)\), such that if \((u,v) \in E(D)\), then \((h(u),h(v)) \in E(H)\). A directed homomorphism that is injective is called an injective directed homomorphism. For any positive integers n, b such that \(b \le n\), we denote by \(P^b_n\) the directed graph on n vertices such that \(V(P^b_n) =[n]\) and \(E(P^b_n)=E_f \uplus E_b\), where \(E_b = \{(i,j): i >j, i,j \in [n]\}\) and \(E_f= \{(i,i+j): i \in [n-1], j \in [b]\}\). In the following lemma, we build the relation between Digraph Bandwidthof D and injective homomorphism from D to \(P^b_n\).
Lemma 6.1
For any digraph D and an integer b, D has bandwidth at most b if and only if there is an injective homomorphism from D to \(P^b_n\).
Proof
In the forward direction, suppose that D has digraph bandwidth at most b. Let \(\sigma \) be a b-ordering of D. Let \(f:V(D) \rightarrow V(P^b_n)\) be a function such that \(f(u)=\sigma (u)\). We claim that f is an injective homomorphism. Since \(\sigma \) is an ordering of D, f is an injective function. We prove that it is also a homomorphism. Consider an arc \((u,v)\in E(D)\). If \(\sigma (u)<\sigma (v)\), then since \(\sigma \) is a b-ordering, \(\sigma (v)-\sigma (u)\le b\). Therefore, \((f(u),f(v))\in E_f\). If \(\sigma (u)>\sigma (v)\), then \((f(u),f(v))\in E_b\). Hence, \((f(u),f(v))\in E(P_n^b)\). In the backward direction, suppose that there exists an injective homomorphism from D to \(P^b_n\). Let \(f:V(D)\rightarrow V(P^b_n)\) be a function. Then, we claim that \(\sigma =(f^{-1}(1),\cdots ,f^{-1}(n))\) is a b-ordering of D. Suppose not, then there exists an arc \((u,v)\in E(D)\) such that \(\sigma (v)-\sigma (u) > b\). Let \(u=f^{-1}(j)\) and \(v=f^{-1}(k)\). Note that \(\sigma (u)=j\) and \(\sigma (v)=k\). Therefore, \(j<k\). Since \(k-j>b\), \((j,k)\notin E(P^b_n)\), a contradiction that f is an injective homomorphism. \(\square \)
For any two digraphs D and H, let inj(D, H) denote the number of injective homomorphisms from D to H and let hom(D, H) denote the number of homomorphisms from D to H. Then the following lemma holds from Theorem 1 in [23].
Lemma 6.2
(Theorem 1, [23]) Suppose that D and H be two digraphs such that \(\vert V(D) \vert = \vert V(H) \vert \). Then,
Now, we state the following known result about the number of homomorphisms between two given digraphs D and H.
Lemma 6.3
(Theorem 3.1, 5.1 [29]) Given digraphs D and H together with a tree decomposition of D of width \(\texttt{tw}\), hom(D, H) can be computed in time \(\mathcal {O}(nh^{\texttt{tw}+1} \min \{\texttt{tw},h\})\), where \(n = \vert V(D) \vert \) and \(h = \vert V(H) \vert \).
Using Lemmas 6.2 and 6.3, we get the following result.
Lemma 6.4
Given digraphs D and H together with a tree decomposition of D of width \(\texttt{tw}\), inj(D, H) can be computed in time \(\mathcal {O}(2^nnh^{\texttt{tw}+1} \min \{\texttt{tw},h\})\), where \(n = \vert V(D) \vert \) and \(h = \vert V(H) \vert \).
Proof of Theorem 1.5. The proof follows from Lemmas 6.1 and 6.4.\(\square \)
7 Conclusion
In this paper we gave exponential time algorithm for the Digraph Bandwidthproblem, that either solved the problem exactly or computed it approximately. In particular, our results imply that whenever \(b \le \frac{n}{\log ^2n}\) or, the treewidth of the underlying undirected digraph is \(\mathcal {O}(\frac{n}{\log n})\) or, the number of arcs in the digraph are linear in the number of vertices, then there exists a \(2^{\mathcal {O}(n)}\) time algorithm for solving Digraph Bandwidth. Some important questions that remain open about Digraph Bandwidthare the following.
-
Does Digraph Bandwidthadmit an algorithm with running time \(2^{\mathcal {O}(n)}\) on general digraphs?
-
Another interesting question is the complexity of the Digraph Bandwidthpro-blem, when b is fixed. Recall that, in the undirected case, Bandwidthcan be solved in time \(\mathcal {O}(n^{b+1})\) [12]. When \(b = 0\), the problem is equivalent to checking if the input is a dag, which can be done in linear time. For \(b =1\), we are able to design an \(\mathcal {O}(n^2)\) time algorithm. For \(b =2\), the problem seems to be extremely complex, and it is not clear if it is polynomial-time solvable. Overall, finding the complexity of Digraph Bandwidth, for a fixed \(b \ge 2\), is an interesting open problem.
Data Availability
Not applicable.
Notes
We choose the name Digraph Bandwidth over the more conventional Directed Bandwidth to avoid clash of names from literature (which will be discussed later).
Consider the following scenario. Suppose a factory is being set up at a hilly terrain and its different departments need to be placed at different places on an uphill. Each department manufactures particular kinds of tools and there are interdependencies with respect to tools among departments, that is, a department may need a tool which is manufactured by some other department. Suppose that electric vehicles are used to transport the tools from one department to another. Most of the electric vehicles (with few exceptions) can cover approximately 100 miles in a charge which is even less while going uphill. Also, recharging vehicle takes time. On the other hand, while going downhill, either the vehicle consumes less power, or does not consume any power, or even recharge vehicle, depending on the steepness of the hill. Therefore, if the department v requires tools from the department u, then the factory owner would like to locate v either downhill from u, or not very far from u to save the energy consumption. This can be modelled as Digraph Bandwidth as follows. In the digraph D, each vertex represents a department and an arc from u to v means that u requires deliveries from v. Let u and v be two vertices in the digraph D. Then, we have an arc from u to v in the digraph D if the department v uses tools manufactured by department u. Interpret an ordering of vertices from left to right as locations of department from downhill to uphill, that is, the first vertex in the ordering corresponds to the bottommost department at the hill and the last vertex in the ordering corresponds to the topmost department at the hill. Clearly, if directed bandwidth of D is at most b, then if the department u needs tools from the department v, and u is uphill from v, then u is at most b distance away from v (considering unit distance between the departments).
References
Lai, Y., Williams, K.: A survey of solved problems and applications on bandwidth, edgesum, and profile of graphs. J. Graph Theory 31(2), 75–94 (1999)
Chudnovsky, M., Fradkin, A., Seymour, P.: Tournament immersion and cutwidth. J. Comb. Theory Ser. B 102(1), 93–101 (2012)
Garey, M., Graham, R., Johnson, D., Knuth, D.: Complexity results for bandwidth minimization. SIAM J. Appl. Math. 34(3), 477–495 (1978)
Garey, M.R., Johnson, D.S.: Computers and Intractability: A Guide to the Theory of NP-Completeness. Freeman, W. H (1979)
Papadimitriou, C.H.: The NP-completeness of the bandwidth minimization problem. Computing 16(3), 263–270 (1976)
Monien, B.: The bandwidth minimization problem for caterpillars with hair length 3 is NP-complete. SIAM J. Alg. Discrete Meth. 7(4), 505–512 (1986)
Blache, G., Karpinski, M., Wirtgen, J.: On approximation intractability of the bandwidth problem. Electron. Colloquium Comput. Complex. TR98-014 (1998) arXiv:TR98-014
Assmann, S.F., Peck, G.W., Sysło, M.M., Zak, J.: The bandwidth of caterpillars with hairs of length 1 and 2. SIAM J. Alg. Discrete Meth. 2(4), 387–393 (1981)
Yan, J.H.: The bandwidth problem in cographs. Tamsui Oxford J. Math. Sci 13, 31–36 (1997)
Kleitman, D.J., Vohra, R.: Computing the bandwidth of interval graphs. SIAM J. Discrete Math. 3(3), 373–375 (1990)
Heggernes, P., Kratsch, D., Meister, D.: Bandwidth of bipartite permutation graphs in polynomial time. J. Discrete Algorithms 7(4), 533–544 (2009)
Saxe, J.B.: Dynamic-programming algorithms for recognizing small-bandwidth graphs in polynomial time. SIAM J. Alg. Discrete Meth. 1(4), 363–369 (1980)
Bodlaender, H.L., Fellows, M.R., Hallett, M.T.: Beyond NP-completeness for problems of bounded width (extended abstract): hardness for the W hierarchy. In: Proc. of STOC 1994, pp. 449–458 (1994)
Dregi, M.S., Lokshtanov, D.: Parameterized complexity of bandwidth on trees. In: Proc. of ICALP 2014, pp. 405–416 (2014)
Golovach, P.A., Heggernes, P., Kratsch, D., Lokshtanov, D., Meister, D., Saurabh, S.: Bandwidth on AT-free graphs. Theor. Comput. Sci. 412(50), 7001–7008 (2011)
Unger, W.: The complexity of the approximation of the bandwidth problem. In: Proc. of FOCS 1998, pp. 82–91 (1998)
Krauthgamer, R., Lee, J.R., Mendel, M., Naor, A.: Measured descent: A new embedding method for finite metrics. In: Proc. of FOCS 2004, pp. 434–443 (2004)
Feige, U.: Coping with the NP-hardness of the graph bandwidth problem. In: Proc. of SWAT 2000, Berlin, pp. 10–19 (2000)
Cygan, M., Pilipczuk, M.: Faster exact bandwidth. In: Proc. of WG 2008. Lecture Notes in Computer Science, vol. 5344, pp. 101–109 (2008)
Cygan, M., Pilipczuk, M.: Even faster exact bandwidth. ACM Trans. Algorithms 8(1), 8–1814 (2012)
Cygan, M., Pilipczuk, M.: Exact and approximate bandwidth. Theor. Comput. Sci. 411(40–42), 3701–3713 (2010)
Cygan, M., Pilipczuk, M.: Bandwidth and distortion revisited. Discrete Appl. Math. 160(4–5), 494–504 (2012)
Amini, O., Fomin, F.V., Saurabh, S.: Counting subgraphs via homomorphisms. SIAM J. Discrete Math. 26(2), 695–717 (2012)
Feige, U., Talwar, K.: Approximating the bandwidth of caterpillars. In: Proc. of APPROX-RANDOM 2005, vol. 3624, pp. 62–73 (2005)
Vassilevska, V., Williams, R., Woo, S.L.M.: Confronting hardness using a hybrid approach. In: Proc. of SODA, pp. 1–10 (2006)
Fürer, M., Gaspers, S., Kasiviswanathan, S.P.: An exponential time 2-approximation algorithm for bandwidth. Theor. Comput. Sci. 511, 23–31 (2013)
M. Karpinski, M., Wirtgen, J., Zelikovsky, A.: An approximation algorithm for the bandwidth problem on dense graphs. Technical report (1997)
Cygan, M., Pilipczuk, M.: Faster exact bandwidth. In: International Workshop on Graph-Theoretic Concepts in Computer Science, pp. 101–109 (2008). Springer
Díaz, J., Serna, M., Thilikos, D.M.: Counting h-colorings of partial k-trees. Theor. Comput. Sci. 281(1–2), 291–309 (2002)
Funding
Open access funding provided by University of Bergen (incl Haukeland University Hospital).
Author information
Authors and Affiliations
Contributions
All authors contributed equally in every step.
Corresponding author
Ethics declarations
Competing of interest
The authors declare no competing interests.
Additional information
Publisher's Note
Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.
\(^{*}\) A preliminary version of this manuscript appeared at FSTTCS 2019. Due to space constraints the preliminary version did not contain all the results and had missing proofs of the other results. \(^{*}\) The \(\varvec{\mathcal {O}}^\star \) notation hides the polynomial factors in the instance size.
Rights and permissions
Open Access This article is licensed under a Creative Commons Attribution 4.0 International License, which permits use, sharing, adaptation, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons licence, and indicate if changes were made. The images or other third party material in this article are included in the article’s Creative Commons licence, unless indicated otherwise in a credit line to the material. If material is not included in the article’s Creative Commons licence and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder. To view a copy of this licence, visit http://creativecommons.org/licenses/by/4.0/.
About this article
Cite this article
Jain, P., Kanesh, L., Lochet, W. et al. Exact and Approximate Digraph Bandwidth. Theory Comput Syst 69, 10 (2025). https://doi.org/10.1007/s00224-024-10202-x
Accepted:
Published:
DOI: https://doi.org/10.1007/s00224-024-10202-x