# Visibility Representations of Boxes in 2.5 Dimensions

Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 9801)

## Abstract

We initiate the study of 2.5D box visibility representations (2.5D-BR) where vertices are mapped to 3D boxes having the bottom face in the plane $$z=0$$ and edges are unobstructed lines of sight parallel to the x- or y-axis. We prove that: (i) Every complete bipartite graph admits a 2.5D-BR; (ii) The complete graph $$K_n$$ admits a 2.5D-BR if and only if $$n \leqslant 19$$; (iii) Every graph with pathwidth at most 7 admits a 2.5D-BR, which can be computed in linear time. We then turn our attention to 2.5D grid box representations (2.5D-GBR) which are 2.5D-BRs such that the bottom face of every box is a unit square at integer coordinates. We show that an n-vertex graph that admits a 2.5D-GBR has at most $$4n - 6 \sqrt{n}$$ edges and this bound is tight. Finally, we prove that deciding whether a given graph G admits a 2.5D-GBR with a given footprint is NP-complete. The footprint of a 2.5D-BR $$\varGamma$$ is the set of bottom faces of the boxes in $$\varGamma$$.

## Keywords

Visibility Representation Complete Graph Geometric Object Hamiltonian Path Complete Bipartite Graph
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.

## 1 Introduction

A visibility representation (VR) of a graph G maps the vertices of G to non-overlapping geometric objects and the edges of G to visibilities, i.e., segments that do not intersect any geometric object other than at their end-points. Depending on the type of geometric objects representing the vertices and on the rules used for the visibilities, different types of representations have been studied in computational geometry and graph drawing.

A bar visibility representation (BVR) maps the vertices to horizontal segments, called bars, while visibilities are vertical segments. BVRs were introduced in the 80 s as a modeling tool for VLSI problems [16, 27, 28, 34, 35, 36]. The graphs that admit a BVR are planar and they have been characterized under various models [16, 28, 34, 36].

Extensions and generalizations of BVRs have been proposed in order to enlarge the family of representable graphs. In a rectangle visibility representation (RVR) the vertices are axis-aligned rectangles, while visibilities are both horizontal or vertical segments [4, 5, 10, 12, 13, 23, 29, 31]. RVRs can exist only for graphs with thickness at most two and with at most $$6n-20$$ edges [23]. Recognizing these graphs is NP-hard in general [29] and can be done in polynomial time in some restricted cases [4, 31]. Generalizations of RVRs where orthogonal shapes other than rectangles are used to represent the vertices have been recently proposed [15, 26]. Another generalization of BVRs are bar k-visibility representations (k-BVRs), where each visibility segment can “see” through at most k bars. Dean et al. [11] proved that the graphs admitting a 1-BVR have at most $$6n-20$$ edges. Felsner and Massow [20] showed that there exist graphs with a 1-BVR whose thickness is three. The relationship between 1-BVRs and 1-planar graphs has also been investigated [1, 7, 17, 32].

RVRs are extended to 3D space by Z-parallel Visibility Representations (ZPR), where vertices are axis-aligned rectangles belonging to planes parallel to the xy-plane, while visibilities are parallel to the z-axis. Bose et al. [6] proved that $$K_{22}$$ admits a ZPR, while $$K_{56}$$ does not. Štola [30] subsequently reduced the upper bound on the size of the largest representable complete graph by showing that $$K_{51}$$ does not admits a ZPR. Fekete et al. [18] showed that $$K_7$$ is the largest complete graph that admits a ZPR if unit squares are used to represent the vertices. A different extension of RVRs to 3D space are the box visibility representations (BR) where vertices are 3D boxes, while visibilities are parallel to the x-, y- and z- axis. This model was studied by Fekete and Meijer [19] who proved that $$K_{56}$$ admits a BR, while $$K_{184}$$ does not.

In this paper we introduce 2.5D box visibility representations (2.5D-BR) where vertices are 3D boxes whose bottom faces lie in the plane $$z=0$$ and visibilities are parallel to the x- and y-axis. Like the other 3D models that use the third dimension, 2.5D-BRs overcome some limitations of the 2D models. For example, graphs with arbitrary thickness can be realized. In addition 2.5D-BRs seem to be simpler than other 3D models from a visual complexity point of view and have the advantage that they can be physically realized, for example by 3D printers or by using physical boxes. Furthermore, this type of representation can be used to model visibility between buildings of a urban area [9]. The main results of this paper are as follows.

• We show that every complete bipartite graph admits a 2.5D-BR (Sect. 3). This implies that there exist graphs that admit a 2.5D-BR and have arbitrary thickness.

• We prove that the complete graph $$K_n$$ admits a 2.5D-BR if and only if $$n \leqslant 19$$ (Sect. 3). Thus, every graph with $$n \leqslant 19$$ vertices admits a 2.5D-BR.

• We describe a technique to construct a 2.5D-BR of every graph with pathwidth at most 7, which can be computed in linear time (Sect. 4).

• We then study 2.5D grid box representations (2.5D-GBR) which are 2.5D-BRs such that the bottom face of every box is a unit square with corners at integer coordinates (Sect. 5). We show that an n-vertex graph that admits a 2.5D-GBR has at most $$4n - 6 \sqrt{n}$$ edges and that this bound is tight. It is worth remarking that VRs where vertices are represented with a limited number of shapes have been investigated in the various models of visibility representations. Examples of these shape-restricted VRs are unit bar VRs [14], unit square VRs [10], and unit box VRs [19].

• Finally, we prove that deciding whether a given graph G admits a 2.5D-GBR with a given footprint is NP-complete (Sect. 5). The footprint of a 2.5D-BR $$\varGamma$$ is the set of bottom faces of the boxes in $$\varGamma$$.

