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

\Copyright

Hugo A. Akitaya and Csaba D. Tóth \EventEditorsSeok-Hee Hong \EventNoEds1 \EventLongTitle27th International Symposium Algorithms and Computation (ISAAC 2016) \EventShortTitleISAAC 2016 \EventAcronymISAAC \EventYear2016 \EventDateDecember 12–14, 2016 \EventLocationSydney, Australia \EventLogo \SeriesVolume64 \ArticleNo143

Reconstruction of Weakly Simple Polygons from their Edges

Hugo A. Akitaya Tufts University, Medford, MA, USA
hugo.alves_akitaya@tufts.edu
Csaba D. Tóth Tufts University, Medford, MA, USA
hugo.alves_akitaya@tufts.edu
California State University Northridge, Los Angeles, CA, USA
cdtoth@acm.org
Abstract.

Given nn line segments in the plane, do they form the edge set of a weakly simple polygon; that is, can the segment endpoints be perturbed by at most ε\varepsilon, for any ε>0\varepsilon>0, to obtain a simple polygon? While the analogous question for simple polygons can easily be answered in O(nlogn)O(n\log n) time, we show that it is NP-complete for weakly simple polygons. We give O(n)O(n)-time algorithms in two special cases: when all segments are collinear, or the segment endpoints are in general position. These results extend to the variant in which the segments are directed, and the counterclockwise traversal of a polygon should follow the orientation.

We study related problems for the case that the union of the nn input segments is connected. (i) If each segment can be subdivided into several segments, find the minimum number of subdivision points to form a weakly simple polygon. (ii) If new line segments can be added, find the minimum total length of new segments that creates a weakly simple polygon. We give worst-case upper and lower bounds for both problems.

Key words and phrases:
simple polygon, line segment, geometric graph
1991 Mathematics Subject Classification:
F.2.2 Nonnumerical Algorithms and Problems [Geometrical problems and computations]

1. Introduction

In the design and analysis of geometric algorithms, the input is often assumed to be in general position. This is justified from the theoretical point of view: degenerate cases can typically be handled without increasing the computational complexity, or symbolic perturbation schemes can reduce any input to one in general position [3]. In this paper, we present a geometric problem about simple polygons in the plane, which has a straightforward solution if the input is in general position, but is NP-complete otherwise.

Suppose we are given nn line segments in the plane. It is easy to decide in O(nlogn)O(n\log n) time whether they form a simple polygon by detecting intersections in a line sweep: if the segments are disjoint apart from common endpoints, then they form a plane graph, and a simple traversal can determine whether the graph is a cycle. If the input segments overlap, more than two segments have a common endpoint, or some segment endpoints lie in the interior of another segment, then they definitely do not form a simple polygon, but they might still be perturbed into a simple polygon (i.e., they form a weakly simple polygon). We study the decision problem for weakly simple polygons in this paper.

Organization and Results. We start with necessary definitions, and formulate the problem of reconstructing a weakly simple polygons from a set of edges (Section 2). We present polynomial-time algorithms when the given segments form a geometric graph or are collinear (Sections 3). The problem in general, however, is strongly NP-hard by a reduction from Planar-Monotone-3SAT (Section 4). Nevertheless, every set of noncrossing line segments in the plane can be turned into the edge set of a weakly simple polygon by (i) subdividing the edges into several edges, or (ii) inserting new edges. In Sections 5 we show that if G=(V,E)G=(V,E) is Eulerian, the edges can be subdivided O(n)O(n) times to obtain a weakly simple Euler tour. We also show that inserting new edges of total length at most 3E3\|E\| is always sufficient and sometimes necessary to create a weakly simple Euler tour. We conclude with future directions (Section 6). Omitted proofs are available in the Appendix.

Related Work. Reconstruction of simple polygons from partial information (such as vertices, visibility graphs, visibility angles, cross sections) has been studied for decades [2, 5, 10, 11, 15]. For example, an orthogonal simple polygon can be uniquely reconstruction from its vertices [15], but if the edges have 3 or more directions, the problem becomes NP-hard [11]. For a simple polygon, the set of all edges (studied in this paper) gives complete information: the cyclic order of the edges is easy to recover. In contrast, a set of edges may correspond to exponentially many weakly simple polygons, and the reconstruction problem becomes nontrivial. The problems considered in Section 5 are closely related to geometric graph augmentation and subgraph problems: (i) Can a given plane straight-line graph be augmented with new edges into a simple polygon, a Hamiltonian plane graph, or a 2-connected plane graph [13, 16, 17, 18]? (ii) Does a given a geometric graph contain certain noncrossing subgraphs (e.g., spanning trees or perfect matchings) [14]?

2. Preliminaries

