We show that UPBE-
k is NP-hard via a reduction from the NP-complete problem Betweenness. The problem Betweenness is defined as follows.
Definition 1
(
Betweenness [Opa79]). We are given a set L of n elements and a set C of m ordered triples where each member of a triple is a member of L. Let \(\phi \) be a total ordering of the elements in L. An ordered triple, \(\langle a, b, c \rangle \in C\) is satisfied if either \(\phi (a)< \phi (b) < \phi (c)\) or \(\phi (c)< \phi (b) < \phi (a)\) is true. The goal is to find an ordering \(\phi \) such that all ordered triples in C are satisfied.
Given an instance (L, C) of Betweenness, we construct an instance, \(G=(V, E)\), with edge partition, \(P = \left\{ \texttt {Red}, \texttt {Green}, \texttt {Blue}\right\} \), of UPBE-3 such that a subsequence of a solution \(\pi \) corresponds to a valid ordering \(\phi \) of L in the Betweenness instance. For each element \(x\in L\), we create vertices \(x_1,\ldots , x_{2m - 1}\) in V. We call these vertices the element vertices. Our reduction uses two types of gadgets: ordered triple gadgets and order preserving gadgets. Their function is to enforce a betweenness constraint given by an element of C and to ensure that the order of element vertices of subscript j in \(\pi \), with \(j\in \{1,\ldots , 2m - 2\}\), is the reverse order of element vertices of subscript \(j+1\), respectively. We prove that (G, P) admits an upward book embedding given by \(\pi \) if and only if the order of element vertices of the same subscript in \(\pi \) corresponds to a solution \(\phi \) for the (L, C) Betweenness instance.
3.1 Gadgets
Ordered Triple Gadget. We order the set C arbitrarily. For the \((\frac{i+1}{2})\)-th ordered triple \(\langle a, b, c \rangle \in C\), where i is an odd integer between and including 1 and \(2m-1\), we construct an ordered triple gadget that enforces the betweenness constraint on the triple of element vertices \(a_{i}, b_{i}, c_{i}\) in \(\pi \). Specifically, we create the following nodes and edges.
Definition 2
(Ordered Triple Gadget). Let (L, C) be an instance of Betweenness. Order the set C arbitrarily. For the \(\left( \frac{i+1}{2}\right) \)-th ordered triple \(\langle a, b, c\rangle \), where i is an odd integer between and including 1 and \(2m-1\), construct nodes \(l_i\), \(\alpha _i\), \(\omega _i\), \(a'_i\), \(b'_i\), \(c'_i\), and \(h_i\). Then, create directed edges \((l_i, \alpha _i), (l_i, \omega _i) \in \mathtt {Red}\), \((\alpha _i, a_i'), (\alpha _i, b_i'), (\omega _i, b_i'), (\omega _i, c_i') \in \mathtt {Blue}\), and \((a_i', h_i), (b_i', h_i), (c_i', h_i) \in \mathtt {Green}\).
Refer to Fig. 1 for an example construction. Nodes \(a_{i}', b_{i}'\) and \(c_{i}'\) are respectively connected to \(a_{i}'', b_{i}''\) and \(c_{i}''\) by an edge in Red (where \(a_i''\), \(b_i''\), and \(c_i''\) are part of the order preserving gadget defined in Definition 3). The topologically earliest and latest nodes in the gadget are respectively \(l_i\) and \(h_i\). The choice between \(\pi (a'_{i})<\pi (b'_{i})<\pi (c'_{i})\) and \(\pi (a'_{i})>\pi (b'_{i})>\pi (c'_{i})\) (and hence the choice between \(\pi (a_i)< \pi (b_i) < \pi (c_i)\) and \(\pi (a_i)> \pi (b_i) > \pi (c_i)\)) is encoded in the choice between \(\pi (\alpha _{i})<\pi (\omega _{i})\) and \(\pi (\alpha _{i})>\pi (\omega _{i})\) as we prove in Lemmas 1 and 2.
Lemma 1
Given a positive instance (G, P) containing the ordered triple gadget shown in Fig. 1 (left), if \(\pi (h_i)< \min (\pi (a_i''), \pi (b_i''), \pi (c_i''))\) then either \(\pi (a_i'')< \pi (b_i'') < \pi (c_i'')\) or \(\pi (c_i'')< \pi (b_i'') < \pi (a_i'')\).
Proof
Notice that \(h_i\) must appear after \(a_i'\), \(b_i'\) and \(c_i'\) due to topological order. By the assumption in the lemma, \(h_i\) be before \(a_i''\), \(b_i''\), \(c_i''\) respectively. We first prove that \(\min (\pi (a_i'), \pi (b_i'), \pi (c_i')) > \max (\pi (\alpha _i), \pi (\omega _i))\), i.e., no vertex in the gadget must occur between \(\alpha _i\) and \(\omega _i\). Because of the topological order, \(\pi (b_i') > \max (\pi (\alpha _i), \pi (\omega _i))\). Suppose \(\pi (\alpha _i)<\pi (\omega _i)\) (see Fig. 2 (top)). By topological order \(\pi (c_i') > \pi (\omega _i)=\max (\pi (\alpha _i), \pi (\omega _i))\). If \(\pi (a_i') < \pi (\omega _i)\), since \(\pi (\omega _i)<\pi (a_i'')\), the red edges \((a_i', a_i'')\) and \((l_i, \omega _i)\) would intersect, a contradiction. The case when \(\pi (\alpha _i)>\pi (\omega _i)\) is symmetric.
Trivially, either \(\pi (\alpha _i) < \pi (\omega _i)\) or \(\pi (\alpha _i) > \pi (\omega _i)\). We first assume \(\pi (\alpha _i) < \pi (\omega _i)\) (Fig. 2 (top)). Then \(\pi (c_i')< \pi (b_i') < \pi (a_i')\), or else at least one pair of blue edges (\((\alpha _i, b_i')\), \((\alpha _i, a_i')\), \((\omega _i, c_i')\), \((\omega _i, b_i')\)) would cross. Since all red edges \((a_i',a_i''), (b_i',b_i'')\) and \((c_i',c_i'')\) nest around \(h_i\), every pair of such edges must be nested. Therefore, \(\pi (a_i'')< \pi (b_i'') < \pi (c_i'')\). The case when \(\pi (\alpha _i)>\pi (\omega _i)\) is symmetric. \(\square \)
Order Preserving Gadget. By Lemma 1, each ordered triple gadget enforces a betweenness constraint on vertices \(a_i''\), \(b_i''\) and \(c_i''\). The order preserving gadgets serve two purposes: ensuring that the i-th betweenness constraint is enforced in the i-th copy of element vertices; and ensuring that each copy of element vertices must occur in the reverse order of its predecessor. That implies that every other copy of element vertices occur in exactly the same order. We build \(2m - 1\) order preserving gadgets, the j-th gadget containing \(x_j\) for each \(x\in L\).
Definition 3
(Order Preserving Gadget). For each odd i in the range \([1, 2m-1]\), we build the following nodes and edges:
-
1.
Nodes \(a_i'', b_i'', c_i''\), \(x^p_i\) for \(p \in [1, n]\), and \(r_i\).
-
2.
Directed edges \((a_i'', a_i), (b_i'', b_i), (c_i'', c_i) \in \mathtt {Red} \).
-
3.
Directed paths of length 7 connecting \(r_i\) to \(x^p_i\) for all \(p \in [1, n]\) and where \(x^p_i \ne a_i, b_i, c_i\). The paths alternate between red and green edges.
-
4.
Directed paths of length 7 connecting \(r_i\) to \(a''_i\), \(b''_i\), and \(c''_i\) with alternating red and green edges.
For each even j in the range \([1, 2m-1]\), we build the following nodes and edges:
-
1.
Nodes \(x^p_j\) for \(p \in [1, n]\) and \(r_j\).
-
2.
Directed edges \((x^p_j, r_j) \in \mathtt {Red}\) for all \(p \in [1, n]\).
The gadget is divided into two parts: the elements part containing the element vertices, and the order preserving tree whose root is labeled \(r_i\) or \(r_j\). Figure 1 (center) shows an example of an order preserving gadget containing element vertices with odd subscript. Such instances are connected to ordered triple gadgets by three incoming red edges and have the vertex \(r_i\) as the lowest vertex in the topological order. The dashed edges represent a path of length 7 of alternating red/green edges that are connected to the element vertex \(x_i\) if \(x\in L\) is not in the \(\left( \frac{i+1}{2}\right) \)-th ordered triple, or connected to the vertex \(x_i''\) otherwise. The vertices \(x_i''\) for an element x in the i-th ordered triple are then connected to the element vertex \(x_i\) by a blue edge. For gadgets that contain element vertices with even subscript j (Fig. 1 (right)), \(r_j\) is the highest vertex in the topological order. For even \(j\in \{2,\ldots ,2m-2\}\), we connect \(x_j\) to \(x_{j-1}\) with a blue edge and \(x_j\) to \(x_{j+1}\) with a green edge, for all \(x\in L\) (see Fig. 6).
For odd i, the order preserving tree consists of n paths of length 7 of alternating red/green edges connected to the i-th element vertex (represented in Fig. 1 (center) as dashed arrows). Informally, their purpose is to allow such paths to “cross” the vertices connected to the i-th ordered triple gadget by red edges, while \(r_i\) as the first vertex in the topological order of the order preserving gadget.
Lemma 2
Let (G, P) be a positive instance containing an order preserving gadget of odd index i connected to an ordered triple gadget representing \(\langle a,b,c\rangle \). If there exists a set of blue edges \((s_{i-1},x_i)\), \(\pi (s_{i-1})<\pi (r_i)\) and \(\pi (s_{i-1}) < \min (\pi (a_i'', b_i'', c_i''))\), from some vertices \(s_{i-1}\) for all \(x\in L\), then either \(\pi (a_i)<\pi (b_i)<\pi (c_i)\) or \(\pi (a_i)>\pi (b_i)>\pi (c_i)\).
Proof
By topological order, \(\pi (r_i)<\pi (x_i)\) for all \(x\in L\). Then, all blue edges of the form \((s_{i-1},x_i)\) must nest around \(r_i\). By Lemma 1, the order of vertices \(a_i''\), \(b_i''\) and \(c_i''\) must obey the betweenness constraint \(\langle a,b,c\rangle \). Since \(\pi (y_i'')>\pi (r_i), y\in \{a,b,c\}\), if \(\pi (a_i'')<\pi (b_i'')\) then \(\pi (a_i)<\pi (b_i)\) or else edges \((a_i'', a_i)\) and \((s_{i-1}, b_i)\) would cross. With similar arguments, we can show that the order of the i-th element vertices must obey the betweenness constraint \(\langle a,b,c\rangle \). \(\square \)
Lemma 3
Let (G, P) be a positive instance containing three subsequent order preserving gadgets with indices \(j-1\), j, and \(j+1\) where j is an even integer in \(\left\{ 2, \dots , 2m - 2\right\} \). If \(\pi (r_{j}) < \min \{\pi (r_{j-1}), \pi (r_{j+1})\}\), the element vertices with subscript \(j+1\) appear in \(\pi \) in the same order as the element vertices with subscript \(j-1\).
Proof
We prove that the order of the element vertices with subscript \(j-1\) is the reverse order of the element vertices with subscript j in \(\pi \). By a similar argument, we can then show the same for j and \(j+1\), completing the proof. Notice that, since j is even, \(\pi (x_{j}) < \pi (r_{j})\), \(\pi (r_j) < \pi (r_{j-1})\), and \(\pi (r_{j-1})<\pi (x_{j-1})\) for all \(x\in L\) due to the topological order of the vertices. By the assumption in the lemma, all blue edges \((x_j,x_{j-1})\) nest around \(r_j\) and \(r_{j-1}\). Therefore, any pair of such edges must be nested or they would cross. Hence, if \(\pi (b_{j}) > \pi (a_{j})\), then \(\pi (b_{j-1})<\pi (a_{j-1})\) or the blue edges \((b_j, b_{j-1})\) and \((a_j, a_{j-1})\) would cross (see Fig. 6 for example). Therefore, the order of the \((j-1)\)-th copy of element vertices is the reverse order of the j-th copy. The same argument holds for \(x_j\) and \(x_{j+1}\) for all \(x \in L\). Given that the order of the \((j-1)\)-th and the order of the \((j+1)\)-th copy of the element vertices are in reverse order of the j-th copy, the order of the \((j-1)\)-th and \((j+1)\)-th copies of the element vertices must be the same. \(\square \)
The next corollary immediately follows from Lemma 3.
Corollary 1
If \(\pi (r_{j}) < \min \{\pi (r_{j-1}), \pi (r_{j+1})\}\) for all even \(j \in \{2, \dots , 2m-2\}\), then all element vertices with even subscript, \(j \in \{2, \dots , 2m-2\}\) appear in the same order and all element vertices with odd subscript, \(i \in \{1, \dots , 2m-1\}\) appear in the same order. Furthermore, all element vertices with even subscript, j, appear in the reverse order of all element vertices with odd subscript, i.
3.2 Final Reduction
We create n ordered triple gadgets as defined in Definition 2 and \(2m-1\) order preserving gadgets as defined in Definition 3, connecting via the following set of edges:
-
1.
\((a'_i, a''_i), (b'_i, b''_i), (c_i, c''_i) \in \mathtt {Red}\) for all odd \(i \in [1, 2m-1]\).
-
2.
\((r_j, l_{j-1}), (r_j, l_{j+1}) \in \mathtt {Red}\) for all even \(j \in [1, 2m-1]\).
-
3.
\((s, x^p_n) \in \mathtt {Blue}\) for all \(p \in [1, n]\).
-
4.
\((x^p_j, x^p_{j-1}) \in \mathtt {Blue}\) for all \(p \in [1, n]\) and even \(j \in [1, 2m-1]\).
-
5.
\((x^p_j, x^p_{j+1}) \in \mathtt {Green}\) for all \(p \in [1, n]\) and even \(j \in [1, 2m-1]\).
-
6.
\((h_i, r_i) \in \mathtt {Red}\) for all odd \(i \in [1, 2m-1]\).
-
7.
\((x^p_j, r_j) \in \mathtt {Red}\) for all \(p \in [1, n]\) and even \(j \in [1, 2m-1]\).
-
8.
\((r_{2m-2}, s), (s, l_{2m-1}) \in \mathtt {Blue}\).
-
9.
\((r_{2m-2}, l_{2m-1}) \in \mathtt {Red}\).
We connect the ordered triple and order preserving gadgets as described above, obtaining an instance (G, P) of UPBE-
k. Using this reduction, we prove that UPBE-k is NP-complete for \(k \ge 3\).
Theorem 1
UPBE-
k is NP-complete for \(k \ge 3\).
The proof follows from Lemmas 1, 2, and 3 and the constructions of the gadgets; please refer to our full paper for the proof [ADHL17].