For reasons of space, some proofs and details are omitted and can be found in [3].

## 2 Preliminaries

A box is a six-sided polyhedron of non-zero volume with axis-aligned sides in a 3D Cartesian coordinate system. In a 2.5D box representation (2.5D-BR) the vertices are mapped to boxes that lie in the non-negative half space $$z \geqslant 0$$ and include one face in the plane $$z=0$$, while each edge is mapped to a visibility (i.e. a segment whose endpoints lie in faces of distinct boxes and whose interior does not intersect any box) parallel to the x- or to the y-axis. We remark that visibilities between non-adjacent objects may exist, i.e., we adopt the so called weak visibility model (in the strong visibility model each visibility between two geometric objects corresponds to an edge of the graph). The weak model seems to be the most effective when representing non-planar graphs and it has been adopted in several works (see e.g. [4, 7, 17]). As in many papers on visibility representations [19, 24, 31, 33, 36], we assume the $$\epsilon$$ -visibility model, where each segment representing an edge is the axis of a positive-volume cylinder that intersects no box except at its ends; this implies that an intersection point between a visibility and a box belongs to the interior of a box face. In what follows, when this leads to no confusion, we shall use the term edge to indicate both an edge and the corresponding visibility, and the term vertex for both a vertex and the corresponding geometric object.

Given a box b of a 2.5D-BR, the face that lies in the plane $$z=0$$ is called the footprint of b. The intersection of the plane $$z=0$$ with a 2.5D-BR $$\varGamma$$ is called the footprint of $$\varGamma$$ and is denoted by $$\varGamma _0$$. In other words, the footprint of a 2.5D-BR $$\varGamma$$ consists of the footprint of all the boxes in $$\varGamma$$. If $$\varGamma$$ is a 2.5D-BR of a complete graph then its footprint $$\varGamma _0$$ satisfies a trivial necessary condition (throughout the paper we will refer to this condition as NC): for every pair of boxes $$b_1$$ and $$b_2$$ of $$\varGamma$$, there must exist a line $$\ell$$ (in the plane $$z = 0$$) such that (i) $$\ell$$ passes through the footprints of $$b_1$$ and $$b_2$$, and (ii) $$\ell$$ is either parallel to the x-axis or to the y-axis. A 2.5D grid box representation (2.5D-GBR) is a 2.5D-BR such that every box has a footprint that is a unit square with corners at integer coordinates.

Two boxes see each other if there exists a visibility between them; we say that they see each other above another box b, if there exists a visibility between them and the projection of this visibility on the plane $$z=0$$ intersects the interior of the footprint of b. Notice that this implies that the two boxes are both taller than b. We say that two boxes have a ground visibility or are ground visible if there exists a visibility between their footprints, i.e. if there exists an unobstructed axis-aligned line segment connecting their footprints. If two boxes are ground visible then they see each other regardless of their heights and the heights of the other boxes. Let G be a graph, let $$\varLambda$$ be a collection of boxes each lying in the non-negative half space $$z \geqslant 0$$ with one face in the plane $$z = 0$$, such that the boxes of $$\varLambda$$ are in bijection with the vertices of G. Note that $$\varLambda$$ may not be a 2.5D-BR of G. For a vertex v of G, $$\varLambda (v)$$ denotes the corresponding box in $$\varLambda$$, while $$h(\varLambda (v))$$, or simply h(v), indicates the height of this box. For a subset $$S \subset V(G)$$, $$\varLambda (S)$$ denotes the subset of boxes associated with S, while $$\varLambda _0(S)$$ is the footprint of $$\varLambda (S)$$. Let G[S] be the subgraph of G induced by S. We say that $$\varLambda (S)$$ is a 2.5D-BR of G[S] in $$\varLambda$$, if for any edge (uv) of G[S] there exists a visibility in $$\varLambda$$ between $$\varLambda (u)$$ and $$\varLambda (v)$$; that is, the visibility is not destroyed by the presence of the other boxes in $$\varLambda$$.

## 3 2.5D Box Representations of Complete Graphs

In this section we consider 2.5D-BRs of complete graphs and complete bipartite graphs.

### Theorem 1

Every complete bipartite graph admits a 2.5D-BR.

### Proof

Let $$K_{m,n}$$ be a complete bipartite graph. We represent the m vertices in the first partite set with m boxes $$a_0, a_1,$$ $$\ldots , a_{m-1}$$ such that box $$a_i$$ has a footprint with corners at (2i, 0, 0), ($$2i+1,0,0$$), ($$2i,2n-1,0$$) and ($$2i+1,2n-1,0$$) and height $$m-i$$. Then we represent the n vertices in the second partite set with n boxes $$b_0,b_1,\ldots ,b_{n-1}$$ such that box $$b_j$$ has a footprint with corners at (2m, 2j, 0), ($$2m+1,2j,0$$), ($$2m,2j+1,0$$) and ($$2m+1,2j+1,0$$) and height m. Consider now a box $$a_i$$ and a box $$b_j$$. By construction $$a_i$$ and $$b_j$$ see each other above all boxes $$a_l$$ with $$l>i$$.   $$\square$$

A consequence of Theorem 1 is that there exist graphs with unbounded thickness that admit a 2.5D-BR. This contrasts with other models of visibility representations (e.g., k-BVRs, and RVRs), which can only represent graphs with bounded thickness.

