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
Abstract.
Given 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 , for any , to obtain a simple polygon? While the analogous question for simple polygons can easily be answered in time, we show that it is NP-complete for weakly simple polygons. We give -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 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 graph1991 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 line segments in the plane. It is easy to decide in 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 is Eulerian, the edges can be subdivided times to obtain a weakly simple Euler tour. We also show that inserting new edges of total length at most 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 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 . Polygon is simple if is a Jordan curve (i.e., is injective); equivalently, if is the plane embedding of a Hamiltonian cycle. Polygon is weakly simple if, for every , the vertices can be perturbed to points , , such that is a simple polygon. The function denotes the Euclidean length of a line segment. Equivalently, a polygon given by is weakly simple if it can be perturbed to Jordan curve such that the Fréchet distance of the two curves is bounded by (i.e., ) [6]. We can test whether a polygon , is simple or weakly simple, respectively, in time [7] and time [1].
We define the WeaklySimplePolygonReconstruction (WSPR) problem as the following decision problem: Given a multiset of line segments in , does there exist a weakly simple polygon whose edge multiset is ? For a multiset of directed segments, we also define Directed-WSPR that asks whether there exists a weakly simple polygon such that . In both undirected and directed variants, we represent the input segments as a straight-line multigraph , where is the set of all segment endpoints. Note that 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 forms a weakly simple polygon, then no two segment cross. This condition can be easily tested in time by a line sweep.
If there is a weakly simple polygon with edge set , then is an Euler tour of the graph . (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 is Eulerian if and only if its dual graph is bipartite. This result extends to plane multigraphs when an edge of multiplicity is embedded as interior-disjoint Jordan arcs, that enclose 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) 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 are collinear. We assume that 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 in the Eulerian graph , or reports that no such tour exists.
Algorithm A
-
(1)
2-color the faces of white and gray so that the outer face is white; and create a list of circuits on the boundaries of the gray faces.
-
(2)
If 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 , report that has no weakly simple Euler tour.
-
(3)
Choose an arbitrary circuit in , remove it from and call it .
-
(4)
While there is a circuit in , do:
-
4.1
Find two consecutive edges, and , along a white face such that and for some .
-
4.2
Remove from the list , and merge and by traversing starting with the edge followed by the traversal of that ends with the edge ; see Figure 2(a).
-
4.1
-
(5)
Return .
Theorem 3.1.
A simple geometric graph admits a weakly simple Euler tour if and only if is Eulerian and, if 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 time.
Proof 3.2.
If is undirected, the algorithm construct an Euler tour [12]; and the tour is weakly simple by construction. In the remainder of the proof, we consider a directed Eulerian geometric graph . First, we show that if 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 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 constructed by Algorithm A is weakly simple, that is, it can be perturbed into a simple polygon. Initially, each circuit in is the boundary of a gray face, and hence it is a simple polygon. Let be perturbation obtained by moving each point to the interior of the face along an angle bisector of . Initially 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 and a circuit , their Jordan curve perturbations and can also be combined. Edges and are adjacent to a common white face ; they correspond to an edge in and in , where both and lie in the -neighborhood of in two different gray faces adjacent to . We can modify and in the -neighborhood of , by removing a short Jordan arc from each and reconnecting them across the white face into a single Jordan curve. By induction, we can obtain a Jordan curve within Frèchet distance from the output polygon . Hence, the algorithm returns a weakly simple Euler tour .
Now, we show that if has a vertex with two consecutive incoming (resp., outgoing) edges and , then does not admit a weakly simple Euler tour. Suppose, for contradiction, that there exists a weakly simple Euler tour . Since both and are directed into , the tour contains edge-disjoint paths and . Since is weakly simple, the circular order of these four edges incident to must be as shown in Figure 2(b). The polygon must contain edge-disjoint paths and . The perturbation of is where . Note that and are on opposite sides of the cycle . The perturbation of , path , can intersect neither nor , because and are adjacent to the same face. Hence is not weakly simple.
Finally, Algorithm A runs in time. Step 1 and 2 can be done by traversing the dual graph of . Step 4 executes merges, each of which takes constant time.
Corollary 3.3.
A geometric multigraph admits a weakly simple Euler tour if and only if is Eulerian. A weakly simple Euler tour, if exists, can be computed in time.
Proof 3.4.
Replace every edge of multiplicity by edge-disjoint paths of length two whose interior points are close to the midpoint of . We obtain a simple Eulerian geometric graph with vertices. Theorem 3.1 completes the proof.
Remark 3.5.
In the case that is a directed multigraph, replace every directed edge of multiplicity by edge-disjoint paths , with new (subdivision) vertices , , and denote by the resulting simple directed graph. The alternating direction condition of Theorem 3.1 requires that the multiplicity of and differ by at most one. If their multiplicities differ by exactly one, then there is a unique way to interleave the replacement paths between and . In fact, if any edge of has odd multiplicity, the alternating direction condition determines the cyclic order of all paths , and we can apply Theorem 3.1 for . If, however, all edges of 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 are collinear, then every Euler tour of is a weakly simple polygon.

