This paper was converted on www.awesomepapers.org from LaTeX by an anonymous user.
Want to know more? Visit the Converter page.

Linking disjoint segments into a simple polygon is hard

Rain Jiang [Uncaptioned image]  Kai Jiang [Uncaptioned image]  Minghui Jiang [Uncaptioned image]
Home School, USA
dr.minghui.jiang at gmail.com
Abstract

Deciding whether a family of disjoint line segments in the plane can be linked into a simple polygon (or a simple polygonal chain) by adding segments between their endpoints is NP-hard.

1 Introduction

Given a family 𝒮\mathcal{S} of nn closed line segments in the plane, Simple Circuit (respectively, Simple Path) is the problem of deciding whether these segments can be linked into a simple polygon (respectively, a simple polygonal chain) by adding segments between their endpoints.

Rappaport [4] proved that Simple Circuit is NP-hard if the segments in 𝒮\mathcal{S} are allowed to intersect at their common endpoints, and asked whether the problem remains NP-hard when the segments are disjoint. Later, Bose, Houle, and Toussaint [3] asked whether the related problem Simple Path is NP-hard when the segments in 𝒮\mathcal{S} are disjoint. More recently, Tóth [6] asked about the complexity of Simple Path again, with a special interest in the case when the segments in 𝒮\mathcal{S} are both disjoint and axis-parallel.

In this note, we prove the following theorem:

Theorem 1.

Simple Circuit and Simple Path are both NP-hard even if the segments in 𝒮\mathcal{S} are disjoint and have only four distinct orientations.

We prove the theorem in two steps. First, we modify the construction in Rappaport’s proof of NP-hardness of Simple Circuit on not necessarily disjoint segments [4] to show that the problem remains NP-hard on disjoint segments. Next, we modify the construction further to prove that Simple Path is also NP-hard on disjoint segments. In the following, we briefly review Rappaport’s proof, which is based on a polynomial reduction from the NP-hard problem Hamiltonian Path in planar cubic graphs.

For any family 𝒮\mathcal{S} of closed segments in the plane, denote by V(𝒮)V(\mathcal{S}) the set of endpoints of the segments in 𝒮\mathcal{S}. For any two endpoints pp and qq in V(𝒮)V(\mathcal{S}), we call the open segment pqpq a visibility edge if it does not intersect any closed segment in 𝒮\mathcal{S}.

Given a planar cubic graph GG with n4n\geq 4 vertices, the reduction [4] first obtains a rectilinear planar layout of the planar graph using an algorithm of Rosenstiehl and Tarjan [5], then constructs a family 𝒮\mathcal{S} of O(n)O(n) segments following the rectilinear planar layout, such that GG admits a Hamiltonian path if and only if 𝒮\mathcal{S} can be linked into a simple polygon by adding visibility edges between points in V(𝒮)V(\mathcal{S}). The segments in 𝒮\mathcal{S} are axis-parallel and interior-disjoint, but may intersect at common endpoints. Each endpoint in V(𝒮)V(\mathcal{S}) is incident to at most one horizontal segment and at most one vertical segment in 𝒮\mathcal{S}. Since the rectilinear planar layout is of width at most 2n42n-4 and of height at most nn [5], all coordinates of endpoints in V(𝒮)V(\mathcal{S}) are integers of magnitude O(n2)O(n^{2}); indeed a closer look at the construction [4, Figure 8] shows that V(𝒮)[1,22n2]×[1,11n]V(\mathcal{S})\subseteq[1,22n^{2}]\times[1,11n]. The reduction is hence strongly polynomial. Consequently, Simple Circuit is strongly NP-hard, on not necessarily disjoint segments.

2 Modification for Simple Circuit

To show that Simple Circuit remains strongly NP-hard on disjoint segments, we will transform the family 𝒮\mathcal{S} of interior-disjoint axis-parallel segments, which Rappaport constructed, into a family 𝒮\mathcal{S}^{\prime} of disjoint segments with four distinct orientations, in polynomial time, such that 𝒮\mathcal{S} can be linked into a simple polygon if and only if 𝒮\mathcal{S}^{\prime} can be linked into a simple polygon. This transformation can be viewed as a reduction from Simple Circuit on one type of input to the same problem on another type of input.

Refer to caption
Figure 1: Gadgets for intersections of four different orientations.