We now prove that the largest complete graph that admits a 2.5D-BR is $$K_{19}$$. We first show that given a 2.5D-BR of a complete graph there is one line parallel to the x-axis and one line parallel to the y-axis whose union intersect all boxes and such that each of them intersects at most 10 boxes. This implies that there can be at most 20 boxes in a 2.5D-BR of a complete graph. We then show that there must be a box that is intersected by both lines, thus lowering this bound to 19. We finally exhibit a 2.5D-BR of $$K_{19}$$. We start with some technical lemmas.

### Lemma 1

Let G be an n-vertex graph that admits a 2.5D-BR $$\varGamma '$$. Then there exists a 2.5D-BR $$\varGamma$$ of G such that every box of $$\varGamma$$ has a distinct integer height in the range [1, n] and the footprint of $$\varGamma$$ is the same as that of $$\varGamma '$$.

The following lemma is proved in [25, Observation 1]. Given an axis-aligned rectangle r in the plane $$z=0$$, we denote by x(r) the x-extent of r and by y(r) the y-extent of r, so $$r = x(r) \times y(r)$$.

### Lemma 2

[25]. For every arrangement $$\mathcal {R}$$ of n axis-aligned rectangles in the plane such that for all $$a,b \in \mathcal {R}$$, either $$x(a) \cap x(b) \ne \emptyset$$ or $$y(a) \cap y(b) \ne \emptyset$$, there exists a vertical and a horizontal line whose union intersects all rectangles in $$\mathcal {R}$$.

The following lemma is similar to the Erdős–Szekeres lemma and can be proved in a similar manner [18]. A sequence of distinct integers is unimaximal if no element of the sequence is smaller than both its predecessor and successor.

### Lemma 3

[18]. For all $$m > 1$$, in every sequence of $${m \atopwithdelims ()2}+1$$ distinct integers, there exists at least one unimaximal sequence of length m.

Given a 2.5D-BR $$\varGamma$$ and a line $$\ell$$ parallel to the x-axis or to the y-axis, we say that $$\ell$$ stabs a set of boxes B of $$\varGamma$$ if it intersects the interior of the footprints of each box in B. Let $$b_1, b_2, \dots ,b_h$$ be the boxes of B in the order they are stabbed by $$\ell$$. We say that B has a staircase layout, if $$h(b_i) > h(b_{i-1})$$ for $$i=2,3,\dots ,h$$.

### Lemma 4

In a 2.5D-BR of a complete graph no line parallel to the x-axis or to the y-axis can stab five boxes whose heights, in the order in which the boxes are stabbed, form a unimaximal sequence.

### Proof

Assume, as a contradiction, that there exists a line $$\ell$$ parallel to the x-axis or to the y-axis that stabs 5 boxes $$b_1$$, $$\dots$$, $$b_5$$ whose heights form a unimaximal sequence in the order in which the boxes are stabbed by $$\ell$$. Let $$r_{i}$$ be the footprint of box $$b_{i}$$ (with $$1 \leqslant i \leqslant 5$$). We claim that there exists a ground visibility between every pair of boxes $$b_i$$ and $$b_{j}$$ (with $$1 \leqslant i < j \leqslant 5$$). If $$j=i+1$$ this is clearly true. Suppose then that $$j \ne i+1$$. If $$b_i$$ and $$b_j$$ do not have a ground visibility, then they must see each other above $$b_l$$ with $$i< l < j$$, i.e., the height of $$b_i$$ and of $$b_j$$ must be larger than the height of $$b_l$$, which is impossible because the sequence of heights is unimaximal. Thus, for every pair of boxes $$b_i$$ and $$b_j$$ there must be a ground visibility. Since $$b_i$$ and $$b_j$$ are both stabbed by $$\ell$$, this visibility must be parallel to $$\ell$$. This implies that the left sides (if $$\ell$$ is parallel to the x-axis) or the bottom sides (if $$\ell$$ is parallel to the y-axis) of rectangles $$r_{1}, r_{2}, r_{3}, r_{4}, r_{5}$$ form a bar visibility representation of $$K_5$$, which is impossible because bar visibility representations exist only for planar graphs [21].    $$\square$$

### Lemma 5

In a 2.5D-BR of a complete graph no line parallel to the x-axis or to the y-axis can stab more than 10 boxes.

### Proof

Let $$\varGamma$$ be a 2.5D-BR of a complete graph $$K_n$$. By Lemma 1 we can assume that all boxes have distinct integer heights. Suppose, as a contradiction, that there exists a line $$\ell$$ parallel to the x-axis or to the y-axis that stabs $$k>10$$ boxes. Let $$h_1, h_2, \dots , h_k$$ be the heights of the stabbed boxes in the order in which the boxes are stabbed by $$\ell$$. By Lemma 3 this sequence of heights contains a unimaximal sequence of length 5, but this is impossible by Lemma 4.    $$\square$$

### Lemma 6

A complete graph admits a 2.5D-BR only if it has at most 19 vertices.

### Proof

Let $$\varGamma$$ be a 2.5D-BR of a complete graph $$K_n$$ (for some $$n>0$$). By Lemma 1 we can assume that all boxes of $$\varGamma$$ have distinct heights. The footprint $$\varGamma _0$$ of $$\varGamma$$ is an arrangement of rectangles that satisfies Lemma 2. Thus there exist a line $$\ell _h$$ parallel to the x-axis and a line $$\ell _v$$ parallel to the y-axis that together stab all boxes of $$\varGamma$$. By Lemma 5, both $$\ell _h$$ and $$\ell _v$$ can stab at most 10 boxes each. This means that the number of boxes (and therefore the number of vertices of $$K_n$$) is at most 20. We now prove that if $$\ell _h$$ and $$\ell _v$$ both stab ten boxes, there must be one box that is stabbed by both $$\ell _h$$ and $$\ell _v$$, which implies that the number of boxes in $$\varGamma$$ is at most 19.