Proof. Without loss of generality, assume that all vertices are on the -axis. Let be given. Let be an Euler tour of , and let be a leftmost vertex. For each vertex , , create a point with and . The polygonal path is strictly -monotonic and therefore does not cross itself. The edge can be realized as a one-bend polyline with , which is outside of the axis-aligned bounding box of all other edges. Therefore , illustrated in Figure 3, is a simple polygon where . ∎
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 and a (directed) straight-line multigraph , we can check whether is a (directed) Euler tour in in time, and whether is weakly simple in 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 whose partite sets are variables nodes and clauses nodes. The variable nodes are on the -axis, the clause nodes are above or below the -axis; each clause is adjacent to three variables. A clause is positive if it lies above the -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 -axis and vertices circled with a dotted ellipse represent the same graph vertex.


First, place vertices equally spaced on the variable line from left to right. The variable gadget corresponding to the th variable consists of two collinear paths between and , which are called red and black paths; see Figure 4. The red path is a single edge ; and the black path is made of edges where is the degree of the -th variable in the bipartite graph . We assign a vertex in the interior of this path to each edge connected to the variable, naming the vertex for the edge connecting the -th variable to the -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 as follows. Each individual gadget defines a cycle. As in Algorithm A, we will merge the cycles into the polygon . 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 -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 is weakly simple, we build a simple polygon within Fréchet distance from as follows (see Figure 5). For each create two vertices and located above and below respectively. If the solution assigns the -th variable true, move vertices up by , replace vertices and by and in the black edges (of the corresponding gadget) and by and in the red edges. Connect vertices and with an edge. Do the same for and . If the variable is assigned false, do analogous replacements symmetrically about the -axis. For each clause gadget, choose a literal with a true value, split into two vertices, and , with the same -coordinate and 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 into two vertices, and , with the same -coordinate and distance apart, such that the one closer to the -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.