To obtain 𝒮\mathcal{S}^{\prime} from 𝒮\mathcal{S}, we first scale the integer coordinates of all segment endpoints by a factor of 4040, then locally modify each intersection between a horizontal segment and a vertical segment into a gadget. The gadgets come in four variants, one for each possible orientation of an intersection; see Figure 1. For a global picture of these modifications on a rectilinear simple polygon with intersections of all four different orientations, refer to Figure 2.

Refer to caption
Figure 2: Local modifications of the intersections a rectilinear simple polygon into gadgets of disjoint segments.
Refer to caption
Refer to caption
Figure 3: The gadget for the intersection oo between a horizontal segment oaoa and a vertical segment obob. Left: The coordinates of the segment endpoints relative to oo are o=(0,0)o=(0,0), o=(4,0)o^{\prime}=(-4,0), o′′=(0,1)o^{\prime\prime}=(0,1), a=(16,1)a^{\prime}=(16,1), b=(1,16)b^{\prime}=(1,16), A1=8×[3,7]A_{1}=8\times[3,7], B1=9×[4,5]B_{1}=9\times[4,5], A2=[3,7]×8A_{2}=[3,7]\times 8, B2=[4,5]×9B_{2}=[4,5]\times 9. The lower endpoint a1a_{1} of A1A_{1} is collinear with the two points oo^{\prime} and o′′o^{\prime\prime}. Right: An alternating path of segments and visibility edges in the gadget after extending A1A_{1} to A1A^{\prime}_{1}. The lower endpoint a1a^{\prime}_{1} of A1A^{\prime}_{1} can see the segment oao^{\prime}a at the endpoint oo^{\prime}.

By symmetry, it suffices to describe in detail only one variant of the gadget. Refer to Figure 3. For the intersection oo between a horizontal segment oaoa and a vertical segment obob, where oo is the left endpoint of oaoa and the lower endpoint of obob, the corresponding gadget is constructed as follows. First, separate the two segments oaoa and obob into two disjoint segments oao^{\prime}a and o′′bo^{\prime\prime}b, by splitting their common endpoint oo, then moving one to oo^{\prime} and the other to o′′o^{\prime\prime}. Next, add five disjoint segments A1A_{1}, B1B_{1}, A2A_{2}, B2B_{2}, and aba^{\prime}b^{\prime}. Finally, extend the segment A1A_{1} to a slightly longer segment A1A^{\prime}_{1} by moving its lower endpoint down for a distance of δ=1800n2\delta=\frac{1}{800n^{2}}, from a1=(8,3)a_{1}=(8,3) to a1=(8,3δ)a^{\prime}_{1}=(8,3-\delta).

In the presence of 𝒮\mathcal{S}^{\prime}, we say that two points pp and qq can see each other if the open segment pqpq is disjoint from all closed segments in 𝒮\mathcal{S}^{\prime}, and we say that two segments AA and BB in 𝒮\mathcal{S}^{\prime} can see each other if at least one of the four pairs of endpoints, one of AA and one of BB, can see each other. The gadgets we constructed have the following property of mutual invisibility:

Lemma 1.

The four segments A1A^{\prime}_{1}, B1B_{1}, A2A_{2}, and B2B_{2} in each gadget cannot see any segments in other gadgets. Moreover, in each gadget, B1B_{1} can only see A1A^{\prime}_{1} and aba^{\prime}b^{\prime}, B2B_{2} can only see A2A_{2} and aba^{\prime}b^{\prime}, A2A_{2} cannot see oao^{\prime}a and can see o′′bo^{\prime\prime}b only at o′′o^{\prime\prime}, and A1A^{\prime}_{1} can see oao^{\prime}a only at oo^{\prime}.

Refer to caption
Figure 4: The narrow viewing angle from a1a^{\prime}_{1} between oo^{\prime} and o′′o^{\prime\prime}.
Proof.

Clearly none of the eight endpoints of A1,B1,A2,B2A_{1},B_{1},A_{2},B_{2} in any gadget can see any endpoint outside the gadget. After extending A1A_{1} to A1A^{\prime}_{1} by moving its lower endpoint from a1a_{1} to a1a^{\prime}_{1}, the endpoint a1a^{\prime}_{1} may see outside the gadget only through the gap between oo^{\prime} and o′′o^{\prime\prime}. Refer to Figure 4.