Suppose, for a contradiction, that $$p = \ell _h \cap \ell _v$$ does not lie in a box. Refer to Fig. 1(a) for an illustration. Denote by T the set of boxes stabbed by $$\ell _v$$ that are above p and by B be the set of boxes stabbed by $$\ell _v$$ that are below p. Analogously, denote by L the set of boxes stabbed by $$\ell _h$$ that are to the left of p and by R the set of boxes stabbed by $$\ell _h$$ that are to the right of p. Each of these sets can be empty but $$|T|+|B|=10$$ and $$|L|+|R|=10$$. Denote by $$l_1, l_2, \dots , l_{|L|}$$ the set of boxes in L from right to left, i.e., $$l_1$$ is the box closest to p. Analogously, denote by $$r_1, r_2, \dots , r_{|R|}$$ the boxes of R from left to right ($$r_1$$ is the closest to p), by $$t_1, t_2, \dots , t_{|T|}$$ the boxes of T from bottom to top ($$t_1$$ is the closest to p) and by $$b_1, b_2, \dots , b_{|B|}$$ the boxes of B from top to bottom ($$b_1$$ is the closest to p). Let $$f_T$$, $$f_B$$, $$f_L$$, and $$f_R$$ be the footprints of $$t_1$$, $$b_1$$, $$l_1$$, and $$r_1$$, respectively. Let $$\ell _X$$ be the line containing the side of $$f_X$$ that is closest to p and let $$\ell '_X$$ be the line containing the opposite side of $$f_X$$ (for every $$X \in \{T,B,L,R\}$$).

We first claim that for each $$f_X$$ there exists a line $$\ell _Y$$ (with $$X, Y \in \{T,B,L,R\}$$ and $$Y \ne X$$) that intersects the interior of $$f_X$$. Suppose, for a contradiction, that this is not true for at least one $$f_X$$, say $$f_L$$; that is, the interior of $$f_L$$ is not intersected by $$\ell _T$$ and $$\ell _B$$. If so, there must be a line $$\ell$$ parallel to the y-axis that intersects all the rectangles in $$T \cup B$$ and $$f_L$$; otherwise the necessary condition NC does not hold for $$T \cup B \cup \{l_1\}$$. But then $$\ell$$ would stab eleven boxes, which is impossible by Lemma 5. Thus, our claim holds and the four rectangles $$f_X$$ are placed so that $$\ell _T$$, $$\ell _R$$, $$\ell _B$$, and $$\ell _L$$ stab $$f_R$$, $$f_B$$, $$f_L$$, and $$f_T$$ (or, symmetrically, $$f_L$$, $$f_T$$, $$f_R$$, and $$f_B$$, which follows a symmetric argument), respectively, as in Fig. 1(a).

We consider now the sets T, B, L, and R. For each set there are two possible configurations. Consider the set B and the line $$\ell '_L$$. If the set $$B' = B \setminus \{b_1\}$$ contains a box $$b_j$$ whose footprint is completely to the right of $$\ell '_L$$, we say that B has configuration A (see Fig. 1(b)). In the case of configuration A, the footprint of all boxes in $$L'=L \setminus \{l_1\}$$ must extend below the line $$\ell '_B$$ (otherwise the necessary condition NC does not hold for $$L' \cup \{b_j\}$$). This implies that $$y(f_B)$$ is contained in $$y(l_i)$$ for all $$i \geqslant 2$$. The only possibility for $$b_1$$ to see all these boxes is that $$L'$$ has a staircase layout (with $$l_2$$ being the shortest box) and $$b_1$$ is taller than the second tallest one. So, configuration A for the set B implies that $$L'$$ has a staircase layout. If all boxes of $$B'$$ have a footprint that extends to the left of $$\ell '_L$$, we say that B has configuration B (see Fig. 1(c)). In this case, $$x(f_L)$$ is contained in $$x(b_i)$$ for all $$i \geqslant 2$$. Again, the only possibility for $$l_1$$ to see all these boxes is that $$B'$$ has a staircase layout and that $$l_1$$ is taller than the second tallest one. So, configuration B for the set B implies that $$B'$$ has a staircase layout. The definitions of configurations A and B for T, L, R are similar to those for B and arise by considering lines $$\ell '_R$$, $$\ell '_T$$, $$\ell '_B$$, respectively.

For any two sets X and Y that are consecutive in the cyclic order T, R, B, L, either $$X'$$ or $$Y'$$ has a staircase layout (depending on whether X has configuration A or B). This implies that either $$B'$$ and $$T'$$ have both a staircase layout or $$L'$$ and $$R'$$ have both a staircase layout. Suppose that $$B'$$ and $$T'$$ have a staircase layout (the case when $$L'$$ and $$R'$$ have a staircase layout is analogous). If either $$|B'| \geqslant 5$$ or $$|T'| \geqslant 5$$, $$\ell _v$$ stabs at least five boxes whose heights form a unimaximal sequence, which is impossible by Lemma 4. Thus $$|B'|=4$$ and $$|T'|=4$$ (recall that $$|B'|+|T'|=8$$). Since all boxes of $$\varGamma$$ have distinct heights, either $$h(b_2) < h(t_2)$$ or $$h(t_2) < h(b_2)$$. In the first case $$\ell _v$$ stabs the five boxes $$t_5, t_4, t_3, t_2, b_2$$ whose heights form a unimaximal sequence, which is impossible by Lemma 4. In the other case $$\ell _v$$ stabs the five boxes $$b_5, b_4, b_3, b_2, t_2$$ whose heights form a unimaximal sequence, which is impossible by Lemma 4.   $$\square$$