A polygon P=(p0,,pn1)P=(p_{0},\ldots,p_{n-1}) is a cyclic sequence of points in the plane (vertices), where every two consecutive vertices are connected by a line segment (edge). The cycle of edges can be parameterized by a piecewise linear curve γ:𝕊12\gamma:\mathbb{S}^{1}\rightarrow\mathbb{R}^{2}. Polygon PP is simple if γ\gamma is a Jordan curve (i.e., γ\gamma is injective); equivalently, if (p0,,pn1)(p_{0},\ldots,p_{n-1}) is the plane embedding of a Hamiltonian cycle. Polygon PP is weakly simple if, for every ε>0\varepsilon>0, the vertices pip_{i} can be perturbed to points pip_{i}^{\prime}, pipi<ε\|p_{i}p_{i}^{\prime}\|<\varepsilon, such that P=(p0,,pn1)P^{\prime}=(p_{0}^{\prime},\ldots,p_{n-1}^{\prime}) is a simple polygon. The function .\|.\| denotes the Euclidean length of a line segment. Equivalently, a polygon given by γ\gamma is weakly simple if it can be perturbed to Jordan curve γ:𝕊12\gamma^{\prime}:\mathbb{S}^{1}\rightarrow\mathbb{R}^{2} such that the Fréchet distance of the two curves is bounded by ε\varepsilon (i.e., distF(γ,γ)<ε{\rm dist}_{F}(\gamma,\gamma^{\prime})<\varepsilon[6]. We can test whether a polygon P=(p0,,pn1)P=(p_{0},\ldots,p_{n-1}), is simple or weakly simple, respectively, in O(n)O(n) time [7] and O(nlogn)O(n\log n) time [1].

Refer to caption(a)(b)(c)Refer to caption(d)Refer to caption(e)Refer to caption
Figure 1. (a) A multi-set of line segments. Circles indicate common segment endpoints. (b) A weakly simple Euler tour. (c) An Eulerian graph that has no weakly simple Euler tour. An edge subdivision (d) or the insertion of two edges (e), yields a weakly simple Euler tour.

We define the WeaklySimplePolygonReconstruction (WSPR) problem as the following decision problem: Given a multiset EE of line segments in 2\mathbb{R}^{2}, does there exist a weakly simple polygon PP whose edge multiset is EE? For a multiset EE of directed segments, we also define Directed-WSPR that asks whether there exists a weakly simple polygon P=(p0,,pn1)P=(p_{0},\ldots,p_{n-1}) such that {pipi+1modn:0in1}=E\{p_{i}p_{i+1\mod n}:0\leq i\leq n-1\}=E. In both undirected and directed variants, we represent the input segments as a straight-line multigraph G=(V,E)G=(V,E), where VV is the set of all segment endpoints. Note that GG may have overlapping edges, and an edge may pass through vertices, so it need not be a geometric graph.

Two Necessary Conditions. Two line segments cross if they share exactly one interior point. If the multiset of segments EE forms a weakly simple polygon, then no two segment cross. This condition can be easily tested in O(|E|log|E|)O(|E|\log|E|) time by a line sweep.

If there is a weakly simple polygon P=(p0,,pn1)P=(p_{0},\ldots,p_{n-1}) with edge set EE, then PP is an Euler tour of the graph G=(V,E)G=(V,E). (However, an Euler tour need not be weakly simple; see Fig. 1(b)). A graph is Eulerian if and only if it is connected and every vertex has even degree. A simple (undirected) plane graph GG is Eulerian if and only if its dual graph is bipartite. This result extends to plane multigraphs when an edge of multiplicity kk is embedded as kk interior-disjoint Jordan arcs, that enclose k1k-1 faces. A directed graph is Eulerian if and only if all vertices are part of the same strongly connected component and if, for each vertex, the in-degree equals the out-degree.

3. Special Cases

We show that both WSPR and Directed-WSPR admit polynomial-time algorithms in the special cases that (i) G=(V,E)G=(V,E) is a simple geometric graph, that is, no two edges overlap, and no vertex lies in the interior of an edge, and (ii) all edges in G=(V,E)G=(V,E) are collinear. We assume that GG satisfies both necessary conditions.

3.1. Geometric Graphs

Note that in an Eulerian geometric graph the boundary of each face is a weakly simple circuit, where repeated vertices are possible, but there are no repeated edges. The following is a modified version of Hierholzer’s algorithm [12]. It computes a weakly simple Euler tour PP in the Eulerian graph GG, or reports that no such tour exists.

Algorithm A (G)(G)

  1. (1)

    2-color the faces of GG white and gray so that the outer face is white; and create a list LL of circuits on the boundaries of the gray faces.

  2. (2)

    If GG is directed and the edges around a gray face do not form a directed circuit or if there exist both clockwise (cw) and counterclockwise (ccw) circuits in LL, report that GG has no weakly simple Euler tour.

  3. (3)

    Choose an arbitrary circuit in LL, remove it from LL and call it PP.

  4. (4)

    While there is a circuit in LL, do:

    1. 4.1

      Find two consecutive edges, (u,v)(u,v) and (v,w)(v,w), along a white face such that (u,v)P(u,v)\in P and (v,w)C(v,w)\in C for some CLC\in L.

    2. 4.2

      Remove CC from the list LL, and merge CC and PP by traversing CC starting with the edge (v,w)(v,w) followed by the traversal of PP that ends with the edge (u,v)(u,v); see Figure 2(a).

  5. (5)

    Return PP.

Refer to captionaaRefer to captionbb

π1\pi_{1}π2\pi_{2}ccddvvRefer to captionaa^{\prime}Refer to captionbb^{\prime}π1\pi_{1}^{\prime}π2\pi_{2}^{\prime}cc^{\prime}dd^{\prime}vv^{\prime}Refer to captionv′′v^{\prime\prime}Refer to captionvvRefer to captionvvRefer to captionCCPPRefer to captionuuwwRefer to captionuuwwRefer to captionPP(a)(b)
Figure 2. (a) Merging two cycles. The vertices circled by the dotted ellipse correspond to the same vertex vv. (b) If vv has two consecutive incoming edges (a,v)(a,v) and (c,v)(c,v), GG does not admit a weakly simple Euler tour.
Theorem 3.1.

A simple geometric graph G=(V,E)G=(V,E) admits a weakly simple Euler tour if and only if GG is Eulerian and, if GG is directed, the circular order of edges around each vertex alternates between incoming and outgoing. A weakly simple Euler tour, if exists, can be computed in O(|E|)O(|E|) time.

Proof 3.2.

If G=(V,E)G=(V,E) is undirected, the algorithm construct an Euler tour PP [12]; and the tour is weakly simple by construction. In the remainder of the proof, we consider a directed Eulerian geometric graph GG. First, we show that if GG satisfies the conditions of Theorem 3.1, then Algorithm A returns a weakly simple Euler tour. If the circular order of edges around each vertex alternates between incoming and outgoing, then all edges on the boundary of a face of GG have the same orientation (ccw or cw), and adjacent faces have opposite orientations. Without loss of generality, the edges on the boundaries of white (resp., gray) faces are oriented ccw (resp., cw). Hnece, the condition in step 2 of the algorithm is satisfied.

We show that the Euler tour PP constructed by Algorithm A is weakly simple, that is, it can be perturbed into a simple polygon. Initially, each circuit C=(p0,,pk1)C=(p_{0},\ldots,p_{k-1}) in LL is the boundary of a gray face, and hence it is a simple polygon. Let C=(p0,,pk1)C^{\prime}=(p_{0}^{\prime},\ldots,p_{k-1}^{\prime}) be perturbation obtained by moving each point pip_{i} to the interior of the face along an angle bisector of pi1pipi+1\angle p_{i-1}p_{i}p_{i+1}. Initially PP is a weakly simple polygon (one of the circuits). It is enough to show that Step 4.2 maintains a weakly simple polygon, that is, when we merge PP and a circuit CC, their Jordan curve perturbations PP^{\prime} and CC^{\prime} can also be combined. Edges (u,v)(u,v) and (v,w)(v,w) are adjacent to a common white face f0f_{0}; they correspond to an edge (pu,pv)(p_{u},p_{v}) in PP^{\prime} and (qv,qw)(q_{v},q_{w}) in CC^{\prime}, where both pvp_{v} and qvq_{v} lie in the ε\varepsilon-neighborhood of vv in two different gray faces adjacent to f0f_{0}. We can modify PP^{\prime} and CC^{\prime} in the ε\varepsilon-neighborhood of vv, by removing a short Jordan arc from each and reconnecting them across the white face f0f_{0} into a single Jordan curve. By induction, we can obtain a Jordan curve within ε\varepsilon Frèchet distance from the output polygon PP. Hence, the algorithm returns a weakly simple Euler tour PP.

Now, we show that if GG has a vertex vv with two consecutive incoming (resp., outgoing) edges (a,v)(a,v) and (c,v)(c,v), then GG does not admit a weakly simple Euler tour. Suppose, for contradiction, that there exists a weakly simple Euler tour PP. Since both (a,v)(a,v) and (c,v)(c,v) are directed into vv, the tour PP contains edge-disjoint paths (a,v,b)(a,v,b) and (c,v,d)(c,v,d). Since PP is weakly simple, the circular order of these four edges incident to vv must be as shown in Figure 2(b). The polygon must contain edge-disjoint paths π1=(v,b,,c,v)\pi_{1}=(v,b,\ldots,c,v) and π2=(d,,a)\pi_{2}=(d,\ldots,a). The perturbation of π1\pi_{1} is π1=(v,b,,c,v′′)\pi_{1}^{\prime}=(v^{\prime},b^{\prime},\ldots,c^{\prime},v^{\prime\prime}) where vv′′v^{\prime}\neq v^{\prime\prime}. Note that aa and dd are on opposite sides of the cycle πvv′′\pi^{\prime}\cup v^{\prime}v^{\prime\prime}. The perturbation of π2\pi_{2}, path π2\pi_{2}^{\prime}, can intersect neither π1\pi_{1}^{\prime} nor vv′′v^{\prime}v^{\prime\prime}, because (a,v)(a,v) and (c,v)(c,v) are adjacent to the same face. Hence PP is not weakly simple.

Finally, Algorithm A runs in O(|E|)O(|E|) time. Step 1 and 2 can be done by traversing the dual graph of GG. Step 4 executes O(|E|)O(|E|) merges, each of which takes constant time.

Corollary 3.3.

A geometric multigraph G=(V,E)G=(V,E) admits a weakly simple Euler tour if and only if GG is Eulerian. A weakly simple Euler tour, if exists, can be computed in O(|E|)O(|E|) time.

Proof 3.4.

Replace every edge ee of multiplicity kk by kk edge-disjoint paths of length two whose interior points are close to the midpoint of ee. We obtain a simple Eulerian geometric graph with |V|+2|E||V|+2|E| vertices. Theorem 3.1 completes the proof.

Remark 3.5.

In the case that G=(V,E)G=(V,E) is a directed multigraph, replace every directed edge (u,v)(u,v) of multiplicity kk by edge-disjoint paths (u,wi,v)(u,w_{i},v), with new (subdivision) vertices wiw_{i}, i=1,ki=1,\ldots k, and denote by GG^{\prime} the resulting simple directed graph. The alternating direction condition of Theorem 3.1 requires that the multiplicity of (u,v)(u,v) and (v,u)(v,u) differ by at most one. If their multiplicities differ by exactly one, then there is a unique way to interleave the replacement paths between uu and vv. In fact, if any edge of GG has odd multiplicity, the alternating direction condition determines the cyclic order of all paths (u,wi,v)(u,w_{i},v), and we can apply Theorem 3.1 for GG^{\prime}. If, however, all edges of GG have even multiplicity, then there are two possibilities for the cyclic orders, both of which yield weakly simple Euler tours by Theorem 3.1.

3.2. Collinear Line Segments

Theorem 3.6.

If all edges of a graph G=(V,E)G=(V,E) are collinear, then every Euler tour of GG is a weakly simple polygon.

Refer to caption
Figure 3. Every collinear Eulerian tour can be transformed in a yy-monotonic simple polygon.

Proof. Without loss of generality, assume that all vertices are on the xx-axis. Let ε>0\varepsilon>0 be given. Let P=(p0,,pn1)P=(p_{0},\ldots,p_{n-1}) be an Euler tour of GG, and let p0p_{0} be a leftmost vertex. For each vertex pip_{i}, i{0,,n1}i\in\{0,\ldots,n-1\}, create a point pip_{i}^{\prime} with x(pi)=x(pi)x(p_{i}^{\prime})=x(p_{i}) and y(pi)=iε/(2n)y(p_{i}^{\prime})=i\varepsilon/(2n). The polygonal path (p0,,pn1)(p_{0}^{\prime},\ldots,p_{n-1}^{\prime}) is strictly yy-monotonic and therefore does not cross itself. The edge (pn1,p0)(p_{n-1}^{\prime},p_{0}^{\prime}) can be realized as a one-bend polyline (pn1,q,p0)(p_{n-1}^{\prime},q,p_{0}^{\prime}) with q=(ε/2,ε/2)q=(-\varepsilon/2,\varepsilon/2), which is outside of the axis-aligned bounding box of all other edges. Therefore P=(p0,,pn1)P^{\prime}=(p_{0}^{\prime},\ldots,p_{n-1}^{\prime}), illustrated in Figure 3, is a simple polygon where distF(P,P)<ε{\rm dist}_{F}(P,P^{\prime})<\varepsilon. ∎

4. NP-Completeness

In this section we analyze the general case of WSPR. First we discuss the undirected case and then the direct version.

Lemma 4.1.

Both WSPR and Directed-WSCR are in NP.

Proof 4.2.

Given a polygon P=(p0,,pn1)P=(p_{0},\ldots,p_{n-1}) and a (directed) straight-line multigraph G=(V,E)G=(V,E), we can check whether PP is a (directed) Euler tour in GG in O(|E|)O(|E|) time, and whether PP is weakly simple in O(nlogn)O(n\log n) time [1].

We prove that both directed and undirected WSPC are strongly NP-hard in the general case by a reduction from Planar-Monotone-3SAT, which is strongly NP-hard [4]. An instance of Planar-Monotone-3SAT consists of a plane bipartite graph GBG_{B} whose partite sets are variables nodes and clauses nodes. The variable nodes are on the xx-axis, the clause nodes are above or below the xx-axis; each clause is adjacent to three variables. A clause is positive if it lies above the xx-axis, and negative otherwise. Planar-Monotone-3SAT asks if there is a binary assignment from {\{true,false}\} to the set of variables such that every positive clause is adjacent to at least one true variable and every negative clause is adjacent to at least one false variable.

Lemma 4.3.

Undirected WSPR is NP-hard.

Proof 4.4.

Given an instance of Planar-Monotone-3SAT, we build an instance of undirected WSPR as shown in Figure 4(c). We split the construction into two basic gadgets. A variable and a clause gadget are shown in Figure 4(a) and (b), respectively. The figure shows collinear edges distorted and colored for clarity. All vertices shown as small black disks are on the xx-axis and vertices circled with a dotted ellipse represent the same graph vertex.

Refer to caption(a)(b)(c)Refer to captionvi1v_{i-1}li,al_{i,a}li,bl_{i,b}viv_{i}li,al_{i,a}lj,al_{j,a}lk,al_{k,a}
Figure 4. (a) Variable gadget, (b) clause gadget and (c) the reduction from Planar-Monotone-3SAT to undirected WSPR.

First, place vertices v0,,vnv_{0},\ldots,v_{n} equally spaced on the variable line from left to right. The variable gadget corresponding to the iith variable consists of two collinear paths between vi1v_{i-1} and viv_{i}, which are called red and black paths; see Figure 4. The red path is a single edge vi1viv_{i-1}v_{i}; and the black path is made of p+1p+1 edges where pp is the degree of the ii-th variable in the bipartite graph GBG_{B}. We assign a vertex in the interior of this path to each edge connected to the variable, naming the vertex li,al_{i,a} for the edge connecting the ii-th variable to the aa-th clause. We call such vertices literal vertices. The clause gadget is composed of 9 edges arranged in a cycle as shown in Figure 4(b). The three labeled vertices correspond to the literal vertices in the clause gadgets. The planar embedding of the Planar-Monotone-3SAT instance grantees that we can embed the graph of the directed WSPR instance.

Assume that the Planar-Monotone-3SAT instance have a satisfying assignment. We build a weakly simple Euler tour PP as follows. Each individual gadget defines a cycle. As in Algorithm A, we will merge the cycles into the polygon PP. Every cycle will be traversed clockwise, however, cycles defined by variable gadgets are collinear and there is no clear definition of winding direction for them. We perturb the red edges based on the truth values of the variables. For each variable assigned true (resp., false), we perturb the red edge to pass below (resp., above) the xx-axis. All variable cycles can be safely merged into a single circuit. We merge each clause to the variable cycle through a literal vertex of a true variable if the clause is positive or through a literal vertex of a false variable otherwise.

To show that PP is weakly simple, we build a simple polygon PP^{\prime} within ε\varepsilon Fréchet distance from PP as follows (see Figure 5). For each viv_{i} create two vertices vi+v_{i}^{+} and viv_{i}^{-} located ε/2\varepsilon/2 above and below viv_{i} respectively. If the solution assigns the ii-th variable true, move vertices li,al_{i,a} up by ε/2\varepsilon/2, replace vertices vi1v_{i-1} and viv_{i} by vi1+v_{i-1}^{+} and vi+v_{i}^{+} in the black edges (of the corresponding gadget) and by vi1v_{i-1}^{-} and viv_{i}^{-} in the red edges. Connect vertices v0+v_{0}^{+} and v0v_{0}^{-} with an edge. Do the same for vn+v_{n}^{+} and vnv_{n}^{-}. If the variable is assigned false, do analogous replacements symmetrically about the xx-axis. For each clause gadget, choose a literal li,al_{i,a} with a true value, split li,al_{i,a} into two vertices, li,al_{i,a}^{\prime} and li,a′′l_{i,a}^{\prime\prime}, with the same yy-coordinate and ε\varepsilon distance apart, such that they each are incident to one edge of the variable gadget and one edge of the clause gadget. For the other two literals, split li,al_{i,a} into two vertices, li,a+l_{i,a}^{+} and li,al_{i,a}^{-}, with the same xx-coordinate and ε2\frac{\varepsilon}{2} distance apart, such that the one closer to the xx-axis is incident to two edges of the variable gadget, and the other to two edges of the clause gadget. The result is a simple polygon and therefore undirected WSPR have a positive solution.

Refer to caption
Figure 5. Simple polygon that certifies that an Euler tour of PP is weakly simple.

Now assume that the graph produced by the reduction admits a weakly simple Euler tour PP. Then, there exist a simple polygon PP^{\prime} within an arbitrarily small Fréchet distance from PP. Such a polygon determines a vertical order between the paths of each variable gadget. Since every literal vertex has degree 4, there are only two possible ways to match its incident edges in a noncrossing manner: matching two horizontal edges and two clause edges, or a horizontal with a clause edge. In both cases, the two horizontal black edges incident to a literal vertex are placed above or below the red path. Therefore, all edges of the black path of a variable gadget are on the same side of its red path. For each variable, assign true if the black path of its gadget is above the red path and false otherwise. Since each clause gadget needs to be connected to some edge in a variable gadget, if the clause is positive/negative, one of its corresponding variables were assigned true/false. Hence, the assignment satisfies all clauses and the Planar-Monotone-3SAT instance have a positive solution.

Lemma 4.5.

Directed-WSPR is NP-hard.

As a consequence of Lemmas 4.1, 4.3, and 4.5, we have the following result.

Theorem 4.6.

Both WSPR and Directed-WSPR are NP-complete.

Remark 4.7.

Our reduction can be modified by perturbing the points in our variable gadgets so that: (i) points belonging to the same gadget are collinear; (ii) no three points, each belonging to a different gadget are collinear; and (iii) no edge crossing is introduced. By reducing from Planar-Monotone-(2,3)-SAT-3 [9], in which clauses may have two or three literals and each variable can appear only in up to three clauses, we can show that WSPR remain NP-hard even if the number of mutually collinear points is constant.

5. Related problems

Since WSPR is NP-complete in the general case, we study related problems in which a weakly simple polygon is always achievable by allowing edge subdivision and insertion of new edges.

5.1. Edge subdivision

Given a noncrossing graph G=(V,E)G=(V,E) where every vertex has even degree and the point set E\bigcup E is connected, we define the problem WSPR as finding a sequence of edge subdivision operations that produces a graph G=(V,E)G^{*}=(V,E^{*}) that admits a weakly simple Euler tour. The subdivision of an edge uvuv at a vertex wrelint(uv)w\in{\rm relint}(uv) replaces uvuv by two edges uwuw and wvwv.

It is easy to see that WSPR is always feasible with O(n2)O(n^{2}) subdivisions where n=|V|n=|V|. Indeed, subdivide every edge uvuv recursively at each vertex that lies in the interior of uvuv. We obtain a connected geometric multigraph with even degrees, which admits a weakly simple Euler tour by Corollary 3.3. The main result of this section is the following.

Theorem 5.1.

Every noncrossing graph G=(V,E)G=(V,E) such that every vVv\in V has even degree and E\bigcup E is connected, can be transformed into a graph G=(V,E)G^{*}=(V,E^{*}) using O(|E|)O(|E|) edge subdivisions, and this bound cannot be improved.

Before the proof, we introduce some notation (from [1, 6, 8]). Let G=(V,E)G=(V,E) be a noncrossing graph. The transitive closure of the overlap relation is an equivalence relation on EE. The union of all edges in an equivalence class is called a bar, it is a line segment. A vertex vbv\in b is called bb-odd if vv is incident to an odd number of edges contained in bb, or bb-even otherwise. A vertex can be bb-odd and bb^{\prime}-even for different bars bb and bb^{\prime} (see Figure 6(b)).

Our algorithm will compute simple paths formed by subdivided edges. Let bb be a horizontal bar with vertices p1,p2bp_{1},p_{2}\in b, x(p1)x(p2)x(p_{1})\leq x(p_{2}). Let q1q2Eq_{1}q_{2}\in E be an edge that contains p1p_{1} and its right endpoint has minimum xx-coordinate. A subdivided paths, denoted by p1p2^\widehat{p_{1}p_{2}}, is a path between p1p_{1} and p2p_{2}, defined recursively (see Fig. 6(d)): (i) if x(p1)=x(p2)x(p_{1})=x(p_{2}), p1p2^=\widehat{p_{1}p_{2}}=\emptyset; (ii) if p2q1q2p_{2}\in q_{1}q_{2}, then subdivide q1q2q_{1}q_{2} into three edges e1=q1p1e_{1}=q_{1}p_{1}, e2=p1p2e_{2}=p_{1}p_{2}, and e3=p2q2e_{3}=p_{2}q_{2} and put p1p2^=(e2)\widehat{p_{1}p_{2}}=(e_{2}); (iii) if p2q1q2p_{2}\not\in q_{1}q_{2}, then subdivide q1q2q_{1}q_{2} into two edges e1=q1p1e_{1}=q_{1}p_{1} and e2=p1q2e_{2}=p_{1}q_{2}, and put p1p2^=(e2)q2p2^\widehat{p_{1}p_{2}}=(e_{2})\oplus\widehat{q_{2}p_{2}}, where \oplus denotes concatenation. Consequently, if the segment p1p2p_{1}p_{2} contains kk vertices, a path p1p2^\widehat{p_{1}p_{2}} can be constructed using at most kk edge subdivisions. An example is shown in Figure 6(c).

Proof 5.2 (Proof of Theorem 5.1).

The proof of the upper bound is constructive. The algorithm subdivides edges within each bar independently. Let bb be a bar containing mm vertices. We apply O(m)O(m) edge subdivisions and partition the edges in bb into subsets: Subsets +\mathcal{M}^{+} and \mathcal{M}^{-} will consists of subdivision paths between the intersection points of bb with other bars lying above and below bb, respectively; all remaining edges will be partitioned into tours (each of which is a weakly simple polygon by Theorem 3.6). The algorithm is divided into three phases: Phase 1 creates +\mathcal{M}^{+} and \mathcal{M}^{-}; phase 2 forms circuits; and phase 3 establishes common vertices between the subdivision paths and circuits. Refer to Figure 6.

Phase 1. Compute a list B+B^{+} (resp., BB^{-}) of points pp in the interior of bb such that pp is bb^{\prime}-odd for some bar bb^{\prime} that is above or collinear to bb (resp., below bb). A point can appear more than once in each list if it is odd in multiple bars bb^{\prime}. Sort the lists by x(p)x(p), ties are broken by clockwise (resp., counterclockwise) order of the corresponding bars bb^{\prime}. If the left (resp., right) endpoint of bb is bb-odd, add it to the beginning (resp., end) of the list B+B^{+}. If any of the lists have odd cardinality, append the right endpoint of bb at the end of the list. Create a perfect matching of consecutive endpoints in each list. Construct edge disjoint subdivided paths between each pair of matched points, and let +\mathcal{M}^{+} and \mathcal{M}^{-} denote the set of edges in such paths for B+B^{+} and BB^{-}, respectively (see Figure 6(d)).

Phase 2. Let \mathcal{B} be the set of (subdivided) edges that lie on bb and are not in +\mathcal{M}^{+}\cup\mathcal{M}^{-}. The union of edges in \mathcal{B} may be a disconnected point set (e.g., as shown in Figure 6(d)). Let the line segment r1r2r_{1}r_{2} be one of the connected components of \bigcup\mathcal{B}. Construct two edge disjoint subdivided paths r1r2^+\widehat{r_{1}r_{2}}^{+} and r1r2^\widehat{r_{1}r_{2}}^{-} from the edges in \mathcal{B}. For every path p1p2^\widehat{p_{1}p_{2}} in +\mathcal{M}^{+} (resp., \mathcal{M}^{-}) that overlaps with r1r2r_{1}r_{2}, identify an edge of r1r2^+\widehat{r_{1}r_{2}}^{+} (resp., r1r2^\widehat{r_{1}r_{2}}^{-}) that contains a vertex of p1p2^\widehat{p_{1}p_{2}} and subdivide it at such vertex (see Figure 6(e)). Let 𝒪+\mathcal{O}^{+} (resp., 𝒪\mathcal{O}^{-}) be the set of edges in r1r2^+\widehat{r_{1}r_{2}}^{+} (resp., r1r2^\widehat{r_{1}r_{2}}^{-}) for all components r1r2r_{1}r_{2} of the union of edges in \mathcal{B}.

Phase 3. Let \mathcal{B}^{\prime} be the set of edges in (𝒪+𝒪)\mathcal{B}\setminus(\mathcal{O}^{+}\cup\mathcal{O}^{-}). For every component CC of the subgraph induced by \mathcal{B}^{\prime}, let p0p_{0} be the leftmost vertex of CC, identify the edge in 𝒪+\mathcal{O}^{+} that contains p0p_{0} and subdivide it at p0p_{0}. This concludes the construction of GG^{*}.

Refer to captionp1p_{1}p2p_{2}Refer to caption(c)Refer to caption(a)(b)(d)Refer to caption+\mathcal{M^{+}}\mathcal{M^{-}}Refer to caption(e)Refer to caption𝒪+\mathcal{O^{+}}𝒪\mathcal{O^{-}}Refer to captionDuiD_{u_{i}}(f)Refer to caption
Figure 6. (a) A bar bb and its adjacent bars. (b) Each bar bb^{\prime} is shown with its bb^{\prime}-odd and bb^{\prime}-even vertices shown in red and green respectively. (c) The subdivided path pip2^\widehat{p_{i}p_{2}} is shown in blue. Examples of (d) +\mathcal{M^{+}} and \mathcal{M^{-}}; (e) 𝒪+\mathcal{O^{+}} and 𝒪\mathcal{O^{-}}. (f) Connecting a component of \mathcal{B}^{\prime} to a path in 𝒪+\mathcal{O^{+}} with two polygonal paths shown in magenta.

Correctness. Now we prove that GG^{*} admits a weakly simple Euler tour. Notice that GG^{*} is connected since the subdivisions in phase 2 connects every component of +\mathcal{M^{+}} or \mathcal{M^{-}} to every overlapping component of 𝒪+\mathcal{O}^{+} or 𝒪\mathcal{O}^{-}, and phase 3 connects every component of \mathcal{B}^{\prime} to some component in 𝒪+\mathcal{O}^{+}. Since edge subdivisions do not change the parity of degrees, every vertex in GG^{*} has even degree, hence GG^{*} is Eulerian. We construct an Eulerian geometric graph GG^{\prime} such that every Euler tour in GG^{\prime} is within ε/2\varepsilon/2 Fréchet distance from an Euler tour in GG^{*}. Theorem 3.1 will then imply that there exists a simple polygon within ε\varepsilon Fréchet distance from an Euler tour in GG^{*}.

We recall some notation introduced in [6]. For every vertex vVv\in V, let DvD_{v} be a disk centered at vv of radius ε4\frac{\varepsilon}{4}. For a bar bb between u0u_{0} and uku_{k}, let DbD_{b} be the ε2\varepsilon^{2} neighborhood of bb setminus Du0DukD_{u_{0}}\cup D_{u_{k}}. Assume that ε(0,14)\varepsilon\in(0,\frac{1}{4}) is so small that the disks DvD_{v} are pairwise disjoint; a disk DvD_{v} intersects DbD_{b} only if vbv\in b, and the neighborhoods DbD_{b} are pairwise disjoint.

For each bar bb with vertices u0,,uku_{0},\ldots,u_{k}, we perturb the edges of EE^{*} contained in bb into noncrossing simple polygons and polygonal chains. Embed each subdivided path in +\mathcal{M}^{+} (resp., \mathcal{M}^{-}) uiuj^\widehat{u_{i}u_{j}} in the upper (resp., lower) boundary of the region DbD_{b} such that uiu_{i} is on the boundary of DuiD_{u_{i}} and uju_{j} is on the boundary of DujD_{u_{j}}. Subdivide DbD_{b} with +1\ell+1 horizontal lines where \ell is the number of components of the subgraph induced by \mathcal{B}^{\prime}. Embed all edges in 𝒪+\mathcal{O}^{+} (resp., 𝒪\mathcal{O}^{-}) in the first (resp., +1\ell+1-th) such line.

Recall that every vertex of GG has even degree. If bb contains a bb-odd vertex pp, there must exist a bar bb^{\prime} such that pp is bb^{\prime}-odd. Because +\mathcal{M}^{+} and \mathcal{M}^{-} matches such points, the subgraph induced by \mathcal{B} contain only even degree vertices. By construction the edges in 𝒪+𝒪\mathcal{O}^{+}\cup\mathcal{O}^{-} form nonoverlapping disjoint circuits. Hence, the subgraph induced by \mathcal{B}^{\prime} contains only even degree vertices. Consequently, each of its components is Eulerian and forms a weakly simple polygons that we denote by γ1(b),,γ(b)\gamma_{1}(b),\ldots,\gamma_{\ell}(b), sorted by the xx-coordinates of their left endpoints. Perturb γ1(b),,γ(b)\gamma_{1}(b),\ldots,\gamma_{\ell}(b) into simple polygons that lie in the interior of DbD_{b}, separated by one of the +1\ell+1 lines, in this linear order (ties are broken arbitrarily). For i=0,,ki=0,\ldots,k, consider all polygons γj(b)\gamma_{j}(b) whose leftmost vertex is uiu_{i}. Connect the left endpoints of each such γj(b)\gamma_{j}(b) to the copy of uiu_{i} in 𝒪+\mathcal{O^{+}} by two polygonal paths within DuiD_{u_{i}} (these paths connect different copies of vertex uiVu_{i}\in V^{*}, see Figure 6(f)). Similarly, for each subdivision performed in phase 2 at uiu_{i} of an edge in 𝒪+\mathcal{O^{+}} (resp., 𝒪\mathcal{O^{-}}) in a path r1r2^\widehat{r_{1}r_{2}}, connect the copy of uiu_{i} in this path to a copy in +\mathcal{M}^{+} (resp., 𝒪\mathcal{O^{-}}) by two polygonal paths within the disk DuiD_{u_{i}}. Connect the endpoints of the overlapping paths in 𝒪+\mathcal{O^{+}} and 𝒪\mathcal{O^{-}} (forming a cycle of each), and if the right endpoint of bb is not bb-odd and was added to B+,BB^{+},B^{-}, connect the copies of uku_{k} in +\mathcal{M}^{+} and \mathcal{M}^{-}. For each matching in B+B^{+} and BB^{-} involving a point uiu_{i} that is a bb^{\prime}-odd endpoint of a bar bb^{\prime}, connect the paths in +\mathcal{M}^{+} or \mathcal{M}^{-} that correspond to a match in bb to the path in +\mathcal{M}^{+} of bb^{\prime} that contains pp. Finally, for each point uiu_{i} that is the endpoint of a bar bb^{\prime} and is bb^{\prime}-even, connect the corresponding copies of uiu_{i}, making the graph induced by all edges containing a point on bb connected. This concludes the construction of GG^{\prime}.

Theorem 3.1 completes the proof: An Euler tour P^\widehat{P} of GG^{\prime} can be perturbed into a simple polygon PP such that distF(P,P^)<ε2{\rm dist}_{F}(P,\widehat{P})<\frac{\varepsilon}{2}. The tour P^\widehat{P} maps to an Euler tour PP^{*} of GG^{*} by identifying the vertices that lie in the same disk DvD_{v}, vVv\in V^{*}; and distF(P^,P)<ε2{\rm dist}_{F}(\widehat{P},P^{*})<\frac{\varepsilon}{2}.

Our lower bound construction is shown in Figure 7(a). It consists of a graph G=(V,E)G=(V,E) containing a long edge eRe_{R} (shown in red) and a path of (|E|+5)/7(|E|+5)/7 non-overlapping collinear edges that connects the endpoints of eRe_{R}. Each vertex in the interior of eRe_{R} is also incident to two small cycles above and below eRe_{R} respectively. Although the graph is Eulerian, it does not admit a weakly simple Euler tour. Each vertex pp in the interior of the red edge eRe_{R} is incident to two small triangles. Suppose that eRe_{R} is not subdivided at pp. Then pp has degree 6. In any perturbation of a weakly simple Euler tour, vertex pp is split into 3 copies, each of degree 2, and each lying above or below eRe_{R}. Suppose only one copy of pp lies below eRe_{R}. Then it is incident to two edges of a small triangle below eRe_{R}, which is then disconnected from the rest of the graph, a contradiction. Consequently, eRe_{R} must be subdivided at all interior vertices. Figure 7(b) shows that O(|E|)O(|E|) subdivisions of eRe_{R} suffice in this case.

Refer to caption(a)(b)Refer to caption(c)Refer to caption(d)(e)(f)(g)Refer to caption
Figure 7. Lower bound constructions.

5.2. Edge insertion

We define the problem WSPR+ as finding a set of edges E+E^{+} such that G+=(V,EE+)G^{+}=(V,E\cup E^{+}) admits a weakly simple Euler tour. Denote by E\|E\| and E+\|E^{+}\|, respectively, the sum of the lengths of all edges in EE and E+E^{+}. If the point set E\bigcup E is disconnected, then there is no upper bound on E+\|E^{+}\|. Otherwise, we can establish worst-case upper and lower bounds for E+\|E^{+}\| in terms of E\|E\|.

Theorem 5.3.

Let G=(V,E)G=(V,E) be a noncrossing multigraph such that E\bigcup E is a connected point set. Then there exists a set of line segments E+E^{+} such that E+3E\|E^{+}\|\leq 3\|E\| and G+=(V,EE+)G^{+}=(V,E\cup E^{+}) admits a weakly simple Euler tour.

Proof 5.4.

We construct E+E^{+} as follows. Partition EE into bars (equivalence classes of the transitive closure of the overlap relation on EE). Denote by bb the union of edges in a bar. W.l.o.g., we may assume that bb is horizontal. Denote by u0,,ukVu_{0},\ldots,u_{k}\in V the vertices of VV along bb sorted by xx-coordinates (where b=u0ukb=u_{0}u_{k}). For i=1,,ki=1,\ldots,k, add an edge ui1uiu_{i-1}u_{i} to E+E^{+} if the edges of EE in the bar cover the line segment ui1uiu_{i-1}u_{i} an odd number of times. The old and new edges in the bar bb jointly form a graph of even degree that we denote by G(b)G(b). By Theorem 3.6, every component of G(b)G(b) admits a weakly simple Euler tour. Finally, add two more copies of edge ui1uiu_{i-1}u_{i} to E+E^{+} for all i=1,ki=1,\ldots k. After repeating the above steps for every bar, we have E+3E\|E^{+}\|\leq 3\|E\| and G+=(V,EE+)G^{+}=(V,E\cup E^{+}) is Eulerian.

We omit the proof of correctness (which is provided in Appendix A.), that shows that G+G^{+} admits a weakly simple Euler tour, since it is similar to the proof of Theorem 5.1.

Lower bound constructions. All our lower bound constructions are graphs G=(V,E)G=(V,E) in which an edge connects two points on the boundary of the convex hull of VV, denoted ch(V){\rm ch}(V).

Theorem 5.5.

Let 𝒢\mathcal{G} be a family of noncrossing multigraphs. For G=(V,E)𝒢G=(V,E)\in\mathcal{G}, let E+E^{+} be an edge set of minimum length E+\|E^{+}\| such that G+=(V,EE+)G^{+}=(V,E\cup E^{+}) admits a weakly simple Euler tour; and let λ(𝒢)=supG𝒢E+/E\lambda(\mathcal{G})=\sup_{G\in\mathcal{G}}\|E^{+}\|/\|E\|. Then:

  1. (1)

    λ(𝒢1)1\lambda(\mathcal{G}_{1})\geq 1, where 𝒢1={\mathcal{G}_{1}=\{Eulerian noncrossing multigraphs}\}.

  2. (2)

    λ(𝒢2)65\lambda(\mathcal{G}_{2})\geq\frac{6}{5}, where 𝒢2={\mathcal{G}_{2}=\{connected noncrossing multigraphs}\}.

  3. (3)

    λ(𝒢3)3\lambda(\mathcal{G}_{3})\geq 3, where 𝒢3={\mathcal{G}_{3}=\{noncrossing multigraphs G=(V,E)G=(V,E) such that E\bigcup E is connected}\}.

Proof 5.6.

(1) Refer to Figs. 7(a)–(c). Let nn\in\mathbb{N} and δ(0,13)\delta\in(0,\frac{1}{3}). Place vertices vi=(i,0)v_{i}=(i,0), for i=0,,ni=0,\ldots,n, on the xx-axis. A red edge of length nn connects v0v_{0} and vnv_{n}. A black edge of length 1/n1/n connects vi1v_{i-1} and viv_{i} for 1in1\leq i\leq n. A small cycle of length δ<13\delta<\frac{1}{3} is placed on each viv_{i}, 1in11\leq i\in n-1, on each side of the xx-axis. The total length of the construction is E=2n+2(n1)δ\|E\|=2n+2(n-1)\delta.

Let G+=(V,EE+)G^{+}=(V,E\cup E^{+}) be a multigraph in which PP is a weakly simple Euler tour; and let PP^{\prime} be an ε\varepsilon-perturbation into a simple polygon, for some 0<ε<δ0<\varepsilon<\delta. We define a pair of vertical lines i:x=i+δ\ell_{i}^{-}:x=i+\delta and i+:x=(i+1)δ\ell_{i}^{+}:x=(i+1)-\delta, for 0in10\leq i\leq n-1. The portion of PP^{\prime} between any two of these lines consists of disjoint paths whose endpoints are on the lines. By Morse theory, PP^{\prime} contains an even number of paths between any two of these lines; and the length of such a path is at least the distance between the parallel lines. The input edges already contain two line segments between any two of these lines: a red and a black segment.

We claim that G+G^{+} contains at least 4 paths between i\ell_{i}^{-} and i+\ell_{i}^{+} for all but at most one index 0in10\leq i\leq n-1. Indeed, suppose that there are two such paths between i\ell_{i}^{-} and i+\ell_{i}^{+} and between j\ell_{j}^{-} and j+\ell_{j}^{+} (0i<jn10\leq i<j\leq n-1). We may assume w.l.o.g. that the black edge is above the red edge between i\ell_{i}^{-} and i+\ell_{i}^{+}. Then the black edge must be above the red edge between j\ell_{j}^{-} and j+\ell_{j}^{+}, as well. Consequently, PP^{\prime} cannot reach the small cycles at vi+1,,vjv_{i+1},\ldots,v_{j}. This confirms the claim. It follows that EE+(4n2)(12δ)\|E\cup E^{+}\|\geq(4n-2)(1-2\delta). This lower bound tends to 2E2\|E\| as nn\rightarrow\infty and δn0\delta n\rightarrow 0.

Due to space restrictions, we omit the proofs for cases 2 and 3.

6. Conclusions

We have shown that WSPR is NP-complete. It follows that the decision version of the problems in Section 5 are also NP-complete: It is NP-complete to find up to kk subdivision points to form a weakly simple polygon, or to find an edge set with length up to kk that produce a weakly simple polygon. We have shown that Θ(|E|)\Theta(|E|) subdivision points are always sufficient and sometimes necessary when the input is Eulerian; and new edges of length Θ(E)\Theta(\|E\|) are always sufficient and sometimes necessary when E\bigcup E is connected. However, the best constant coefficients are not known in most cases. We conjecture that every noncrossing Eulerian graph G=(V,E)G=(V,E) can be augmented into a graph G+=(V,EE+)G^{+}=(V,E\cup E^{+}) that admits a weakly simple Euler tour such that E+E\|E^{+}\|\leq\|E\|.

If the segments in EE do not form a weakly simple polygon, we can subdivide segments or insert new segments to create a weakly simple polygon. On the other end of the spectrum, a set of nn line segment may form an exponential number of weakly simple polygons, even if all segments are collinear. It is an open problem to count exactly how many weakly simple polygons can be obtained from the same set of line segments. Finally, we mention an open problem about reconstructing simple polygons from a subset of its edges. It is NP-complete to decide whether a geometric graph G=(V,E)G=(V,E) can be augmented into a simple polygon P=(V,EE+)P=(V,E\cup E^{+}) [16]. However, it is not known whether the problem remains NP-hard when GG is a perfect matching.

Acknowledgements. Research on this paper was partially supported by NSF awards CCF-1422311 and CCF-1423615. The first author was supported by the Science Without Borders program. We thank Adrian Dumitrescu for bringing this problem to our attention.

References

  • [1] Hugo A. Akitaya, Greg Aloupis, Jeff Erickson, and Csaba D. Tóth. Recognizing weakly simple polygons. In Proc. 32nd Sympos. Comput. Geom., LIPIcs 51, #8, Dagstuhl, 2016.
  • [2] Gill Barequet, Craig Gotsman, and Avishay Sidlesky. Polygon reconstruction from line cross-sections. In Proc. 18th Canadian Conf. Comput. Geom., Kingston, ON, 2006.
  • [3] Mark de Berg, Otfried Cheong, Marc van Kreveld, and Mark Overmars. Computational Geometry: Algorithms and Applications. Springer-Verlag, Berlin, 3rd edition, 2008.
  • [4] Mark de Berg and Amirali Khosravi. Optimal binary space partitions for segments in the plane. Internat. J. Comput. Geom. Appl., 22(3):187–205, 2012.
  • [5] Therese C. Biedl, Stephane Durocher, and Jack Snoeyink. Reconstructing polygons from scanner data. Theoret. Comput. Sci., 412(32):4161–4172, 2011.
  • [6] Hsien-Chih Chang, Jeff Erickson, and Chao Xu. Detecting weakly simple polygons. In Proc. 26th ACM-SIAM Symposium on Discrete Algorithms, pp. 1655–1670, SIAM, 2015.
  • [7] Bernard Chazelle. Triangulating a simple polygon in linear time. Discrete Comput. Geom., 6(3):485–524, 1991.
  • [8] Pier Francesco Cortese, Giuseppe Di Battista, Maurizio Patrignani, and Maurizio Pizzonia, On embedding a cycle in a plane graph, Discrete Math., 309(7):1856–1869, 2009.
  • [9] Andreas Darmann, Janosch Döcker, and Britta Dorn. On planar variants of the monotone satisfiability problem with bounded variable appearances. Preprint, arXiv:1604.05588, 2016.
  • [10] Yann Disser, Matúš Mihalàk, and Peter Widmayer. A polygon is determined by its angles. Comput. Geom. Theory Appl., 44(8):418–426, 2011.
  • [11] Michael Formann and Gerhard J. Woeginger. On the reconstruction of simple polygons. Bulletin EATCS, 40:225–230, 1990.
  • [12] Carl Hierholzer and Chr Wiener. Über die Möglichkeit, einen Linienzug ohne Wiederholung und ohne Unterbrechung zu umfahren. Mathematische Annalen, 6(1):30–32, 1873.
  • [13] Michael Hoffmann and Csaba D. Tóth. Segment endpoint visibility graphs are Hamiltonian. Comput. Geom., 26(1):47–68, 2003.
  • [14] Klaus Jansen and Gerhard J. Woeginger. The complexity of detecting crossingfree configurations in the plane. BIT Numerical Math., 33(4):580–595, 1993.
  • [15] Joseph O’Rourke. Uniqueness of orthogonal connect-the-dots. In Godfried T. Toussaint, editor, Computational Morphology, pp. 97–104, Elsevier, Amsterdam, 1988.
  • [16] David Rappaport. Computing simple circuits from a set of line segments is NP-complete. SIAM J. Comput., 18(6):1128–1139, 1989.
  • [17] Csaba D. Tóth. Connectivity augmentation in planar straight line graphs. European J. Combin., 33(3):408–425, 2012.
  • [18] Masatsugu Urabe and Mamoru Watanabe. On a counterexample to a conjecture of Mirzaian. Comput. Geom. Theory Appl., 2(1):51–53, 1992.

Appendix A Omitted proofs

Proof A.1 (Proof of Lemma 6).

The reduction to Directed-WSPR is very similar to the one described in the proof of Lemma 4.3. Figure 8(a) shows an example of the reduction with the edges on the variable line distorted to show the overlapping segments. Black disks circled by dotted ellipses represent the same vertex. The key difference is the addition of four segments colored blue in Figure 8.

Refer to caption
Figure 8. (Left) Reduction from Planar-Monotone-3SAT to Directed-WS and (right) a possible solution.

All segments of the variable gadgets are directed to the right and the clause gadgets form clockwise cycles. If the Planar-Monotone-3SAT have a positive solution, we can construct a weakly simple polygon as shown in Figure 8(b) in a similar way as described in the proof of Lemma 4.3. The difference is that we place a blue edge in between the black and red paths of the variable gadgets and connect vnv_{n} and v0v_{0} with a blue path above the construction. Analogously to the proof of Lemma 4.3, if there is a positive solution for the Directed-WSPR instance, all edges of the black path of a variable gadget are on the same side of the red path. Then we can assign true/false values as previously explained, and obtain a satisfying assignment.

Proof A.2 (Proof of correctness (Theorem 5.3)).

Here we show that G+G^{+} admits a weakly simple Euler tour. Note that an ε2\frac{\varepsilon}{2}-perturbation of an ε2\frac{\varepsilon}{2}-perturbation is an ε\varepsilon-perturbation. We shall construct an ε2\frac{\varepsilon}{2}-perturbation of G+G^{+} into an Eulerian geometric graph, and then Theorem 3.1 yields and ε2\frac{\varepsilon}{2}-perturbation into a simple polygon for all ε>0\varepsilon>0.

For each bar bb with vertices u0,,uku_{0},\ldots,u_{k}, we perturb the edges of EE+E\cup E^{+} contained in bb into simple polygons: Let β(b)\beta(b) be the circuit formed by two copies of the path (u0,,uk)(u_{0},\ldots,u_{k}), and embed β(b)\beta(b) on the boundary of the region DbD_{b} such that u0u_{0} is on the boundary of Du0D_{u_{0}} and uku_{k} is on the boundary of DukD_{u_{k}}. The components of G(b)G(b) each form weakly simple polygons that we denote by γ1(b),,γ(b)\gamma_{1}(b),\ldots,\gamma_{\ell(b)}, sorted by the xx-coordinates of their left endpoints. Perturb γ1(b),,γ(b)(b)\gamma_{1}(b),\ldots,\gamma_{\ell(b)}(b) into simple polygons that lie in the interior of DbD_{b}, separated by lines parallel to bb, in this linear order (ties are broken arbitrarily). For i=0,,ki=0,\ldots,k, consider all polygons γj(b)\gamma_{j}(b) whose leftmost vertex if uiu_{i}. Connect the left endpoints of each such γj(b)\gamma_{j}(b) to the copy of uiu_{i} in the upper arc of β(b)\beta(b) by two polygonal paths within DuiD_{u_{i}} (these paths connect different copies of vertex uiVu_{i}\in V). Similarly, if bars bb and bb^{\prime} intersect at some vertex v=ui=ujv=u_{i}=u_{j}^{\prime}, then connect the corresponding vertices in β(b)\beta(b) and β(b)\beta(b^{\prime}) by two polygonal paths within the disk DvD_{v}. These connector paths augment the pairwise disjoint polygons β(b)\beta(b), γ1(b),,γ(b)(b)\gamma_{1}(b),\ldots,\gamma_{\ell(b)}(b), for all bars bb, into a simple Eulerian noncrossing geometric graph G^\widehat{G}.

Theorem 3.1 completes the proof: An Euler tour P^\widehat{P} of G^\widehat{G} can be perturbed into a simple polygon PP such that distF(P,P^)<ε2{\rm dist}_{F}(P,\widehat{P})<\frac{\varepsilon}{2}. The Euler tour P^\widehat{P} of G^\widehat{G} maps to an Euler tour P+P^{+} of G+G^{+} by identifying the vertices that lie in the same disk DvD_{v}, vVv\in V; and distF(P^,P+)<ε2{\rm dist}_{F}(\widehat{P},P^{+})<\frac{\varepsilon}{2}.

The following lemma provides a canonical form of a weakly simple Euler tour when an edge connects two points on the boundary of the convex hull of VV.

Lemma A.3.

Let G=(V,E)G=(V,E) be a multigraph that admits a weakly simple Euler tour and an edge abEab\in E where uu and vv are on the boundary of ch(V){\rm ch}(V). Then GG admits a weakly simple Euler tour composed of 3 weakly simple polygons: γ1\gamma_{1} contains all edges that lie in one of the open halfplanes bounded by uvuv; γ2γ3\gamma_{2}\cup\gamma_{3} contains all edges in the other open halfplane, γ2\gamma_{2} is incident to uu, and γ3\gamma_{3} is incident to vv.

Proof A.4.

Assume w.l.o.g. that abab is horizontal. Let PP be an arbitrary weakly simple Euler tour of GG. Cut PP at the vertices uu and vv into paths 𝒫={P1,,Pk}\mathcal{P}=\{P_{1},\ldots,P_{k}\}. Note that every path in 𝒫\mathcal{P} consists of edges that lie in one closed halfplane bounded by uvuv, since every subpath of PP between the two open halfplanes must go through uu or vv.

Clearly, the number of paths in 𝒫\mathcal{P} between uu and vv is even, and the path (u,v)𝒫(u,v)\in\mathcal{P} lies in both closed halfplanes. Therefore, there is a partition 𝒫=𝒫𝒫+\mathcal{P}=\mathcal{P}^{-}\cup\mathcal{P}^{+} such that every path in 𝒫\mathcal{P}^{-} (resp., 𝒫+\mathcal{P}^{+}) lies in the closed halflane below (resp., above) uvuv; and 𝒫\mathcal{P}^{-} and 𝒫+\mathcal{P}^{+} each contain an even number of paths between uu and vv. Assume w.l.o.g. that (u,v)𝒫+(u,v)\in\mathcal{P}^{+}. Then the paths in 𝒫+\mathcal{P}^{+} form a weakly simple polygon. The paths in 𝒫\mathcal{P}^{-} incident to uu also form a weakly simple polygon; and the remaining paths in 𝒫\mathcal{P}^{-} (all incident to vv only) also form a weakly simple polygon, as claimed.

Proof A.5 (Proof of cases (2) and (3) (Theorem 5.5)).

(3) The construction is similar to case (1) above. Refer to Figs. 7(d)–(e). Let nn\in\mathbb{N} and δ(0,13)\delta\in(0,\frac{1}{3}). Place vertices vi=(i,0)v_{i}=(i,0), for i=0,,ni=0,\ldots,n, on the xx-axis. A red edge of length nn connects v0v_{0} and vnv_{n}. A small vertical edge of length δ\delta is attached to each viv_{i}, 1in11\leq i\in n-1, on each side of the xx-axis. The total length of the construction is E=n+2(n1)δ\|E\|=n+2(n-1)\delta.

Let G+=(V,EE+)G^{+}=(V,E\cup E^{+}) be a multigraph in which PP is a weakly simple Euler tour; and let PP^{\prime} be an ε\varepsilon-perturbation into a simple polygon, for some 0<ε<δ0<\varepsilon<\delta. Consider the vertical lines i:x=i+δ\ell_{i}^{-}:x=i+\delta and i+:x=(i+1)δ\ell_{i}^{+}:x=(i+1)-\delta, for 0in10\leq i\leq n-1, defined above. Analogously to case (1), G+G^{+} contains at least 4 path between i\ell_{i}^{-} and i+\ell_{i}^{+} for all but at most one index 0in10\leq i\leq n-1. It follows that EE+(4n2)(12δ)\|E\cup E^{+}\|\geq(4n-2)(1-2\delta). This lower bound tends to 4E4\|E\| as nn\rightarrow\infty and δn0\delta n\rightarrow 0.

(2) Refer to Figs. 7(f)–(g). Let nn\in\mathbb{N} be even, and δ(0,13)\delta\in(0,\frac{1}{3}). Place vertices vi=(i,0)v_{i}=(i,0), for i=0,,2ni=0,\ldots,2n, on the xx-axis. For i=0,,2ni=0,\ldots,2n, let vi+=(i,δ)v^{+}_{i}=(i,\delta), vi++=(i,2δ)v^{++}_{i}=(i,2\delta), vi=(i,δ)v^{-}_{i}=(i,-\delta), and vi=(i,2δ)v^{--}_{i}=(i,-2\delta). Vertices v0v_{0} and v2nv_{2n} are connected by a red edge v0vnv_{0}v_{n} of length 2n2n, and a black path (v0,v0+,v2+,v2,v2,v4,v6,v2n(v_{0},v^{+}_{0},v^{+}_{2},v_{2},v^{-}_{2},v^{-}_{4},v^{-}_{6},\ldots v_{2n}, that alternated between the two sized of the red edge. Finally, for every i=1,,ni=1,\ldots,n, we have a path (v2i+,v2i++,v2i1++,v2i1+,v2i1,v2i1(v_{2i}^{+},v_{2i}^{++},v_{2i-1}^{++},v_{2i-1}^{+},v_{2i-1},v_{2i-1}^{-} when ii is odd, and a reflection of this path in the xx-axis when ii is even. The total length of the construction is E=5n+6nδ\|E\|=5n+6n\delta.

Let G+=(V,EE+)G^{+}=(V,E\cup E^{+}) be a multigraph in which PP is a weakly simple Euler tour. The red edge connects two points on the boundary of ch(V){\rm ch}(V), we can apply Lemma A.3, and PP can be decomposed into three weakly simple tours: W.l.o.g., γ1\gamma_{1} contains the red edge and all edges of PP above the xx-axis; γ2\gamma_{2} (resp., γ3\gamma_{3}) is incident to v0v_{0} (resp., v2nv_{2n}) and contains edges below the xx-axis.

Let us consider the edges of E+γ1E^{+}\cap\gamma_{1}. For every odd integer 1in11\leq i\leq n-1, the edge v2i1v2i1+v_{2i-1}v_{2i-1}^{+} is in γ1\gamma_{1}, its two adjacent edges are in E+γ1E^{+}\cap\gamma_{1}, and their length between the lines x=2i2x=2i-2 and x=2ix=2i is at least 2. Similarly, edge v2i1+v2i1++v_{2i-1}^{+}v_{2i-1}^{++} is in γ1\gamma_{1}, at least one of its adjacent edges is in E+γ1E^{+}\cap\gamma_{1}, and its length between the lines x=2i2x=2i-2 and x=2ix=2i is at least 1. Every vertical line crosses the edges of γ1\gamma_{1} an even number of times, there are edges in E+γ1E^{+}\cap\gamma_{1} of length at least 2 between the lines x=2i+2x=2i+2 and x=2i+4x=2i+4. Summation over all odd indices i=1,,n1i=1,\ldots,n-1 yields E+γ15n2\|E^{+}\cap\gamma_{1}\|\geq 5\cdot\frac{n}{2}.

Consider now E+(γ2γ3)E^{+}\cap(\gamma_{2}\cup\gamma_{3}). For every odd integer 1in11\leq i\leq n-1, the edge v2i+1v2i+1v_{2i+1}v_{2i+1}^{-} is in γ2γ3\gamma_{2}\cup\gamma_{3}, its two adjacent edges are in E+(γ2γ3)E^{+}\cap(\gamma_{2}\cup\gamma_{3}), and their length between the lines x=2ix=2i and x=2i+2x=2i+2 is at least 2. Similarly, edge v2i+1v2i+1v_{2i+1}^{-}v_{2i+1}^{--} is in γ2γ3\gamma_{2}\cup\gamma_{3}, at least one of its adjacent edges is in E(γ2γ3)E^{-}\cap(\gamma_{2}\cup\gamma_{3}), and its length between the lines x=2ix=2i and x=2i+2x=2i+2 is at least 1. If a vertical line crosses γ2γ3\gamma_{2}\cup\gamma_{3}, it must cross it an even number of times. There are edges in E+(γ1E^{+}\cap(\gamma_{1} of length at least 4 between the lines x=2i2x=2i-2 and x=2ix=2i for all but at most one odd index i=1,n1i=1,\ldots n-1. Summation over all odd indices 1in11\leq i\leq n-1 yields E+(γ2γ3)7n22\|E^{+}\cap(\gamma_{2}\cap\gamma_{3})\|\geq 7\cdot\frac{n}{2}-2. Overall, we have E+(5+7)n22=6n2\|E^{+}\|\geq(5+7)\frac{n}{2}-2=6n-2. This lower bound tends to 65E\frac{6}{5}\|E\| as nn\rightarrow\infty and δn0\delta n\rightarrow 0.