We next show that a1a^{\prime}_{1} still cannot see any integer endpoints from other gadgets. Note that |a1a1|=δ|a_{1}a^{\prime}_{1}|=\delta, |o′′a1|>8|o^{\prime\prime}a^{\prime}_{1}|>8, and o′′a1a1>π/2\angle o^{\prime\prime}a^{\prime}_{1}a_{1}>\pi/2. Thus

a1o′′a1<tana1o′′a1<|a1a1||o′′a1|<δ/8.\angle a_{1}o^{\prime\prime}a^{\prime}_{1}<\tan\angle a_{1}o^{\prime\prime}a^{\prime}_{1}<\frac{|a_{1}a^{\prime}_{1}|}{|o^{\prime\prime}a^{\prime}_{1}|}<\delta/8.

Consider the ray that starts from o′′o^{\prime\prime} and goes through oo^{\prime}. Rotate this ray clockwise about o′′o^{\prime\prime} for a positive angle till it goes through another integer point pp in V(𝒮)V(\mathcal{S}^{\prime}). The area of the triangle oo′′po^{\prime}o^{\prime\prime}p is at least 1/21/2 since all three endpoints have integer coordinates. Recall that the endpoints of all segments in 𝒮\mathcal{S} are in the range [1,22n2]×[1,11n][1,22n^{2}]\times[1,11n], and is scaled by a factor of 4040 by the transformation from 𝒮\mathcal{S} to 𝒮\mathcal{S}^{\prime}. Thus we have |po′′|<40(22n2+11n)<4032n2|po^{\prime\prime}|<40\cdot(22n^{2}+11n)<40\cdot 32n^{2} for n2n\geq 2. Also note that |oo′′|<5|o^{\prime}o^{\prime\prime}|<5. Thus

oo′′p>sinoo′′p=2area(oo′′p)|oo′′||po′′|>154032n2=18800n2=δ/8.\angle o^{\prime}o^{\prime\prime}p>\sin\angle o^{\prime}o^{\prime\prime}p=\frac{2\cdot\mathrm{area}(o^{\prime}o^{\prime\prime}p)}{|o^{\prime}o^{\prime\prime}|\cdot|po^{\prime\prime}|}>\frac{1}{5\cdot 40\cdot 32n^{2}}=\frac{1}{8\cdot 800n^{2}}=\delta/8. (1)

Therefore we have a1o′′a1<oo′′p\angle a_{1}o^{\prime\prime}a^{\prime}_{1}<\angle o^{\prime}o^{\prime\prime}p. Since the three points oo^{\prime}, o′′o^{\prime\prime}, and a1a_{1} are collinear, this inequality implies that the line through a1a^{\prime}_{1} and o′′o^{\prime\prime} splits the angle oo′′p\angle o^{\prime}o^{\prime\prime}p. Thus the cone with the angle oa1o′′\angle o^{\prime}a^{\prime}_{1}o^{\prime\prime} does not contain in its interior any integer endpoints in V(𝒮)V(\mathcal{S}^{\prime}). Thus a1a^{\prime}_{1} cannot see any integer endpoints from other gadgets.

Moreover, no two endpoints a1a^{\prime}_{1} from two different gadgets can see each other, because the narrow ranges of slopes of viewing lines through a1a^{\prime}_{1}, as illustrated by the dotted lines in Figure 1, are disjoint for intersections of different orientations.

The remaining claims of the lemma are easy to verify. ∎

The following lemma shows that our local transformation preserves linkability:

Lemma 2.

𝒮\mathcal{S} can be linked into a simple polygon if and only if 𝒮\mathcal{S}^{\prime} can be linked into a simple polygon.

Proof.

We first prove the direct implication. Suppose that 𝒮\mathcal{S} can be linked into a simple polygon. For each visibility edge of this polygon between two endpoints in V(𝒮)V(\mathcal{S}), we add a visibility edge between the corresponding endpoints in V(𝒮)V(\mathcal{S}^{\prime}). For each endpoint oo incident to two segments oaoa and obob in 𝒮\mathcal{S}, we link the segments in the corresponding gadget in 𝒮\mathcal{S}^{\prime} following the alternating path as illustrated in Figure 3 right. Then 𝒮\mathcal{S}^{\prime} is also linked into a simple polygon.