We conclude this section by exhibiting a 2.5D-BR of $$K_{19}$$, illustrated in Fig. 2. To prove the correctness of the drawing the idea is to partition the vertex set of $$K_{19}$$ into five subsets (shown in Fig. 2) and prove that all boxes in a given set see all other boxes. The following theorem holds.

### Theorem 2

A complete graph $$K_n$$ admits a 2.5D-BR if and only if $$n \leqslant 19$$.

## 4 2.5D Box Representations of Graphs with Pathwidth at Most 7

A graph G with pathwidth p is a subgraph of a graph that can be constructed as follows. Start with the complete graph $$K_{p+1}$$ and classify all its vertices as active. At each step, a vertex is deactivated and a new active vertex is introduced and joined to all the remaining active vertices. The order in which vertices are introduced is given by a normalized path decomposition, which can be computed in linear time for a fixed p [22].

### Theorem 3

Every n-vertex graph with pathwidth at most 7 admits a 2.5D-BR, which can be computed in O(n) time.

### Proof

We describe an algorithm to compute a 2.5D-BR of a graph G with pathwidth 7. The algorithm is based on the use of eight groups of rectangles, a subset of which will form the footprint of the 2.5D-BR of G. For graphs with pathwidth $$p < 7$$, the same algorithm can be applied by considering only $$p+1$$ groups, arbitrarily chosen.

The eight groups are defined in the plane $$z=0$$ and have n rectangles each denoted as $$r_{h,1}, r_{h,2}, \dots , r_{h,n}$$ ($$1 \leqslant h \leqslant 8$$). The groups are placed as shown in Fig. 3. The groups $$h =5,6,7,8$$ will be called central groups. A vertex whose footprint is $$r_{h,k}$$ will be called a vertex of group h ($$1 \leqslant h \leqslant 8$$).

Let $$v_1, v_2, \dots , v_n$$ be the vertices of G in the order given by a normalized path decomposition. We denote by $$G_i$$ the subgraph of G induced by $$\{v_1,v_2,\dots ,v_i\}$$. We create a collection of boxes by adding one box per step; at step i we add a box to represent the next vertex $$v_i$$ to be activated. We denote the collection of the first i boxes as $$\varLambda _i$$ and we prove that $$\varLambda _i$$ satisfies the following invariant (I1): $$\varLambda _i$$ is a 2.5D-BR of $$G_i$$ such that for any pair of boxes of group j and k ($$1 \leqslant j,k \leqslant 8$$) that represent vertices that are adjacent in $$G_i$$, there exists a visibility whose projection in the plane $$z=0$$ is inside the region $$\alpha _{j,k}$$. The regions $$\alpha _{j,k}$$ are highlighted in Fig. 3 as dashed regions.

The initial eight active vertices $$v_1, v_2, \dots , v_8$$ are represented by boxes whose footprints are $$r_{1,1}, r_{2,1}, \dots , r_{8,1}$$, respectively. The heights are set as follows: $$h(v_h)=(h-1) \cdot n+1$$, for $$h=1,2,3,4$$, and $$h(v_h)=4n+1$$ for $$h=5,6,7,8$$. The initial eight vertices are shown in Fig. 3 as white rectangles whose heights are shown inside them. $$\varLambda _8$$ satisfies invariant I1 thanks to the visibilities shown in Fig. 3.

Assume now that $$\varLambda _{i-1}$$ ($$i>8$$) satisfies invariant I1 and let $$v_j$$ be the vertex to be deactivated (for some $$j < i$$). Assume that $$v_j$$ belongs to group h ($$1 \leqslant h \leqslant 8$$). Vertex $$v_i$$ is represented as a box with footprint $$r_{h,i}$$ and height $$h(v_i)=h(v_j)+1$$, if $$h \in \{1,3,5,6,7,8\}$$, or $$h(v_i)=h(v_j)-1$$, if $$h \in \{2,4\}$$. If the group of $$v_i$$ is a central group, we increase by one unit the height of all the active vertices of the other central groups. Notice that the heights of the vertices of group h, for $$h \leqslant 4$$, are in the range $$[(h-1) \cdot n+1,h \cdot n]$$, while the heights of the remaining vertices are greater than 4n.

We now prove that $$\varLambda _i$$ satisfies invariant I1 by showing that the addition of $$v_i$$ does not destroy any existing visibility and that $$\varLambda _i(v_i)$$ sees all the other active vertices inside the appropriate regions. We have different cases depending on the group h of $$v_i$$.