Now assume that the graph produced by the reduction admits a weakly simple Euler tour . Then, there exist a simple polygon within an arbitrarily small Fréchet distance from . 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.
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 where every vertex has even degree and the point set is connected, we define the problem WSPR∗ as finding a sequence of edge subdivision operations that produces a graph that admits a weakly simple Euler tour. The subdivision of an edge at a vertex replaces by two edges and .
It is easy to see that WSPR∗ is always feasible with subdivisions where . Indeed, subdivide every edge recursively at each vertex that lies in the interior of . 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 such that every has even degree and is connected, can be transformed into a graph using edge subdivisions, and this bound cannot be improved.
Before the proof, we introduce some notation (from [1, 6, 8]). Let be a noncrossing graph. The transitive closure of the overlap relation is an equivalence relation on . The union of all edges in an equivalence class is called a bar, it is a line segment. A vertex is called -odd if is incident to an odd number of edges contained in , or -even otherwise. A vertex can be -odd and -even for different bars and (see Figure 6(b)).
Our algorithm will compute simple paths formed by subdivided edges. Let be a horizontal bar with vertices , . Let be an edge that contains and its right endpoint has minimum -coordinate. A subdivided paths, denoted by , is a path between and , defined recursively (see Fig. 6(d)): (i) if , ; (ii) if , then subdivide into three edges , , and and put ; (iii) if , then subdivide into two edges and , and put , where denotes concatenation. Consequently, if the segment contains vertices, a path can be constructed using at most 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 be a bar containing vertices. We apply edge subdivisions and partition the edges in into subsets: Subsets and will consists of subdivision paths between the intersection points of with other bars lying above and below , 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 and ; 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 (resp., ) of points in the interior of such that is -odd for some bar that is above or collinear to (resp., below ). A point can appear more than once in each list if it is odd in multiple bars . Sort the lists by , ties are broken by clockwise (resp., counterclockwise) order of the corresponding bars . If the left (resp., right) endpoint of is -odd, add it to the beginning (resp., end) of the list . If any of the lists have odd cardinality, append the right endpoint of 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 and denote the set of edges in such paths for and , respectively (see Figure 6(d)).
Phase 2. Let be the set of (subdivided) edges that lie on and are not in . The union of edges in may be a disconnected point set (e.g., as shown in Figure 6(d)). Let the line segment be one of the connected components of . Construct two edge disjoint subdivided paths and from the edges in . For every path in (resp., ) that overlaps with , identify an edge of (resp., ) that contains a vertex of and subdivide it at such vertex (see Figure 6(e)). Let (resp., ) be the set of edges in (resp., ) for all components of the union of edges in .
Phase 3. Let be the set of edges in . For every component of the subgraph induced by , let be the leftmost vertex of , identify the edge in that contains and subdivide it at . This concludes the construction of .








Correctness. Now we prove that admits a weakly simple Euler tour. Notice that is connected since the subdivisions in phase 2 connects every component of or to every overlapping component of or , and phase 3 connects every component of to some component in . Since edge subdivisions do not change the parity of degrees, every vertex in has even degree, hence is Eulerian. We construct an Eulerian geometric graph such that every Euler tour in is within Fréchet distance from an Euler tour in . Theorem 3.1 will then imply that there exists a simple polygon within Fréchet distance from an Euler tour in .
We recall some notation introduced in [6]. For every vertex , let be a disk centered at of radius . For a bar between and , let be the neighborhood of setminus . Assume that is so small that the disks are pairwise disjoint; a disk intersects only if , and the neighborhoods are pairwise disjoint.
For each bar with vertices , we perturb the edges of contained in into noncrossing simple polygons and polygonal chains. Embed each subdivided path in (resp., ) in the upper (resp., lower) boundary of the region such that is on the boundary of and is on the boundary of . Subdivide with horizontal lines where is the number of components of the subgraph induced by . Embed all edges in (resp., ) in the first (resp., -th) such line.
Recall that every vertex of has even degree. If contains a -odd vertex , there must exist a bar such that is -odd. Because and matches such points, the subgraph induced by contain only even degree vertices. By construction the edges in form nonoverlapping disjoint circuits. Hence, the subgraph induced by contains only even degree vertices. Consequently, each of its components is Eulerian and forms a weakly simple polygons that we denote by , sorted by the -coordinates of their left endpoints. Perturb into simple polygons that lie in the interior of , separated by one of the lines, in this linear order (ties are broken arbitrarily). For , consider all polygons whose leftmost vertex is . Connect the left endpoints of each such to the copy of in by two polygonal paths within (these paths connect different copies of vertex , see Figure 6(f)). Similarly, for each subdivision performed in phase 2 at of an edge in (resp., ) in a path , connect the copy of in this path to a copy in (resp., ) by two polygonal paths within the disk . Connect the endpoints of the overlapping paths in and (forming a cycle of each), and if the right endpoint of is not -odd and was added to , connect the copies of in and . For each matching in and involving a point that is a -odd endpoint of a bar , connect the paths in or that correspond to a match in to the path in of that contains . Finally, for each point that is the endpoint of a bar and is -even, connect the corresponding copies of , making the graph induced by all edges containing a point on connected. This concludes the construction of .
Theorem 3.1 completes the proof: An Euler tour of can be perturbed into a simple polygon such that . The tour maps to an Euler tour of by identifying the vertices that lie in the same disk , ; and .
Our lower bound construction is shown in Figure 7(a). It consists of a graph containing a long edge (shown in red) and a path of non-overlapping collinear edges that connects the endpoints of . Each vertex in the interior of is also incident to two small cycles above and below respectively. Although the graph is Eulerian, it does not admit a weakly simple Euler tour. Each vertex in the interior of the red edge is incident to two small triangles. Suppose that is not subdivided at . Then has degree 6. In any perturbation of a weakly simple Euler tour, vertex is split into 3 copies, each of degree 2, and each lying above or below . Suppose only one copy of lies below . Then it is incident to two edges of a small triangle below , which is then disconnected from the rest of the graph, a contradiction. Consequently, must be subdivided at all interior vertices. Figure 7(b) shows that subdivisions of suffice in this case.