We next prove the reverse implication. Suppose that 𝒮\mathcal{S}^{\prime} can be linked into a simple polygon. Recall Lemma 1. In any gadget, B1B_{1} can only see A1A^{\prime}_{1} and aba^{\prime}b^{\prime}, and B2B_{2} can only see A2A_{2} and aba^{\prime}b^{\prime}. Thus aba^{\prime}b^{\prime} must be linked to both B1B_{1} and B2B_{2}, which are linked to A1A^{\prime}_{1} and A2A_{2}, respectively. This chain can extend further only to oao^{\prime}a and o′′bo^{\prime\prime}b, respectively, since A2A_{2} cannot see oao^{\prime}a. Thus the seven segments in each gadget must be linked consecutively in the simple polygon along the sequence oa,A1,B1,ab,B2,A2,o′′bo^{\prime}a,A^{\prime}_{1},B_{1},a^{\prime}b^{\prime},B_{2},A_{2},o^{\prime\prime}b. Then, following the other visibility edges of the simple polygon through 𝒮\mathcal{S}^{\prime}, which are outside and between the gadgets, 𝒮\mathcal{S} can be linked into a simple polygon too. ∎

Recall that the coordinates of endpoints in V(𝒮)V(\mathcal{S}) are integers of magnitude O(n2)O(n^{2}). After the transformation, all endpoints in V(𝒮)V(\mathcal{S}^{\prime}) except a1a^{\prime}_{1} have integer coordinates too. We can scale all coordinates by another factor of 1/δ=800n21/\delta=800n^{2}, so that all endpoints in V(𝒮)V(\mathcal{S}^{\prime}) including a1a^{\prime}_{1} have integer coordinates of magnitude O(n4)O(n^{4}), and the reduction remains strongly polynomial. Thus Simple Circuit is strongly NP-hard, even if the input segments are disjoint and have only four distinct orientations.

3 Modification for Simple Path

To prove that Simple Path is also NP-hard, we use almost the same transformation from 𝒮\mathcal{S} to 𝒮\mathcal{S}^{\prime} as before, except two changes:

  1. 1.

    Increase the initial scaling factor from 4040 to 8080, and correspondingly decrease the distance δ\delta between a1a_{1} and a1a^{\prime}_{1} from 1800n2\frac{1}{800n^{2}} to 11600n2\frac{1}{1600n^{2}} when constructing the gadgets.

  2. 2.

    Select an arbitrary gadget as illustrated in Figure 3, and replace it by an extended gadget as illustrated in Figure 5.

The purpose of the first change is to make room for additional segments in the extended gadget. Updating the scaling factor and the distance δ\delta together ensures that (1) still holds, and hence Lemma 1 remains valid. Clearly, the reduction remains strongly polynomial.

Refer to caption
Refer to caption
Figure 5: The extended gadget for the intersection oo between a horizontal segment oaoa and a vertical segment obob. Left: The coordinates of the points relative to oo are o=(0,0)o=(0,0), o=(4,0)o^{\prime}=(-4,0), o′′=(0,1)o^{\prime\prime}=(0,1), a=(16,1)a^{\prime}=(16,1), b=(1,16)b^{\prime}=(1,16), A1=8×[3,7]A_{1}=8\times[3,7], B1=9×[4,5]B_{1}=9\times[4,5], A2=[3,7]×8A_{2}=[3,7]\times 8, B2=[4,5]×9B_{2}=[4,5]\times 9, a′′=(32,1)a^{\prime\prime}=(32,1), b′′=(1,32)b^{\prime\prime}=(1,32), A3=[10,15]×9A_{3}=[10,15]\times 9, B3=[12,13]×8B_{3}=[12,13]\times 8, A4=9×[10,15]A_{4}=9\times[10,15], B4=8×[12,13]B_{4}=8\times[12,13], A5=16×[10,15]A_{5}=16\times[10,15], B5=17×[12,13]B_{5}=17\times[12,13], A6=[10,15]×16A_{6}=[10,15]\times 16, B6=[12,13]×17B_{6}=[12,13]\times 17. Right: An alternating path starting and ending in the extended gadget.

We have the following lemma analogous to Lemma 2:

Lemma 3.

𝒮\mathcal{S} can be linked into a simple polygon if and only if 𝒮\mathcal{S}^{\prime} can be linked into a simple polygonal chain.

Proof.

We first prove the direct implication. Suppose that 𝒮\mathcal{S} can be linked into a simple polygon. We link the segments in 𝒮\mathcal{S}^{\prime} as before, except that in the extended gadget we link the segments as illustrated in Figure 5 right. Then 𝒮\mathcal{S}^{\prime} is linked into a simple polygonal chain starting and ending in the extended gadget.