$$h=1$$ or $$h=2$$. The box $$\varLambda _i(v_i)$$ only intersects the regions $$\alpha _{h',2}$$, with $$h' \ne 2$$. Thus, the only visibilities that could be destroyed are those inside these regions. The visibilities in the regions $$\alpha _{3,2}$$, $$\alpha _{4,2}$$, $$\alpha _{5,2}$$, $$\alpha _{6,2}$$, $$\alpha _{7,2}$$, and $$\alpha _{8,2}$$ are not destroyed by the addition of $$v_i$$ because the boxes representing the vertices of group 2 are taller than the box representing $$v_i$$ and so are the boxes of any group $$h'$$ with $$h'>2$$. The existing visibilities in the region $$\alpha _{1,2}$$ are not destroyed because $$r_{h,i}$$ is short enough (in the x-direction) so that the existing boxes of groups 1 and 2 can still see each other in region $$\alpha _{1,2}$$. So, no visibility is destroyed for the vertices of group 2. The box $$\varLambda _i(v_i)$$ sees the box of the active vertex of group 1 or 2 via a ground visibility in region $$\alpha _{1,2}$$ and it sees the boxes of all the other active vertices inside the region $$\alpha _{h',1}$$, with $$h' > 2$$, above the boxes of group 1 (which are all shorter than it).

$$h=3$$ or $$h=4$$. The proof of this case is omitted.

$$h=5$$ or $$h=6$$. The box $$\varLambda _i(v_i)$$ only intersect the regions $$\alpha _{h,h'}$$, with $$h' \in \{5,6,7,8\}$$ and $$h' \ne h$$. However, it does not intersect any existing visibility inside these regions and therefore the addition of $$\varLambda _i(v_i)$$ does not destroy any existing visibility. The box $$\varLambda _i(v_i)$$ sees the active vertices of groups 1 and 2 inside $$\alpha _{h,k}$$ (with $$h=5$$ or 6, and $$k = 1,2$$) and above the boxes of group 1. The active vertices of groups 3 and 4 are seen inside $$\alpha _{h,k}$$ (with $$h=5$$ or 6, and $$k = 3,4$$) and above the boxes of group 3. Finally, the active vertices of the central groups are seen inside $$\alpha _{h,k}$$ (with $$h=5$$ or 6, and $$k > 4$$) and above the boxes of group h. Recall that the active vertices of the central groups have been raised to have the same height as $$\varLambda _i(v_i)$$ (which is larger than the height of any other box in the central groups).

$$h=7$$ or $$h=8$$. The proof of this case is omitted.

The above construction can be done in O(n) time. Since the normalized path decomposition can be computed in O(n) time, the time complexity follows.   $$\square$$

## 5 2.5D Grid Box Representations

Next we give a tight bound on the edge density of graphs admitting a 2.5D-GBR. The proof is based on the fact that a set of aligned (unit square) boxes induces an outerplanar graph. A square grid of boxes gives the bound.

### Theorem 4

Every n-vertex graph that admits a 2.5D-GBR has at most $$4n-6\sqrt{n}$$ edges, and this bound is tight.

In the next theorem we prove that deciding whether a given graph admits a 2.5D-GBR with a given footprint is NP-complete. We call this problem 2.5D-GBR-WITH-GIVEN-FOOTPRINT (2.5GBR-WGF). The reduction is from HAMILTONIAN-PATH-FOR-CUBIC-GRAPHS (HPCG), which is the problem of deciding whether a given cubic graph admits a Hamiltonian path [2].

### Theorem 5

Deciding whether a given graph G admits a 2.5D-GBR with a given footprint is NP-complete, even if G is a path.

### Proof sketch:

We first prove that 2.5GBR-WGF is in NP. A candidate solution consists of a mapping of the vertices of G to the squares of the given footprint and a choice of the heights of the boxes. By Lemma 1 we can assign to each box an integer height in the set $$\{1,2,\dots ,n\}$$. Thus the size of a candidate solution is polynomial in the size of the input graph. Given a candidate solution, we can test in polynomial time whether all edges of G are realized as visibilities. Thus, the problem is in NP.

We now describe a reduction from the HPCG problem. Let $$G_H$$ be an instance of the HPCG problem, i.e. a cubic graph, with $$n_H$$ vertices and $$m_H$$ edges. We compute an orthogonal grid drawing $$\varGamma _H$$ of $$G_H$$ such that every edge has exactly one bend and no two vertices share the same x- or y-coordinate. Such a drawing always exists and can be computed in polynomial time with the algorithm by Bruckdorfer et al. [8]. We now use $$\varGamma _H$$ as a trace to construct an instance $$\langle G, F \rangle$$ of the 2.5GBR-WGF problem, where G is a path and F a footprint, i.e., a set of squares. G is a path with $$4n_H+m_H$$ vertices and therefore F will contain $$4n_H+m_H$$ squares. The footprint F is constructed as follows. $$\varGamma _H$$ is scaled up by a factor of four. In this way, every two vertices/bends are separated by at least four grid units. Each vertex v of $$\varGamma _H$$ is replaced by a set S(v) of four unit squares. In particular if vertex v has coordinates (4x, 4y) in $$\varGamma _H$$, then it is replaced by the following four unit squares: $$S_1(v)$$ whose bottom-right corner has coordinates (4x, 4y), $$S_2(v)$$ whose bottom-right corner has coordinates $$(4x+2,4y)$$, $$S_3(v)$$ whose bottom-right corner has coordinates $$(4x,4y-2)$$, and $$S_4(v)$$ whose bottom-right corner has coordinates $$(4x+2,4y-2)$$. We associate with each edge e incident to a vertex v, one of the four squares in S(v). If e enters v from West, North, South, or East, the square associated with e is $$S_1(v)$$, $$S_2(v)$$, $$S_3(v)$$, or $$S_4(v)$$, respectively. Let (uv) be an edge of $$\varGamma _H$$ and let $$S_i(u)$$ and $$S_j(v)$$ ($$1 \leqslant i,j \leqslant 4$$) be the squares associated with (uv). The bend of $$e=(u,v)$$ is replaced by a unit square $$S_{e}$$ horizontally/vertically aligned with $$S_i(u)$$ and $$S_j(v)$$. The set of squares replacing the vertices of $$\varGamma _H$$, which will be called vertex squares in the following, together with the set of squares replacing the bends, which will be called edge squares in the following, form the footprint F. Figure 4 shows an orthogonal drawing of a cubic graph and the corresponding footprint F. Observe that the footprint F is such that any two squares are separated by at least one unit and in each row/column there are at most three squares. Let $$F^*$$ be a graph with a vertex for each square in F and an edge between two squares if and only if the two squares are horizontally or vertically aligned. It can be proved that $$G_H$$ admits a Hamiltonian path if and only if $$F^*$$ contains a Hamiltonian path.

Consider the instance $$\langle G, F \rangle$$ of the 2.5GBR-WGF problem, where G is a path. We prove that G admits a 2.5D-GBR with footprint F if and only if $$F^*$$ admits a Hamiltonian path. Every graph that can be represented by a 2.5D-GBR with footprint F is a spanning subgraph of $$F^*$$ (because $$F^*$$ has all possible edges that can be realized as visibilities in a 2.5D-GBR with footprint F). Thus, if G admits a 2.5D-GBR with footprint F, then G is a Hamiltonian path of $$F^*$$ (recall that G is a path). Suppose now that $$F^*$$ has a Hamiltonian path $$H^*$$. We show that we can choose the heights of the squares in F so that the resulting boxes form a 2.5D-GBR of G. Recall that in each row/column of F there are at most three squares. If an edge connects two squares that are consecutive along a row or column, then any choice of the heights is fine. If an edge connects the first and the last square of a row/column, then the heights of these two squares must be larger than the height of the square in the middle. We assign the heights to one square per step, in the order in which they appear along $$H^*$$. We assign to the first square a height equal to the number of squares (i.e., $$4n_H+m_H$$). Let h be the height assigned to the current square S and let $$S'$$ be the next square along $$H^*$$. If S and $$S'$$ are consecutive along a row/column then the height assigned to $$S'$$ is h. If S and $$S'$$ are the first and the last square of a row/column then the height assigned to $$S'$$ is h. If S is the first/last square of a row/column and $$S'$$ is the middle square of the same row/column, then the height assigned to $$S'$$ is $$h-1$$. If S is the middle square of a row/column and $$S'$$ is the first/last square of the same row/column, then the height assigned to $$S'$$ is $$h+1$$. It is easy to see that all heights are positive and that if an edge connects the first and the last square of a row/column, then the heights of these two squares are greater than the height of the square in the middle. This concludes the proof that G admits a 2.5D-GBR with footprint F if and only if $$F^*$$ admits a Hamiltonian path. Since $$F^*$$ has a Hamiltonian path if and only if $$G_H$$ has a Hamiltonian path, G admits a 2.5D-GBR with footprint F if and only if $$G_H$$ has a Hamiltonian path, which implies that the 2.5GBR-WGF problem is NP-hard.   $$\square$$

## 6 Open Problems

There are several possible directions for further study of 2.5D-BRs. Among them: (i) Study the complexity of deciding if a given graph admits a 2.5D-BR. We remark that deciding if a graph admits an RVR is NP-hard. (ii) Investigate other classes of graphs that admit a 2.5D-BR. For example, do 1-planar graphs or partial 5-trees always admit a 2.5D-BR? We remark that there are both 1-planar graphs and partial 5-trees not admitting an RVR. (iii) Study the 2.5D-BRs under the strong visibility model. For example, which bipartite graphs admit a strong 2.5D-BR?

## References

1. 1.
Ahmed, M.E., Yusuf, A.B., Polin, M.Z.H.: Bar 1-visibility representation of optimal 1-planar graph. Elect. Inf. Comm. Technol. (EICT) 2013, 1–5 (2014)Google Scholar
2. 2.
Akiyama, T., Nishizeki, T., Saito, N.: NP-completeness of the hamiltonian cycle problem for bipartite graphs. J. Inf. Process. 3(2), 73–76 (1980)
3. 3.
Arleo, A., Binucci, C., Di Giacomo, E, Evans, W.S., Grilli, L., Liotta, G., Meijer, H., Montecchiani, F., Whitesides, S., Wismath, S.: Visibility representations of boxes in 2.5 dimensions. CoRR, abs/1608.08899 (2016)Google Scholar
4. 4.
Biedl, T., Liotta, G., Montecchiani, F.: On visibility representations of non-planar graphs. In: Fekete, S., Lubiw, A., (eds.) SoCG 2016, vol. LIPICs, pp. 19:1–19:16. Schloss Dagstuhl - Leibniz-Zentrum fuer Informatik (2016)Google Scholar
5. 5.
Bose, P., Dean, A., Hutchinson, J., Shermer, T.: On rectangle visibility graphs. In: North, S. (ed.) GD 1996. LNCS, vol. 1190, pp. 25–44. Springer, Heidelberg (1997). doi:
6. 6.
Bose, P., Everett, H., Fekete, S.P., Houle, M.E., Lubiw, A., Meijer, H., Romanik, K., Rote, G., Shermer, T.C., Whitesides, S., Zelle, C.: A visibility representation for graphs in three dimensions. J. Graph Algorithms Appl. 2(3), 1–16 (1998)
7. 7.
Brandenburg, F.: 1-visibility representations of 1-planar graphs. J. Graph Algorithms Appl. 18(3), 421–438 (2014)
8. 8.
Bruckdorfer, T., Kaufmann, M., Montecchiani, F.: 1-bend orthogonal partial edge drawing. J. Graph Algorithms Appl. 18(1), 111–131 (2014)
9. 9.
Carmi, P., Friedman, E., Katz, M.J.: Spiderman graph: visibility in urban regions. Comput. Geometry 48(3), 251–259 (2015)
10. 10.
Dean, A.M., Ellis-Monaghan, J.A., Hamilton, S., Pangborn, G.: Unit rectangle visibility graphs. Electr. J. Comb. 15(1), 1–24 (2008)
11. 11.
Dean, A.M., Evans, W., Gethner, E., Laison, J.D., Safari, M.A., Trotter, W.T.: Bar $$k$$-visibility graphs. J. Graph Algorithms Appl. 11(1), 45–59 (2007)
12. 12.
Dean, A.M., Hutchinson, J.P.: Rectangle-visibility representations of bipartite graphs. Discrete Appl. Math. 75(1), 9–25 (1997)
13. 13.
Dean, A.M., Hutchinson, J.P.: Rectangle-visibility layouts of unions and products of trees. J. Graph Algorithms Appl. 2(8), 1–21 (1998)
14. 14.
Dean, A.M., Veytsel, N.: Unit bar-visibility graphs. Congr. Num. 160, 161–175 (2003)
15. 15.
Di Giacomo, E., Didimo, W., Evans, W.S., Liotta, G., Meijer, H., Montecchiani, F., Wismath, S.K.: Ortho-polygon visibility representations of embedded graphs. In: Nöllenburg, M., Hu, Y. (eds.) GD 2016. LNCS, vol. 9801, pp. 280–294. Springer, Heidelberg (2016)Google Scholar
16. 16.
Duchet, P., Hamidoune, Y., Las, M., Vergnas, H.M.: Representing a planar graph by vertical lines joining different levels. Discrete Math. 46(3), 319–321 (1983)
17. 17.
Evans, W., Kaufmann, M., Lenhart, W., Mchedlidze, T., Wismath, S.: Bar 1-visibility graphs and their relation to other nearly planar graphs. J. Graph Algorithms Appl. 18(5), 721–739 (2014)
18. 18.
Cobos, F.J., Dana, J.C., Hurtado, F., Márquez, A., Mateos, F.: On a visibility representation of graphs. In: Brandenburg, F.J. (ed.) GD 1995. LNCS, vol. 1027, pp. 152–161. Springer, Heidelberg (1996). doi:
19. 19.
Fekete, S.P., Meijer, H.: Rectangle and box visibility graphs in 3D. Int. J. Comput. Geometry Appl. 9(1), 1–28 (1999)
20. 20.
Felsner, S., Massow, M.: Parameters of bar $$k$$-visibility graphs. J. Graph Algorithms Appl. 12(1), 5–27 (2008)
21. 21.
Garey, M.R., Johnson, D.S., So, H.C.: An application of graph coloring to printed circuit testing. IEEE Trans. Circuits Syst. CAS–23(10), 591–599 (1976)
22. 22.
Gupta, A., Nishimura, N., Proskurowski, A., Ragde, P.: Embeddings of $$k$$-connected graphs of pathwidth $$k$$. Discrete Appl. Math. 145(2), 242–265 (2005)
23. 23.
Hutchinson, J.P., Shermer, T., Vince, A.: On representations of some thickness-two graphs. Comp. Geometry 13(3), 161–171 (1999)
24. 24.
Kant, G., Liotta, G., Tamassia, R., Tollis, I.G.: Area requirement of visibility representations of trees. Inf. Process. Lett. 62(2), 81–88 (1997)
25. 25.
Kleitman, J.D., Gyárfás, A., Tóth, G.: Convex sets in the plane with three of every four meeting. Combinatorica 21(2), 221–232 (2001)
26. 26.
Liotta, G., Montecchiani, F.: L-visibility drawings of IC-planar graphs. Inf. Process. Lett. 116(3), 217–222 (2016)
27. 27.
Otten, R.H.J.M., Van Wijk, J.G.: Graph representations in interactive layout design. In: IEEE ISCSS, pp. 91–918. IEEE (1978)Google Scholar
28. 28.
Rosenstiehl, P., Tarjan, R.E.: Rectilinear planar layouts and bipolar orientations of planar graphs. Discrete Comput. Geom. 1, 343–353 (1986)
29. 29.
Shermer, T.C.: On rectangle visibility graphs III. external visibility and complexity. In: Canadian Conference on Computational Geometry, pp. 234–239 (1996)Google Scholar
30. 30.
Štola, J.: Unimaximal sequences of pairs in rectangle visibility drawing. In: Tollis, I.G., Patrignani, M. (eds.) GD 2008. LNCS, vol. 5417, pp. 61–66. Springer, Heidelberg (2009). doi:
31. 31.
Streinu, I., Whitesides, S.: Rectangle visibility graphs: characterization, construction, and compaction. In: Alt, H., Habib, M. (eds.) STACS 2003. LNCS, vol. 2607, pp. 26–37. Springer, Heidelberg (2003). doi:
32. 32.
Sultana, S., Rahman, M.S., Roy, A., Tairin, S.: Bar 1-visibility drawings of 1-planar graphs. In: Gupta, P., Zaroliagis, C. (eds.) ICAA 2014. LNCS, pp. 62–76. Springer International Publishing, New York (2014). doi: Google Scholar
33. 33.
Tamassia, R., Tollis, I.G.: A unified approach to visibility representations of planar graphs. Discrete Comput. Geom. 1(1), 321–341 (1986)
34. 34.
Tamassia, R., Tollis, I.G.: Representations of graphs on a cylinder. SIAM J. Discrete Math. 4(1), 139–149 (1991)
35. 35.
Thomassen, C.: Plane representations of graphs. In: Progress in Graph Theory, pp. 43–69. AP (1984)Google Scholar
36. 36.
Wismath, S.K.: Characterizing bar line-of-sight graphs. In: Proceedings of 1st Symposium on Computational Geometry, pp. 147–152 (1985)Google Scholar

© Springer International Publishing AG 2016

## Authors and Affiliations

1. 1.Università degli Studi di PerugiaPerugiaItaly