A visibility representation of a graph is a set of disjoint geometric objects representing vertices chosen from a family of allowed objects (e.g., axis-aligned rectangles in the plane) where sees if and only if . Typically, the meaning of “sees” is that there exists a line segment (perhaps axis-aligned, perhaps positive width) from to that does not intersect for any other ; such a line segment is called a line-of-sight. Many different classes of visibility representations may be defined by changing the family of allowed objects and the meaning of “sees.” For example, bar visibility representations (BVRs) use horizontal line segments as vertices and vertical lines-of-sight for edges [9, 11, 21, 20, 7, 14, 15]; rectangle visibility representations (RVRs) use (solid) axis-aligned rectangles as vertices and axis-aligned lines-of-sight for edges [8, 22, 18, 2, 5, 16]; and unit square visibility representations (USVRs) use axis-aligned unit squares and axis-aligned lines-of-sight for edges . The popularity of this type of graph representation lies partly in its potential applicability to problems in VLSI design and the production of readable representations of planar and non-planar graphs. Determining which graphs or families of graphs have visibility representations of a particular type is a fascinating area of research.
Our focus in this work is on the simultaneous visibility representation of pairs of graphs that share the same vertex set (see Fig. 1). A simultaneous visibility representation (SVR) of and is a visibility representation that, using vertical lines-of-sight, represents and, using horizontal lines-of-sight, represents . Streinu and Whitesides  describe a beautiful connection between a pair of directed planar graphs and their planar duals that determines if the pair has a directed simultaneous visibility representation using rectangles (a directed RSVR) , where an edge directed from to in or is realized by a low-to-high or left-to-right, respectively, line-of-sight from to . Evans et al.  extended this to the family of geometric objects called L-shapes, which are the union of two axis-aligned segments in the plane that share a common endpoint and come in four orientations: . They gave a polynomial time algorithm for determining if a pair of directed graphs has a directed simultaneous visibility representation using L-shapes, , in which the orientation of is given by (a directed -LSVR).
The complexity of determining if a pair of undirected graphs has a simultaneous visibility representation using L-shapes was stated as an open problem . In this paper, we show (Section 3) that the problem is -complete. What is surprising about this result is the simplicity of the graphs for which the problem is hard: For L-shapes (and many other families of shapes including rectangles), one graph can be a set of disjoint paths and the other a set of disjoint copies of a tree with 3 leaves connected to a root by paths of length 2 (). For unit squares (and for translates of any specified connected shape with positive width and height), one graph can be a set of disjoint paths and the other a set of disjoint claws ().
This limits the families of graphs for which we can reasonably hope to efficiently determine a simultaneous visibility representation. We describe a linear time algorithm (Section 4) that can determine if a pair of undirected paths has a simultaneous visibility representation using L-shapes, all with the same orientation (an LSVR). The algorithm is quite simple but relies on characterizing those pairs of paths for which such a representation is possible. Note that determining the same question for representations using rectangles, unit squares, and L-shapes with more than one orientation is easy.
Our work has aspects of both visibility representation and simultaneous geometric graph embedding (SGE). SGE is the problem of deciding, given a set of planar graphs on the same set of vertices, whether the vertices can be placed in the plane so that each graph has a straight-line drawing on the placed vertices. As in our problem, SGE, which is -hard , asks to represent several specified graphs using one common vertex set representation. However, the hardness result for SGE does not directly imply hardness of deciding simultaneous visibility representation. Similarly, deciding if a graph has an RVR  or a USVR  is -hard, but since the input does not specify which edges should be realized as vertical versus horizontal lines-of-sight, the problems are quite different. Choosing how the graph should be split into vertical and horizontal parts is an additional opportunity (or burden) for deciding if these representations exist.
Rather than requiring the visibility representation to partition the edges of the graph in a prescribed manner between vertical and horizontal visibilities, Beidl et al.  require that the visibility edges (lines-of-sight) obey the same embedding as a prescribed embedding of the original graph, which may include edge crossings. They can decide if such a restricted RVR exists in polynomial time, and in linear time if the graph is 1-planar. Di Giacomo et al.  show that deciding if a similarly restricted ortho-polygon111a polygon whose edges are axis-aligned. visibility representation exists for a given embedded graph takes polynomial time as well.
In this paper, we will assume that vertex shapes are connected and closed (rather than open) sets in the plane, and that lines-of-sight are 0-width (rather than positive-width) and exist between two shapes if and only if the corresponding vertices are connected by an edge. This implies that and must have strong-visibility representations  to have a simultaneous visibility representation. For visibility graphs, these choices make a difference since, for example, can be represented if lines-of-sight are positive-width (an -visibility representation) but does not have a strong-visibility representation . However, for our results, we could adopt either model with only minor modifications to our proofs.
Let be an SVR of . Given a subset , we let . For a vertex , let and be the orthogonal projections of onto the -axis and -axis respectively. For a set of vertices , let and . Set , , , and . We write if , and similarly, if . We also use the shorthand for . What follows are three basic properties of visibility representations. See Fig. (a)a for an illustration of Property 2.
Note: For brevity, the following properties are stated for vertical visibility representations only but also hold for horizontal visibility representations by symmetry.
In a (vertical) visibility representation of a graph , for any and any there exists a path in from to for some and such that for all .
Consider the intersection of and the infinite vertical line . Since this line intersects both and , there must be two vertices and such that and both intersect the line. Let be the sequence of vertices in that intersect the line in order along the line from to . and have an unblocked vertical visibility segment between them for all , which implies a path between and that connects and in .
In a (vertical) visibility representation of a graph , if an endpoint of is strictly contained in and for , then there is a cycle in .
Since an endpoint of is strictly contained in , there exists and such that . By Property 1, there exists a path from to (following the vertical line through ) that, since , contains , and a path from to (following the vertical line through ) that does not contain . The union of these two paths contains a cycle.
In a (vertical) visibility representation of a graph , if is the only path from to in and and are both above or both below for , then .
If , then by Property 1, there exists a path from to (following the vertical line through ) that, since and are both above or both below , does not include , a contradiction.
In this section, we study the complexity of determining if a pair of undirected graphs has a simultaneous visibility representation. We consider two variants of this problem: (i) using unit squares (Section 3.1) and (ii) using rectangles (Section 3.2). Our techniques easily generalize to other connected shapes. In the case of L-shapes, our results settle an open question of Evans et al. .
Let be a connected graph with a (vertical) visibility representation . If is a cut vertex whose removal from creates components then for at most two components .
Since is connected, intersects and if in addition , then since is connected, is a contiguous interval that strictly contains an endpoint of . If three components have this property then for two of them, say and , and strictly contain the same endpoint and thus contain a point . By Property 1, contains a path (following the vertical line through ) between and that does not contain , a contradiction.
Let be a graph with a (vertical) visibility representation . If and are two components in then either 333 means for all and , or vice versa.
Since each component is connected, its -projection forms a contiguous interval. And yet since and are disconnected in , by Property 1, . Thus either , or vice versa.
3.1 USSVR recognition
In this section, we prove that determining if a pair of undirected graphs has a simultaneous visibility representation using unit squares (USSVR) is -complete. We reduce from the well-known -complete problem of Monotone Not-All-Equal 3SAT . In this variant of 3SAT, every clause has three positive literals of which exactly one or two must be satisfied.
The main result of this section can be summarized as follows.
Deciding if a pair of undirected graphs has a USSVR is -complete.
Construction. Let be an instance of Monotone Not-All-Equal 3SAT with clauses and variables . For convenience, let us denote the variables appearing in clause as and the corresponding literals as . We construct a pair of graphs and such that admits a USSVR if and only if is satisfiable.
Order and its literals according to the order in which they appear in . For each clause , we create a clause vertex and three literal vertices . Our reduction relies on two types of gadgets which we describe below.
Satisfiability Gadgets. For each clause , we construct a satisfiability gadget, denoted , by introducing edges for .
Consistency Gadgets. For each variable with corresponding literals (in order), we construct a variable consistency gadget, denoted , by introducing edges for all . Similarly, if are the clauses of (in order), we construct a clause consistency gadget, denoted , by introducing edges for all .
Intuitively, the satisfiability gadgets allow us to encode local constraints on the literals for each clause. We use this to enforce “not-all-equal” satisfiability. By contrast, the consistency gadgets allow us to encode global constraints that span multiple clauses; i.e., relating literals that correspond to the same variable. This completes our construction of ; see Fig. 3 for an example.
Correctness. Lemmas 3 and 4 establish the correctness of our reduction. Hence, since our construction of requires time, USSVR recognition is -hard. Note that every USSVR can be redrawn on an grid such that its visibilities are not changed by preserving the order of the endpoints in the and -projections of its unit squares . This gives a certificate using polynomially-many bits that can be readily verified in polynomial time. Thus, USSVR recognition is -complete.
If admits a USSVR, then is satisfiable.
Let be a USSVR for . We construct a truth assignment as follows. For every variable , we define
We claim that satisfies . To see this, let us consider any clause . By construction, is a cut vertex whose removal from creates three components, each containing one literal vertex that is adjacent to . Then by Lemma 1, for at least one such vertex, say , . But in fact, since is a USSVR, we have . Hence, for every , .
Applying Property 3, we see that and must not be both above or both below . Moreover, since every consistency gadget in our construction is a component of , Lemma 2 implies that for all variables , either , or vice versa. Therefore, either for , implying that satisfies exactly one literal in , or , implying that satisfies exactly two. By repeating this argument for all clauses in , we see that satisfies .
If is satisfiable, then admits a USSVR.
Let be a truth assignment satisfying . To construct a USSVR for , we first represent and as two sets of intervals on the and -axes respectively. The construction of these intervals is as follows.
Suppose are the clauses of in order. For each clause , since satisfies exactly one or two of its literals, there must be one, say , that attains a unique truth value. We represent both and on the -axis by the interval . Moreover, assuming and are in order, we represent their corresponding literal vertices on the -axis as the intervals and respectively, for some positive but small .
Let be a bijection satisfying if and only if for each . For each variable consistency gadget , we represent its vertices on the -axis by the interval . We also represent the clause consistency gadget similarly, replacing with .
Observe that each vertex in is represented by two unit intervals, one on the -axis and one on the -axis. Thus, for each , we can define to be the Cartesian product of its two corresponding intervals. To see that this gives a valid USSVR for , we make three observations.
Every gadget in (resp., occupies a contiguous interval on the -axis (resp., -axis) that is disjoint from the intervals of other gadgets.
Every satisfiability gadget in for a clause is drawn such that blocks vertical visibility between and for .
Every consistency gadget in is drawn as a horizontal stack of unit squares (in order from left to right) that share a -projection.
The first observation implies that no two gadgets in (resp., ) share an (unwanted) visibility. The next two observations mean that the implied visibilities for each gadget in and are realized exactly. Therefore, is indeed a valid USSVR for . See Fig. 3 for an example construction.
3.2 RSVR recognition
In this section, we present an alternate reduction to prove that determining if a pair of undirected graphs has a simultaneous visibility representation using rectangles (RSVR) is -complete. In contrast to the proof given in Section 3.1, here, we reduce from the well-known -complete problem of 3SAT .
Our modified construction is not much more complicated than before: one graph remains a set of disjoint paths while the other is a set of disjoint trees with 3 leaves connected to a root by paths of length 2. This slight modification allows us to prove the following theorem.
Deciding if a pair of undirected graphs has an RSVR is -complete.
Construction. Let be an instance of 3SAT with clauses and variables . As before, we denote the variables appearing in clause as and the corresponding literals as .
We adapt the gadgets used in Section 3.1 to this setting as follows. For each clause , we create three additional negated literal vertices and augment by introducing three edges for . Also, for each variable with corresponding literals (in order), we construct a negated variable consistency gadget, denoted , by introducing edges for all . See Fig. 4 for an example.
If admits an RSVR, then is satisfiable.
Let be an RSVR for . If, for some variable , we have , or vice versa, we say that is positively-arranged in . We construct a truth assignment as follows. For each variable , we define
We claim that satisfies . To see this, let us consider any clause . By construction, is a cut vertex whose removal from creates three components, each containing one literal vertex and its negated counterpart. Then by Lemma 1, for at least one literal, say , we have . Hence, .
Applying Property 3, we see that and must not be both above or both below . Moreover, since the consistency gadgets in our construction are components of , Lemma 2 implies that their -projections must form disjoint intervals. Therefore, either , or vice versa. Thus, if (i.e., is positive), then is positively-arranged in ; otherwise, implies that is not positively-arranged in . In either case, satisfies . By repeating this argument for all clauses in , we see that satisfies .
If is satisfiable, then admits an RSVR.
Let be a truth assignment satisfying . To construct an RSVR for , we first represent and as two sets of intervals on the and -axes respectively. The construction of these intervals is as follows.
Suppose are the clauses of in order. For each clause , we represent on the -axis by the interval . Next, for one of the satisfied literals in , say , we represent both and on the -axis by the interval . Finally, assuming that and are in order, we represent and on the -axis by the intervals and respectively, for some positive but small . Similarly, we represent and by the intervals and respectively.
Now, suppose are the variables of in an arbitrary order. For each variable , if , we represent the vertices in and on the -axis by the intervals and . Otherwise, if , we simply swap the intervals and proceed as before. Finally, we represent every vertex in on the -axis by the interval .
Observe that each vertex in is represented by two (nonempty) intervals, one on the -axis and one on the -axis. Thus, for every , we can define to be the Cartesian product of its two corresponding intervals. To see this gives a valid RSVR for , we make three observations.
Every gadget in (resp., ) occupies a contiguous interval on the -axis (resp., -axis) that is disjoint from the intervals of other gadgets.
Every satisfiability gadget in for a clause