We next prove the reverse implication. Suppose that 𝒮\mathcal{S}^{\prime} can be linked into a simple polygonal chain. In the extended gadget, B1B_{1} can only see A1A^{\prime}_{1} and aba^{\prime}b^{\prime}, B2B_{2} can only see A2A_{2} and aba^{\prime}b^{\prime}, and moreover for i{3,4,5,6}i\in\{3,4,5,6\}, BiB_{i} can only see AiA_{i}, aba^{\prime}b^{\prime}, and a′′b′′a^{\prime\prime}b^{\prime\prime}. Since aba^{\prime}b^{\prime} and a′′b′′a^{\prime\prime}b^{\prime\prime} together can be linked to at most four other segments in the polygonal chain, and since the polygonal chain has only two vertices of degree one, it follows that among the six segments BiB_{i}, 1i61\leq i\leq 6, each of aba^{\prime}b^{\prime} and a′′b′′a^{\prime\prime}b^{\prime\prime} must be linked to two distinct segments, and the polygonal chain must start and end at the other two segments. Thus the 1212 segments A1,B1,A2,B2,A3,B3,A4,B4,A5,B5,A6,B6A^{\prime}_{1},B_{1},A_{2},B_{2},A_{3},B_{3},A_{4},B_{4},A_{5},B_{5},A_{6},B_{6}, and the two segments ab,a′′b′′a^{\prime}b^{\prime},a^{\prime\prime}b^{\prime\prime}, are all linked locally to each other in the extended gadget, and they are then linked to oao^{\prime}a and o′′bo^{\prime\prime}b, respectively, at oo^{\prime} and o′′o^{\prime\prime}. As before, in each gadget other than this extended gadget, the seven segments must be linked consecutively along the sequence oa,A1,B1,ab,B2,A2,o′′bo^{\prime}a,A^{\prime}_{1},B_{1},a^{\prime}b^{\prime},B_{2},A_{2},o^{\prime\prime}b. Then, following the other visibility edges of the simple polygonal chain through 𝒮\mathcal{S}^{\prime}, which are outside and between the gadgets, 𝒮\mathcal{S} can be linked into a simple polygon. ∎

Thus Simple Path is also NP-hard. This completes the proof of Theorem 1.

Postscript

In SoCG 2019, Akitaya et al. [1, 2] presented a proof of the NP-hardness of Simple Circuit using a gadget very similar to ours. We thank Adrian Dumitrescu for bringing it to our attention.

Compare [1, Figure 13] and [2, Figure 19] with our Figure 3. Note in particular that their p4p5p_{4}p_{5} and p12p13p_{12}p_{13} correspond to our A2A_{2} and A1A_{1}, their p2p^{\prime}_{2} and p2p_{2} correspond to our o′′o^{\prime\prime} and oo^{\prime}, and their properties (i) and (ii) correspond to our Lemma 1. The main idea behind the internal connections of their gadget is the same as ours. However, to ensure property (ii), they use a more complicated method to custom-make each gadget individually [2, Figure 20]. Our construction handles all gadgets uniformly by the small distance δ\delta, the narrow viewing angle in Figure 4, and the disjoint ranges of slopes for the dotted lines in Figure 1.

To the best of our knowledge, our result on the NP-hardness of Simple Path is new.

References

  • [1] H. A. Akitaya, M. Korman, M. Rudoy, D. L. Souvaine, C. D. Tóth. Circumscribing polygons and polygonizations for disjoint line segments. Proceedings of the 35th International Symposium on Computational Geometry, 9:1–9:17, 2019.
  • [2] H. A. Akitaya, M. Korman, M. Rudoy, D. L. Souvaine, C. D. Tóth. Circumscribing polygons and polygonizations for disjoint line segments. arXiv:1903.07019, 2019.
  • [3] P. Bose, M. E. Houle, and G. T. Toussaint. Every set of disjoint line segments admits a binary tree. Discrete and Computational Geometry, 26:387–410, 2001.
  • [4] D. Rappaport. Computing simple circuits from a set of line segments is NP-complete. SIAM Journal on Computing, 18:1128–1139, 1989.
  • [5] P. Rosenstiehl and R. E. Tarjan. Rectilinear planar layouts and bipolar orientations of planar graphs. Discrete and Computational Geometry, 1:343-353, 1986.
  • [6] C. D. Tóth. Alternating paths along axis-parallel segments. Graphs and Combinatorics, 22:527–543, 2006.