5.2. Edge insertion
We define the problem WSPR+ as finding a set of edges such that admits a weakly simple Euler tour. Denote by and , respectively, the sum of the lengths of all edges in and . If the point set is disconnected, then there is no upper bound on . Otherwise, we can establish worst-case upper and lower bounds for in terms of .
Theorem 5.3.
Let be a noncrossing multigraph such that is a connected point set. Then there exists a set of line segments such that and admits a weakly simple Euler tour.
Proof 5.4.
We construct as follows. Partition into bars (equivalence classes of the transitive closure of the overlap relation on ). Denote by the union of edges in a bar. W.l.o.g., we may assume that is horizontal. Denote by the vertices of along sorted by -coordinates (where ). For , add an edge to if the edges of in the bar cover the line segment an odd number of times. The old and new edges in the bar jointly form a graph of even degree that we denote by . By Theorem 3.6, every component of admits a weakly simple Euler tour. Finally, add two more copies of edge to for all . After repeating the above steps for every bar, we have and is Eulerian.
We omit the proof of correctness (which is provided in Appendix A.), that shows that 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 in which an edge connects two points on the boundary of the convex hull of , denoted .
Theorem 5.5.
Let be a family of noncrossing multigraphs. For , let be an edge set of minimum length such that admits a weakly simple Euler tour; and let . Then:
-
(1)
, where Eulerian noncrossing multigraphs.
-
(2)
, where connected noncrossing multigraphs.
-
(3)
, where noncrossing multigraphs such that is connected.
Proof 5.6.
(1) Refer to Figs. 7(a)–(c). Let and . Place vertices , for , on the -axis. A red edge of length connects and . A black edge of length connects and for . A small cycle of length is placed on each , , on each side of the -axis. The total length of the construction is .
Let be a multigraph in which is a weakly simple Euler tour; and let be an -perturbation into a simple polygon, for some . We define a pair of vertical lines and , for . The portion of between any two of these lines consists of disjoint paths whose endpoints are on the lines. By Morse theory, 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 contains at least 4 paths between and for all but at most one index . Indeed, suppose that there are two such paths between and and between and (). We may assume w.l.o.g. that the black edge is above the red edge between and . Then the black edge must be above the red edge between and , as well. Consequently, cannot reach the small cycles at . This confirms the claim. It follows that . This lower bound tends to as and .
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 subdivision points to form a weakly simple polygon, or to find an edge set with length up to that produce a weakly simple polygon. We have shown that subdivision points are always sufficient and sometimes necessary when the input is Eulerian; and new edges of length are always sufficient and sometimes necessary when is connected. However, the best constant coefficients are not known in most cases. We conjecture that every noncrossing Eulerian graph can be augmented into a graph that admits a weakly simple Euler tour such that .
If the segments in 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 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 can be augmented into a simple polygon [16]. However, it is not known whether the problem remains NP-hard when 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.

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 and 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 admits a weakly simple Euler tour. Note that an -perturbation of an -perturbation is an -perturbation. We shall construct an -perturbation of into an Eulerian geometric graph, and then Theorem 3.1 yields and -perturbation into a simple polygon for all .
For each bar with vertices , we perturb the edges of contained in into simple polygons: Let be the circuit formed by two copies of the path , and embed on the boundary of the region such that is on the boundary of and is on the boundary of . The components of each form weakly simple polygons that we denote by , sorted by the -coordinates of their left endpoints. Perturb into simple polygons that lie in the interior of , separated by lines parallel to , in this linear order (ties are broken arbitrarily). For , consider all polygons whose leftmost vertex if . Connect the left endpoints of each such to the copy of in the upper arc of by two polygonal paths within (these paths connect different copies of vertex ). Similarly, if bars and intersect at some vertex , then connect the corresponding vertices in and by two polygonal paths within the disk . These connector paths augment the pairwise disjoint polygons , , for all bars , into a simple Eulerian noncrossing geometric graph .
Theorem 3.1 completes the proof: An Euler tour of can be perturbed into a simple polygon such that . The Euler tour of maps to an Euler tour of by identifying the vertices that lie in the same disk , ; and .
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 .
Lemma A.3.
Let be a multigraph that admits a weakly simple Euler tour and an edge where and are on the boundary of . Then admits a weakly simple Euler tour composed of 3 weakly simple polygons: contains all edges that lie in one of the open halfplanes bounded by ; contains all edges in the other open halfplane, is incident to , and is incident to .
Proof A.4.
Assume w.l.o.g. that is horizontal. Let be an arbitrary weakly simple Euler tour of . Cut at the vertices and into paths . Note that every path in consists of edges that lie in one closed halfplane bounded by , since every subpath of between the two open halfplanes must go through or .
Clearly, the number of paths in between and is even, and the path lies in both closed halfplanes. Therefore, there is a partition such that every path in (resp., ) lies in the closed halflane below (resp., above) ; and and each contain an even number of paths between and . Assume w.l.o.g. that . Then the paths in form a weakly simple polygon. The paths in incident to also form a weakly simple polygon; and the remaining paths in (all incident to 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 and . Place vertices , for , on the -axis. A red edge of length connects and . A small vertical edge of length is attached to each , , on each side of the -axis. The total length of the construction is .
Let be a multigraph in which is a weakly simple Euler tour; and let be an -perturbation into a simple polygon, for some . Consider the vertical lines and , for , defined above. Analogously to case (1), contains at least 4 path between and for all but at most one index . It follows that . This lower bound tends to as and .
(2) Refer to Figs. 7(f)–(g). Let be even, and . Place vertices , for , on the -axis. For , let , , , and . Vertices and are connected by a red edge of length , and a black path , that alternated between the two sized of the red edge. Finally, for every , we have a path when is odd, and a reflection of this path in the -axis when is even. The total length of the construction is .
Let be a multigraph in which is a weakly simple Euler tour. The red edge connects two points on the boundary of , we can apply Lemma A.3, and can be decomposed into three weakly simple tours: W.l.o.g., contains the red edge and all edges of above the -axis; (resp., ) is incident to (resp., ) and contains edges below the -axis.
Let us consider the edges of . For every odd integer , the edge is in , its two adjacent edges are in , and their length between the lines and is at least . Similarly, edge is in , at least one of its adjacent edges is in , and its length between the lines and is at least . Every vertical line crosses the edges of an even number of times, there are edges in of length at least between the lines and . Summation over all odd indices yields .
Consider now . For every odd integer , the edge is in , its two adjacent edges are in , and their length between the lines and is at least . Similarly, edge is in , at least one of its adjacent edges is in , and its length between the lines and is at least . If a vertical line crosses , it must cross it an even number of times. There are edges in of length at least between the lines and for all but at most one odd index . Summation over all odd indices yields . Overall, we have . This lower bound tends to as and .