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

Non-crossing Hamiltonian Paths and Cycles
in Output-Polynomial Time

David Eppstein Department of Computer Science, University of California, Irvine. Research supported in part by NSF grant CCF-2212129.
Abstract

We show that, for planar point sets, the number of non-crossing Hamiltonian paths is polynomially bounded in the number of non-crossing paths, and the number of non-crossing Hamiltonian cycles (polygonalizations) is polynomially bounded in the number of surrounding cycles. As a consequence, we can list the non-crossing Hamiltonian paths or the polygonalizations, in time polynomial in the output size, by filtering the output of simple backtracking algorithms for non-crossing paths or surrounding cycles respectively. To prove these results we relate the numbers of non-crossing structures to two easily-computed parameters of the point set: the minimum number of points whose removal results in a collinear set, and the number of points interior to the convex hull. These relations also lead to polynomial-time approximation algorithms for the numbers of structures of all four types, accurate to within a constant factor of the logarithm of these numbers.

1 Introduction

In how many ways can we “connect the dots”, turning planar points into the vertices of a simple polygon? Despite heavy study, the answer is still unclear. Steinhaus proved in the 1960s that general-position points always have at least one polygonalization [32], but the condition is too strong: non-collinearity suffices. Points in convex position have only one polygonalization; other inputs can have exponentially many, but with upper and lower bounds that are far from matching [16, 31]. The complexity of counting polygonalizations is unknown [24, 22, 13]. Although all polygonalizations can be listed in singly-exponential time [35, 37], it was unknown (prior to our work) how to list them more quickly when there are few, for instance in polynomial time per output or in time polynomial in the output size.

Our main result is that both polygonalizations and a closely related structure, non-crossing Hamiltonian paths, can be listed in time polynomial in the output size by simple backtracking algorithms. These algorithms search spaces of easier-to-list structures, the surrounding polygons [37] and non-crossing paths, respectively. To prove these new results, following our work on monotone parameters of point sets [12], we relate the numbers of all four types of structures (polygonalizations, surrounding polygons, non-crossing Hamiltonian paths, and non-crossing paths) to two easily-computed parameters that depend only on the order-type of the points: the smallest number of points whose removal results in a collinear subset, and the number of points interior to the convex hull. These relations imply that the number of polygonalizations is at most polynomial in the number of surrounding polygons, and that the number of non-crossing Hamiltonian paths is at most polynomial in the number of non-crossing paths. Therefore, an algorithm for the easier-to-list structures will take output-polynomial time when its output is filtered to generate only the harder-to-list structures. Our methods also provide a polynomial-time approximation algorithm for counting these structures, obtaining a constant approximation ratio with respect to the logarithm of the count.

We do not calculate explicitly the exponents of the polynomials relating these numbers of structures, as our upper bounds are quite imprecise. Instead, in a final section, we describe point sets whose exponential numbers of non-crossing structures can be calculated precisely. These examples demonstrate that the exponent of paths in terms of Hamiltonian paths can be at least log231.585\log_{2}3\approx 1.585 and that the exponent of surrounding polygons in terms of polygonalizations can be at least log2((3+5)/2)1.388\log_{2}\bigl{(}(3+\sqrt{5})/2\bigr{)}\approx 1.388.

Output-polynomial time bounds, such as we prove, are not as good as a time bound that multiplies the output size by a polynomial of the input size, and even less good than polynomial delay for each output structure. Nevertheless, our results represent a significant improvement on previously known time bounds, which are singly exponential even for inputs whose output size is subexponential.

1.1 Related work

A planar straight line graph, with given points as vertices, consists of line segments having the points as endpoints, with no line segment passing through a given point and no two line segments intersecting except at a shared endpoint. When the form of the resulting graph is constrained, one obtains non-crossing structures of various types, including triangulations (non-crossing maximal planar graphs), non-crossing spanning trees, and polygonalizations (non-crossing Hamiltonian cycles). Extensive research in discrete and computational geometry has sought upper and lower bounds for numbers of non-crossing structures, and studied algorithmic problems of counting or listing these structures for a given point set, or of finding a non-crossing structure that is optimal for some objective function [2, 3, 15, 16, 11, 30, 19, 29, 31, 4, 22, 8]. Many problems of this sort have algorithms for listing all graphs, with polynomial time per output, based on systems of local moves that link the state space into a connected structure [5, 7, 1, 20, 36, 33, 35, 37].

However, for polygonalizations and non-crossing Hamiltonian paths no such structure is known, and natural systems of local moves that change two or three edges at a time are known not to connect all polygonalizations [18]. Certain generalizations of polygonalizations have state spaces connected by local moves [9, 37], but this does not directly yield fast algorithms for polygonalizations, because of the many non-polygonalizations in these state spaces. As a 2011 survey of Welzl summarizes, “Basically nothing is known for related algorithmic questions (determining the number of simple polygonizations for a given point set, enumerating all simple polygonizations)” [34]. The shortest polygonalization is the 𝖭𝖯\mathsf{NP}-hard Euclidean traveling salesperson tour [28], and several other optimal polygonalizations are also 𝖭𝖯\mathsf{NP}-hard [14, 10]; the complexity of the longest polygonalization is another unknown [11].

Past work on non-crossing Hamiltonian paths includes approximation to the longest path [3, 11] and the existence of properly colored paths for colored point sets [6]. The number of non-crossing Hamiltonian paths can range from one, for collinear points, to exponentially large; for instance, n2n\geq 2 points in convex position have exactly n2n3n2^{n-3} paths [27].

The surrounding polygons that we use for our polygonalization algorithm are another class of planar straight line graphs: they are the simple polygons that use a subset of the input points as vertices, and contain all of them. Yamanaka et al. [37] introduced these polygons, and showed how to list them in polynomial time per polygon, from which they derived a singly-exponential time bound and polynomial space bound for listing polygonalizations. Despite this progress they were unable to obtain an output-sensitive time bound for polygonalizations. It is their algorithm that we follow here, with a new output-sensitive analysis. Yamanaka et al. also prove that, in the worst-case exponential bounds for numbers of polygonalizations and surrounding polygons, the bases of the exponentials are within 1 of each other; however, this analysis does not imply our stronger result, that on arbitrary instances the numbers of these two types of polygons are bounded by polynomials of each other. The examples from our final section confirm theoretically the empirical results of Yamanaka et al. that polygonalizations and surrounding polygons can grow at different rates.

2 Two simple backtracking algorithms

In this section we outline two simple algorithms (one a standard backtracking search, and the other the reverse search algorithm of Yamanaka et al. [37]) for listing non-crossing paths and surrounding cycles. These known algorithms will be the ones we use to prove our new time bounds for listing non-crossing Hamiltonian paths and polygonalizations. We state these bounds as theorems in this section, and defer the proofs to later sections.

Definition 1.

Define a non-crossing path for a set of points SS to be a non-self-intersecting polygonal curve PP that passes through a subset of points of SS, has endpoints in SS, and turns only at points of SS. Define the vertices of a non-crossing path to be the set PSP\cap S, counting a point of SS as a vertex even when PP passes straight through that point. Define a non-crossing path sequence to be the sequence of vertices in a non-crossing path of a given set of points in the plane, including also one-vertex sequences and the empty sequence. Let |S||S| denote the number of points in SS, let #path(S)\textsc{\#path}(S) denote the number of non-crossing paths with vertices in SS, and let #ham(S)\textsc{\#ham}(S) denote the number of non-crossing Hamiltonian paths of SS.

Each non-crossing path corresponds to two sequences (one for each end-to-end order in which its vertices can be placed). We can form a rooted tree with the non-crossing path sequences as its nodes, in which the empty sequence is the root, by defining the parent of any other sequence to be the subsequence obtained by removing its last vertex. The non-crossing path sequences can be listed in polynomial time per sequence by performing a depth-first search of this tree. With a little care in listing the children of each node quickly, we can reduce this to linear time per sequence:

Subroutine 2 (listing children of a non-crossing path sequence).

To find the children of a non-crossing path sequence σ\sigma, ending at point pp:

  • Apply the simple stack-based linear time algorithm of Lee to determine the visibility polygon VV of the final vertex of the path, the region of the plane within which that vertex can be connected to another point by a segment that does not cross the existing path [21].

  • Let UU be the set of points not in σ\sigma, and find the radial ordering of UU around pp. When there are ties, keep only the closest of the tied points to pp.

  • Merge the radial orderings of UU and VV to determine, for each point uu in UU, the edge of VV that is crossed by a ray from pp through uu.

  • Whenever the merge finds a point uu that is closer to pp than the corresponding edge of VV, make a child sequence by concatenating uu to the end of σ\sigma.

The radially-sorted lists of all points around each of the given point can be precomputed and stored in O(|S|2)O(|S|^{2}) time; essentially, this is the same as the problem of constructing and storing an arrangement of lines dual to the points. With this precomputation, all steps of this algorithm take time O(|S|)O(|S|).

Subroutine 3 (listing all non-crossing paths).

To list all non-crossing paths of a given set of points, perform a depth-first search of the tree of non-crossing path sequences, using 2 to list the children of each node in the tree. For each node that the search reaches, output it as a path whenever the starting vertex of the sequence has a smaller index than the ending vertex, so that we only output each non-crossing path once. For a point set SS, we spend O(|S|2)O(|S|^{2}) preprocessing time and O(|S|)O(|S|) time per path. The number of paths is always Ω(|S|2)\Omega(|S|^{2}), even for collinear point sets, because a Hamiltonian path always exists and contains that many paths within it, so the preprocessing time is dominated by the per-path time and the total time is O(|S|#path(S))O(|S|\cdot\textsc{\#path}(S)).

With these subroutines in hand, we can list all non-crossing Hamiltonian paths by the following very simple algorithm.

Algorithm 4 (listing non-crossing Hamiltonian paths).

To list all non-crossing Hamiltonian paths in a point set SS:

  • List all non-crossing paths by 3.

  • Whenever a path uses all points of SS, output it as a non-crossing Hamiltonian path.

Theorem 5.

For a point set SS (not assumed to be in general position), Algorithm 4 takes time (|S|#ham(S))O(1)\left(|S|\cdot\textsc{\#ham}(S)\right)^{O(1)} to list all non-crossing Hamiltonian paths.

Proof.

This follows from Theorem 20, later in this paper, which states that

#path(S)=(|S|#ham(S))O(1).\textsc{\#path}(S)=\bigl{(}|S|\cdot\textsc{\#ham}(S)\bigr{)}^{O(1)}.\qed

A very similar tree search can also be used for polygonalizations, instead of Hamiltonian paths.

Definition 6.

Yamanaka et al. [37] define a surrounding polygon of a point set SS to be a simple polygon having a subset of the points as its vertices, surrounding all of the vertices. These include the polygonalizations (in which the subset is all of the points) as well as other polygons; in particular, the convex hull is always a surrounding polygon. Define #surround(S)\textsc{\#surround}(S) to be the number of surrounding polygons in SS, and #poly(S)\textsc{\#poly}(S) to be the number of polygonalizations in SS.

Yamanaka et al. define a tree structure on surrounding polygons in which the root is the convex hull, and the parent of any surrounding polygon is obtained by removing one vertex (in a canonically chosen way) from its cyclic sequence of vertices. It follows from a version of the two-ears theorem for polygons (often credited to G. H. Meisters, but used earlier by Max Dehn [23, 17]) that every polygon that is not the convex hull has a parent.

Subroutine 7 (listing surrounding polygons).

As Yamanaka et al. [37] describe, the surrounding polygons of point set SS can be listed in time |S|O(1)|S|^{O(1)} per polygon, and space O(|S|)O(|S|), by a depth-first search of the tree of polygons. The algorithm uses the method of reverse search [5] to perform the depth-first search while only maintaining the identity of a bounded number of tree nodes.

Again, we can use this to list all polygonalizations, as was already done by Yamanaka et al. [37].

Algorithm 8 (listing polygonalizations).

To list all polygonalizations of a point set SS:

  • List all surrounding polygons by 7.

  • Whenever a polygon uses all points of SS output it as a polygonalization

Yamanaka et al. analyzed this algorithm as having singly-exponential time, but we instead prove that it is output-sensitive:

Theorem 9.

For a point set SS (not assumed to be in general position), Algorithm 8 takes time (|S|#poly(S))O(1)\bigl{(}|S|\cdot\textsc{\#poly}(S)\bigr{)}^{O(1)} to list all polygonalizations.

Proof.

This follows from Theorem 30, later in this paper, which states that

#surround(S)=#poly(S)O(1).\textsc{\#surround}(S)=\textsc{\#poly}(S)^{O(1)}.\qed

3 Counting paths

The main result of this section is to prove a polynomial relation between the number of non-crossing paths and the number of non-crossing Hamiltonian paths, in any point set. This result combines a lower bound on the non-crossing Hamiltonian paths of a point set SS, and an upper bound on the number of non-crossing paths, both expressed as a function of the following quantity.

Definition 10.

Following [12], define offline(S)\textsc{offline}(S) to be the smallest kk such that removing kk points from SS leaves a collinear subset.

It will be convenient to have the following standard bound on logarithms of binomial coefficients. We use log\log to denote the natural logarithm, but this choice of base makes no difference to the following lemma, because a change of base would only change the logarithm by a constant factor.

Lemma 11.

For integers kk and nn with kn/2k\leq n/2,

log(nk)=Θ(klognk).\log\binom{n}{k}=\Theta\left(k\log\frac{n}{k}\right).
Proof.

By applying Stirling’s formula, taking logarithms, and omitting terms that are O(logn)O(\log n), we obtain

log(nk)lognnkk(nk)nk=klognk+(nk)lognnk.\log\binom{n}{k}\approx\log\frac{n^{n}}{k^{k}(n-k)^{n-k}}=k\log\frac{n}{k}+(n-k)\log\frac{n}{n-k}.

This expression is symmetric in kk and nkn-k, and when kn/2k\leq n/2, the first term of this approximation is the larger of the two. ∎

3.1 Upper bound

We begin our bounds on non-crossing paths with the simplest one to prove, the upper bound. It is known that the number of paths is at most singly-exponential in the number nn of vertices; we prove a tighter bound depending exponentially on the smaller number offline(S)\textsc{offline}(S) and only polynomially on nn.

Lemma 12.

Let SS be a set of nn points, with offline(S)=k\textsc{offline}(S)=k. Then

log#path(S)=O(logn+k(lognk+1)).\log\textsc{\#path}(S)=O\left(\log n+k\left(\log\frac{n}{k+1}\right)\right).
Proof.

We describe a method for encoding a non-crossing path using this many bits of information, so that each path is uniquely described by this encoding. For an encoding with bb bits of information, the number of paths can be at most 2b2^{b} and the logarithm of this number is O(b)O(b). Let KK be a subset of SS, with |K|=k|K|=k, such that SKS\setminus K lies on a line LL, and let PP be any given non-crossing path in SS. Let =|LS|\ell=|L\cap S|; because kk is the minimum number of points that can be removed to form a collinear set, no point of KK can lie on LL, and =nk\ell=n-k. To describe PP, we combine the following pieces of information:

  • The set QQ of points of LSL\cap S that belong to PP, but for which zero or one of their neighbors in the path belong to LL. Each such point is one of the two neighbors of a point in KK, or one of the two ends of PP, so |Q|2k+2|Q|\leq 2k+2. QQ can be encoded by specifying its size and the subset of LSL\cap S of that size, out of (|Q|)\tbinom{\ell}{|Q|} possibilities, so by Lemma 11 the number of bits needed to specify it is O(logn+k+klog(n/k))O\bigl{(}\log n+k+k\log(n/k)\bigr{)}. (Both the logn\log n term and the +1+1 in the statement of the lemma are included to handle the case when k=0k=0 but |Q|>0|Q|>0. Lemma 11 applies only when kn/2k\leq n/2 but for larger kk the bound to be proven is superlinear and the result is immediate.)

  • For each point in QQ, a specification of whether it has a neighbor in LL, and if so in which direction. This takes O(k)O(k) bits of information.

  • The induced subgraph P[KQ]P[K\cup Q], a linear forest using only the points in KQK\cup Q, and omitting the edges of PP that lie entirely within LL. As with any type of planar straight-line graph, the number of linear forests on O(k)O(k) points is singly exponential in kk [30], so P[K]P[K] can be encoded with O(k)O(k) bits of information.

Then PP may be recovered by combining the induced subgraph P[KQ]P[K\cup Q] with segments of LL starting and ending at points of QQ and continuing in the specified direction from each of these points. All pieces of this encoding add up to the stated bound on the number of bits needed to encode the entire path. ∎

3.2 Visible-vertex paths

Refer to caption
Refer to caption
Figure 1: Left: A point pp (blue), a point set SS (red and yellow), and the visible vertices of SS from pp (the three red vertices). Note that points of SS that lie within convex hull edges are not counted as vertices. Right: A maximal visible-vertex path (red edges) for S{p}S\cup\{p\} starting from pp, showing for one of its steps the hull (light blue) and visible vertices (red) of the remaining points.

Our lower bounds will greedily construct paths such that, at each step, the remaining unused points have a convex hull that is uncrossed by the current path and is visible from the endpoint of the current path.

Definition 13.

Define a visible vertex of a finite point set SS, from a point pp that is not in the convex hull of SS, to be a vertex qq of the convex hull of SS such that the open line segment pqpq is disjoint from the convex hull of SS (Fig. 1, left). We do not consider points interior to edges of the convex hull to be vertices, and in particular they are not visible vertices, even when segment pqpq is disjoint from the hull.

Observation 14.

Every nonempty finite point set SS and point pp not in the convex hull of SS has at least one visible vertex of SS from pp. If S{p}S\cup\{p\} is not collinear, there are at least two visible vertices.

Define a visible-vertex path to be a polygonal chain formed by a greedy algorithm that builds a sequence of vertices, beginning with any vertex of the convex hull, by repeatedly appending to the sequence a visible vertex of the remaining points not yet in the sequence, as viewed from the last point of the sequence (Fig. 1, right). A maximal visible-vertex path is a visible-vertex path that uses all of the points in a given point set SS; this name is justified by the following lemma.

Lemma 15.

Every visible-vertex path is a non-crossing path. Every maximal visible-vertex path is a non-crossing Hamiltonian path. Every non-maximal visible-vertex path can be extended to a longer visible-vertex path.

Proof.

Maximal visible-vertex paths are Hamiltonian, by definition: they are defined to be paths that use all the points. Because each step in a visible-vertex path is defined locally, without respect to the earlier parts of the path, the ability to extend every non-maximal path follows immediately from 14.

It remains to prove that the resulting paths are non-crossing. For every segment pqpq of the path, the next segment is incident to qq and therefore cannot cross pqpq. All segments after the next segment lie within the convex hull of the remaining points after qq. Since pp and qq are vertices of their respective convex hulls, the convex hull of the points after them in the path does not contain them. Moreover, segment pqpq does not cross this hull, because if it did then qq would not be visible from pp. Thus, these later segments are disjoint (as closed line segments) from the closed line segment pqpq and so cannot cross pqpq nor even pass through qq. Therefore, pqpq cannot intersect any later segment. For each pair of segments in the path, a crossing is ruled out by applying this argument to the earlier of the two segments in the path, so no crossing can exist. ∎

Lemma 16.

In every finite point set SS, every two vertices pp and qq of the convex hull of SS form the endpoints of a non-crossing Hamiltonian path.

Proof.

Form a maximal visible-vertex path beginning at pp, at each step choosing a visible vertex that is not qq when this is possible. By 14, the path will have two points to choose between (one of which is not qq) until the remaining points become collinear. Once they do, all remaining points that are not qq will lie between qq and the current end of the path, so qq cannot be included in the path until it is the last point remaining. ∎

3.3 Lower bound for far-from-collinear sets

To lower-bound the number of non-crossing Hamiltonian paths in a point set SS, as a function of offline(S)\textsc{offline}(S), we divide into two cases: the case where offline(S)\textsc{offline}(S) is large (at least proportional to a constant fraction of |S||S|) and the case where it is small. The following lemma is valid for all non-collinear SS, but is only tight (within a constant factor of the logarithm) in the large case.

Refer to caption
Figure 2: A tree of the visible-vertex paths in a point set, where the parent of each path is obtained by removing its last point. This point set has offline(S)=2\textsc{offline}(S)=2. The root and the next two levels of nodes each have multiple children, but some nodes on the last level shown in the figure have only one child, because the last point on the path is collinear with all remaining points.
Lemma 17.

For every point set SS that does not lie on a single line, the number of non-crossing Hamiltonian paths is at least 322offline(S).\tfrac{3}{2}\cdot 2^{\textsc{offline}(S)}.

Proof.

We form a tree TT of visible-vertex paths, in which the root is the empty sequence of vertices and the parent of any nonempty path is obtained by removing its last vertex (Fig. 2). By Lemma 15, the leaves of TT are non-crossing Hamiltonian paths. The root node of TT has at least three children (one for each convex hull vertex). In the nodes of TT at distance at most offline(S)\textsc{offline}(S) from the root, the last point in the path represented by each node is not collinear with the remaining points, by the definition of offline. It follows by 14 that these nodes have at least two choices of visible vertices and therefore that they have at least two children.

As a tree in which the root node has at least three children and the nodes in the next offline(S)\textsc{offline}(S) levels have at least two children, TT has at least 32offline(S)3\cdot 2^{\textsc{offline}(S)} leaves. Each leaf is a non-crossing Hamiltonian path, and each non-crossing Hamiltonian path can come from at most two leaves (one for each endpoint, if both endpoints are convex hull vertices). Therefore, there are at least 322offline(S)\tfrac{3}{2}\cdot 2^{\textsc{offline}(S)} non-crossing Hamiltonian paths. ∎

3.4 Lower bound for near-collinear sets

Although the next lemma covers only a special class of point sets, it is the key to our lower bounds for the case where offline(S)\textsc{offline}(S) is small.

Lemma 18.

Let SS be a set of points with |S|=n|S|=n, such that \ell points of SS lie on a line LL and the remaining points all lie on the same side of the line. Then

#ham(S)(n/2/2).\textsc{\#ham}(S)\geq\binom{n-\lceil\ell/2\rceil}{\lfloor\ell/2\rfloor}.
Refer to caption
Figure 3: Partition of the halfspace above LL into convex subsets, a non-crossing Hamiltonian path respecting the partition, and its signature, a 010010-avoiding binary sequence.
Proof.

We may assume without loss of generality that 2\ell\geq 2, for otherwise the lemma states only that there exists a single non-crossing Hamiltonian path, known to be true. For convenience consider an orientation of the plane in which LL is horizontal and SS lies in the closed halfspace above LL. We will prove the lemma by constructing many non-crossing Hamiltonian paths in which the points of LSL\cap S appear in left-to-right order, and no point in LL has two neighbors in SLS\setminus L. For any such path, define its signature to be the binary sequence with a 11-bit for points in LL and a 0-bit for points in SLS\setminus L (Fig. 3). It has length nn, with \ell 11-bits, and does not have any three consecutive bits in the pattern 010010. The number of 010010-avoiding sequences with nn bits and \ell 11-bits is [25]

j=0n(1)j(n1j)(|n2j|j)(n/2/2),\sum_{j=0}^{n-\ell}(-1)^{j}\binom{n-\ell-1}{j}\binom{|n-2j|}{\ell-j}\geq\binom{n-\lceil\ell/2\rceil}{\lfloor\ell/2\rfloor},

where for the simpler formula on the right hand side of the inequality the 11-bits are grouped into /2\lfloor\ell/2\rfloor pairs (with one group of three if \ell is odd) and we count only the sequences in which each pair or triple appears consecutively. (By the assumption that 2\ell\geq 2, at least one such grouping is possible.) As we argue in the remainder of the proof, every 010010-avoiding sequence is the signature of at least one non-crossing Hamiltonian path, so this lower bound on the number of 010010-avoiding sequences also provides a lower bound on the number of non-crossing Hamiltonian paths.

For a given 010010-avoiding sequence σ\sigma, let nin_{i} denote the length of the iith non-empty block of consecutive 0-bits in σ\sigma. We will partition the halfplane above LL into convex sets CiC_{i}, each containing nin_{i} points of SLS\setminus L, by a greedy process that maintains a convex subset of the halfplane containing the remaining points to be partitioned. Initially the convex subset is the entire halfplane and the remaining points are SLS\setminus L. On the iith step (for any ii other than the last one), let pip_{i} be the point of SLS\cap L that corresponds to the 11-bit of σ\sigma following the iith block of 0-bits. Sort the remaining points of SLS\setminus L radially around pip_{i} (in left to right order with respect to LL) breaking ties in favor of closer points to pip_{i}, and let qiq_{i} be the point in position nin_{i} of this sorted order. Draw line piqip_{i}q_{i}, separating CiC_{i} on its left from a remaining convex subset on its right. Assign the nin_{i} points up to qiq_{i} in the radial sorted order to set CiC_{i}, and leave the remaining points (possibly including farther points on line piqip_{i}q_{i}) unassigned. In the final step of this construction, assign all remaining points to the final remaining convex region. For instance, in Fig. 3, the leftmost set C1C_{1} (yellow) is separated from the rest of the halfplane by line p1q1p_{1}q_{1}. Here p1p_{1} is the leftmost point of LL, and q1q_{1} is the fifth point in the radial ordering around p1p_{1}. Point q1q_{1} lies on the boundary of four convex regions but is assigned to the first, C1C_{1}. Line p1q1p_{1}q_{1} also contains another point of SS, farther from p1p_{1}, which is assigned to C4C_{4} (green).

Once this partition into convex sets has been determined, use Lemma 16 to find a non-crossing Hamiltonian path within each convex set CiC_{i} that starts and ends at its (one or two) points on LL, and connect these paths in sequence by segments of LL to form a non-crossing Hamiltonian path for all of SS, with the given 010010-avoiding sequence σ\sigma as its signature. ∎

3.5 Putting the bounds together

Combining the two different lower bounds into a single formula, we have:

Lemma 19.

Let SS be a set of nn points with offline(S)=k.\textsc{offline}(S)=k. Then

log#ham(S)=Ω(k(lognk+1)).\log\textsc{\#ham}(S)=\Omega\left(k\left(\log\frac{n}{k+1}\right)\right).
Proof.

For any kk, the logarithm of the number of non-crossing Hamiltonian paths is Ω(k)\Omega(k) by Lemma 17. For kn/3k\geq n/3, log(n/k)=O(1)\log(n/k)=O(1), so for this range of kk, this Ω(k)\Omega(k) bound is equivalent to the bound stated in the theorem.

For smaller values of kk, let KK be any set of kk points whose removal from SS leaves a collinear set of size =nk=Ω(n)\ell=n-k=\Omega(n), belonging to a line LL. Partition KK into the two subsets K1K_{1} and K2K_{2} on the two sides of LL, with |K1||K2||K_{1}|\geq|K_{2}|; let |K1|=kk/2|K_{1}|=k^{\prime}\geq k/2. Let pp be the first point of SLS\cap L, in the sorted sequence of the points along this line, let =1\ell^{\prime}=\ell-1 be the number of remaining points in SLS\cap L, and let n=+kn^{\prime}=\ell^{\prime}+k^{\prime}. By Lemma 18, the number of non-crossing Hamiltonian paths of SK2S\setminus K_{2} that start at pp is at least

(n/2/2)=(/2+kk).\binom{n^{\prime}-\lceil\ell^{\prime}/2\rceil}{\lfloor\ell^{\prime}/2\rfloor}=\binom{\lfloor\ell^{\prime}/2\rfloor+k^{\prime}}{k^{\prime}}.

Each such path can be extended to a non-crossing Hamiltonian path of all of SS by concatenating any non-crossing path through pp and the points of K2K_{2}. By the assumption that k<n/3k<n/3, the bottom term of the right binomial coefficient is at most half the top term, allowing us to apply Lemma 11. By this lemma, and the facts that k=Θ(k)k^{\prime}=\Theta(k) and =Θ(n)\ell^{\prime}=\Theta(n), the logarithm of this binomial coefficient is Ω(klog(n/k))\Omega\bigl{(}k\log(n/k)\bigr{)} as stated. ∎

Although the upper bound of Lemma 12 and the lower bound of Lemma 19 are not quite the same, we can combine them to achieve a constant factor approximation to the logarithm of the number of non-crossing paths, or Hamiltonian paths.

Theorem 20.

For a given point set SS,

#path(S)=(|S|#ham(S))O(1).\textsc{\#path}(S)=\bigl{(}|S|\cdot\textsc{\#ham}(S)\bigr{)}^{O(1)}.
Proof.

Taking logs of both sides, it is equivalent to write that

log#path(S)=O(log|S|+log#ham(S)).\log\textsc{\#path}(S)=O(\log|S|+\log\textsc{\#ham}(S)).

This follows immediately from Lemma 19 and Lemma 12, according to which log#ham(S)\log\textsc{\#ham}(S) is lower-bounded and log#path(S)\log\textsc{\#path}(S) upper-bounded (respectively) to within constant factors by formulas that differ from each other only in an additive log|S|\log|S| term. ∎

4 Counting cycles

For counting both surrounding cycles and polygonalizations of general-position point sets, in place of offline(S)\textsc{offline}(S) (which the general-position assumption makes trivial) we use the following parameter:

Definition 21.

Let inhull(S)\textsc{inhull}(S) denote the number of points of SS that are interior to the convex hull of SS.

For counting cycles and polygonalizations of point sets that are not assumed to be in general position, we will use a combined analysis in terms of both offline and inhull.

4.1 Upper bound

Our bounds for surrounding cycles and polygonalizations follow similar arguments to our bounds for paths. Lemma 12. A key observation (true for surrounding cycles but not paths) is that the vertices of the convex hull that do not connect to interior points behave predictably:

Observation 22.

In a surrounding cycle for a point set SS, every vertex of the convex hull of SS is a vertex of the cycle, and every edge of the cycle that has two convex hull vertices as its endpoints must be a convex hull edge.

Proof.

The convex hull vertices cannot be interior to the hull or interior to an edge, by definition, so being a vertex of the cycle is the only way they can be surrounded. Any other segment between hull vertices would block all visibilities from one side of the segment to the other. A non-crossing cycle using such a segment could only have vertices on one side of the segment, and would be unable to have among its vertices the vertices of the convex hull of SS that lie on the other side. ∎

Lemma 23.

Let SS be a set of nn points, with inhull(S)=h\textsc{inhull}(S)=h. Then

log#surround(S)=O(h(lognh+1)).\log\textsc{\#surround}(S)=O\left(h\left(\log\frac{n}{h}+1\right)\right).
Proof.

As in Lemma 12 we describe a method for encoding a surrounding cycle using this many bits of information, so that each cycle is uniquely described by this encoding. Let HH be the set of convex hull vertices of SS, let I=SHI=S\setminus H be the set of interior points, and let CC be the surrounding cycle that we are trying to describe. To describe CC, we combine the following pieces of information:

  • The set QQ of points of HH that belong to CC, but for which zero or one of their neighbors in the hull belong to CC. There can be at most 2h2h such points (two neighbors of each point in II). QQ can be encoded by specifying its size and the subset of HH of that size, out of (nh|Q|)\tbinom{n-h}{|Q|} possibilities, so by Lemma 11 the number of bits needed to specify it is O(h+hlog(n/h))O\bigl{(}h+h\log(n/h)\bigr{)}. (The case where |Q||Q| is too large for Lemma 11 to apply is trivial as this would make the bound we are proving superlinear.)

  • For each point in QQ, a specification of whether it has a neighbor in HH, and if so in which direction. This takes O(h)O(h) bits of information. (This information is redundant when the point in QQ is adjacent in HH to a point of HQH\setminus Q, as all such pairs must be neighbors, but is needed when QQ contains multiple consecutive points of HH.)

  • The induced subgraph C[IQ]C[I\cup Q], a cycle or linear forest using only the points in IQI\cup Q. As with any type of planar straight-line graph, the number of linear forests on O(h)O(h) points is singly exponential in hh [30], so C[IQ]C[I\cup Q] can be encoded with O(h)O(h) bits of information.

Then CC may be recovered by combining the induced subgraph P[IQ]P[I\cup Q] with convex hull subsequences starting and ending at points of QQ and continuing in the specified direction from each of these points. All pieces of this encoding add up to the stated bound on the number of bits needed to encode the entire path. ∎

Corollary 24.

Let SS be a set of nn points with min(offline(S),inhull(S))=m\min(\textsc{offline}(S),\textsc{inhull}(S))=m. Then

log#surround(S)=O(m(lognm+1)).\log\textsc{\#surround}(S)=O\left(m\left(\log\frac{n}{m}+1\right)\right).
Proof.

When m=inhull(S)m=\textsc{inhull}(S) this is Lemma 23. When m=offline(S)m=\textsc{offline}(S) this follows immediately from Lemma 12, as each surrounding cycle can be made into a path by removing an edge, and no two such paths can come from the same cycle. ∎

4.2 Visible-vertex paths revisited

Lemma 16 proved the existence of a non-crossing Hamiltonian path connecting two vertices of a convex hull, using a construction based on visible-vertex paths. For our lower bound on polygonalizations, we will need many such paths. As a warm-up, we provide a version of the bound that we need that applies to point sets in general position.

Refer to caption
Figure 4: Illustration for the proof of Lemma 25: The green vertex-visible path is labeled by the sequence σ=10011100101001101100\sigma=10011100101001101100 for the points shown, split by the vertical line through pp (the bottom green point) into AA (the red points left of the line) and BB (the blue points right of the line). One of the convex hulls of the remaining points partway through the sequence is shown; the path reaches this hull at one endpoint of its unique edge with endpoints in both AA and BB.
Lemma 25.

Let SS be a set of nn points in general position, and let pp be any vertex of the convex hull of SS. Then there are at least (n1(n1)/2)\tbinom{n-1}{\lfloor(n-1)/2\rfloor} distinct vertex-visible paths that start at other vertices of the convex hull of SS and end at pp.

Proof.

We assume n3n\geq 3 else the lemma is trivial. Draw a line LL through pp that does not pass through any other point of SS, splitting S{p}S\setminus\{p\} into two subsets AA and BB in its two half-planes, with |A|=(n1)/2|A|=\lfloor(n-1)/2\rfloor and |B|=(n1)/2|B|=\lceil(n-1)/2\rceil. For each of the possible (n1(n1)/2)\tbinom{n-1}{\lfloor(n-1)/2\rfloor} binary sequences σ\sigma having |A||A| 0-bits and |B||B| 1-bits, we will find a vertex-visible path PσP_{\sigma} that has a point of AA for each 0 in σ\sigma and a point of BB for each 1 in σ\sigma, ending in pp.

To do so, we will construct this sequence one point at a time. As long as the remaining unchosen points include at least one point of AA and at least one point of BB, the line LL will continue to separate points in AA from points in BB. The convex hull of the remaining points must have a “bridge” edge ee with one point in each set; ee is crossed by LL. Throughout the process we will maintain the following property as an invariant: the sequence constructed so far, both endpoints of this bridge edge ee are valid additions to a vertex-visible path (although only one of the two will match sequence σ\sigma). This invariant is automatically true at the start of the path construction process, when the path constructed so far is empty, because any convex hull vertex is a valid addition to an empty vertex-visible path.

At each subsequent step, let ee be the bridge edge. By the invariant, both endpoints of ee are valid additions to the path. We choose the endpoint that belongs to the set determined by the corresponding bit of σ\sigma, AA for a 0-bit or BB for a 1-bit. By the general position assumption, this chosen endpoint can see the other endpoint of ee, in the other set. If it is not the last point in the set (AA or BB) that contains it, it can also see at least one vertex of the convex hull of the remaining points that lies in its own set. Since the convex hull vertices that it sees must form a contiguous subsequence of the convex hull, it can see both endpoints of the new bridge edge crossed by LL, separating AA from BB, and the invariant is maintained.

Once all vertices in AA or in BB have been included in the vertex-visible path, we can complete the path in the same way as Lemma 16. Because all paths constructed in this way can be distinguished from each other by the order in which they use vertices from AA and from BB, they are all distinct from each other. ∎

Fig. 4 illustrates this construction. The full bound that we need uses similar ideas, but must handle point sets that are not in general position. In particular we must handle the case that, after partially constructing a path as in the proof of Lemma 25, we reach a situation in which the edge of the remaining convex hull, crossed by LL, contains many points, so that its two endpoints are not visible to each other and cannot be made visible by removing only a small number of points. To handle this case, we will apply Lemma 18 (which finds many paths through a point set with many collinear points) to the collinear points on this convex hull edge.

Lemma 26.

Let SS be a set of points such that at most |S|/6|S|/6 points lie on any line. Let pp be any vertex of the convex hull of SS. Then the number of non-crossing Hamiltonian paths through SS, starting at another convex hull vertex and ending at pp, is at least singly exponential in |S||S|.

Proof.

The process in Lemma 25 can be reinterpreted as non-deterministically choosing either a point from AA or a point from BB at each step, until running out of points in one of the two sets and then completing the path deterministically. This produces a binary tree of possible choices, and the the proof of Lemma 25 can be interpreted as counting the branches of this tree. A simpler analysis, less tight but still exponential, would observe that in this tree, each choice uses up one point of either AA or BB, and the number of points in both steps starts at approximately n/2n/2. Therefore, the height (minimum number of steps from the root of the decision tree in any branch until running out of choices) is approximately |S|/2|S|/2, and the number of branches is at least 2|S|/22^{|S|/2}. We will generalize this process to allow non-binary choices, using a weighted definition of the height of the decision tree where the weight of each step is the binary logarithm of the number of available choices at that step. If we can show that each step that uses up some number xx of points gives us a number of choices that is exponential in xx, then the weight of that step will be proportional to xx and the total height of the decision tree will be again linear in |S||S|, implying that again it has an exponential number of branches. With these generalities out of the way, it remains to show how to generalize the non-deterministic decision process of Lemma 25 so that, whenever we use up many points, we select from a number of choices that is exponential in the number of used-up points.

Refer to caption
Figure 5: The case of Lemma 26 when there are many points on edge ee.

We define the line LL and the subsets of points AA and BB, initially of size approximately |S|/2|S|/2, in exactly the same way as in the proof of Lemma 25. We will build a non-crossing path to pp, covering all points in SS, in a sequence of steps. It will not necessarily be a visible-vertex path, but we will maintain after each step the same invariants as in Lemma 25. Namely, the path constructed so far will remain disjoint from the convex hull of the remaining points (so that any non-crossing path within those remaining points will be non-crossing globally), and as long as AA and BB are both non-empty, the unique AABB edge ee of the convex hull of the remaining points will be entirely visible from the last point that has already been added to the path, so that any point on ee may be added as the next point on the path. We distinguish the following cases:

  • If there are fewer than |S|/3|S|/3 points remaining in AA or BB, stop making choices and complete the rest of the path deterministically.

  • If AeA\cap e and BeB\cap e are both small (at most three points), we extend the current path by a segment to one of the two endpoints of ee, and then (if its visibility along ee is blocked by another point in the same set) by more segments to one or both blocking points. This case produces two choices (which endpoint of ee to extend to) and uses up at most three points of AA or BB. It maintains the invariant by the same reasoning as in Lemma 25.

  • Otherwise, at least one of AeA\cap e or BeB\cap e is large (at least four points). We describe the case when AeA\cap e is large; the case for BeB\cap e large is symmetric. Let x=|Ae|x=|A\cap e|, the number of points of AA on edge ee of the convex hull. Let rr be the point where LL crosses ee. Draw a ray RR from rr that separates the remaining points not yet on the path into two subsets XX and YY with (Ae)X(A\cap e)\subset X and |X|=2x|X|=2x, breaking ties in such a way that the convex hulls of XX and YY stay disjoint. Because x|S|/6x\leq|S|/6 points lie on a line and at least |S|/3|S|/3 remaining points lie in AA, XAX\subset A, and ray RR lies entirely on AA’s side of line LL. In Fig. 5, ee, rr, and RR are labeled; x=7x=7, and XX is the subset of 14 points whose convex hull is shown as the red shaded area. The blue shaded area is the convex hull of YY.

    Among the vertices of the convex hull of XX, at least one (the point in AeA\cap e closest to rr) can see a point in BYB\cap Y, the nearest one on edge ee, along a segment exterior to the hull. Also, at least one of the vertices of the convex hull of XX on RR can see any remaining points in AYA\cap Y, along a segment exterior to the hull. Therefore, some vertex qq of the convex hull of XX, on or between these two hull vertices, can see all of the unique AABB edge of the convex hull of YY. For instance, qq may be chosen by triangulating the region between the convex hulls of XX and YY, and choosing the apex of the triangle on this edge. Fig. 5 depicts a case where qq can neither be on ee nor RR.

    We will extend the current path, from its current endpoint, to one of the two endpoints of XeX\cap e (in the figure, the endpoint farthest from rr), through all points of XX, ending at qq. Because ee separates YY from the first of these added segments, the remaining added segments lie within the convex hull of XX, and RR separates the convex hulls of XX and YY, it follows that this extension maintains the invariant that the path so far is disjoint from the convex hull of the remaining point set YY. Because qq was chosen as a point that could see the AABB edge of the convex hull of YY, it follows that this extension also maintains the invariant that any point along this edge could be added to the path next.

    By Lemma 18, the number of paths through XX that start and end at the two extreme points of XeX\cap e is exponential in xx. However, instead we need paths that start at one extreme point of XeX\cap e and end at qq. To obtain an exponential bound on the number of paths of this type, we use the same method as in the proof of Lemma 18: we consider 010010-avoiding sequences of length 2x2x, in which each 0 describes a point on the path that belongs to XeX\cap e and each 11 describes a point on the path that belongs to XeX\setminus e. Each such sequence can then be realized as a path by the method used in Lemma 18, which creates a convex subset of XeX\setminus e corresponding to each block of consecutive 1-bits of the sequence. In order to obtain a path that starts at an extreme point of XeX\cap e and that ends at qq, it is necessary and sufficient that the corresponding 010010-avoiding sequence have a 0 at one of its ends (representing the starting extreme point) and a large enough consecutive block of 1’s at the other end for qq to be included in that block. Here “large enough” depends on the arrangement of XX, but each point of XeX\setminus e contributes to this required block size only when it is more extreme than qq in the radial ordering of points around one extreme point of XeX\cap e, and when this happens it cannot also contribute to the required block size for the other extreme point. Therefore, for one of the extreme points of XeX\cap e, at least x/2x/2 of the 11-bits are free to be anywhere in the 010010-avoiding sequence, rather than forced to be in the contiguous block of 11s at the end of the sequence. This is enough to produce an exponential number of 010010-avoiding sequences and an exponential number of path extensions ending at qq.

Each step produces a number of choices exponential in the number of points that it uses up, until we have used up at least |S|/6|S|/6 points and switch to the deterministic completion. Therefore, the total number of branches of the decision tree, and the total number of paths that it can produce is exponential in |S||S|. ∎

4.3 Lower bound for far-from-convex sets

As we now show, for point sets that have many points interior to their convex hull, and few points collinear, the number of polygonalizations must be large.

Lemma 27.

Let SS be a set of nn points for which at most |S|/7|S|/7 points lie on any line, and at most |S|/7|S|/7 points lie on the convex hull. Then the number of polygonalizations of SS is at least singly exponential in SS.

Proof.

At least 6|S|/76|S|/7 points of SS are interior to the convex hull, within which the number of collinear points meets the conditions of Lemma 25. By Lemma 25, there are exponentially many distinct non-crossing Hamiltonian paths through the subset of interior points, starting and ending at a vertex of the convex hull of the interior points. It remains to argue that each such path PP has a polygonalization CPC_{P} that uses the points of PP in path order. Because each two polygonalizations constructed in this way have a different ordering on the interior points of SS, they will be distinct polygonalizations.

Refer to caption
Figure 6: Steinhaus completion of a polygonalization: For every polygon (blue) that does not use a given convex hull vertex qq (red), some polygon edge will be completely visible to qq, and the polygon can be modified to include qq by replacing that edge by a pair of edges through qq [32].

Therefore, let PP be any non-crossing Hamiltonian path through the subset of interior points, starting and ending at a vertex of the convex hull of the interior points. Triangulate the region between the convex hull of the interior points and the convex hull of SS, and extend each end of PP by an edge from the triangulation; these edges must connect to convex hull vertices of SS, and cannot cross each other. If they do not meet, complete the extended path to a polygon by following edges around the convex hull of SS from one endpoint of the extended path to the other. Let QQ be the resulting simple polygon. In most cases, QQ will not be a surrounding polygon of SS, but the only points missing from QQ will be some of the convex hull vertices of SS.

We now apply an argument of Steinhaus [32] to show that QQ can be completed to a polygonalization CPC_{P}, preserving the cyclic ordering of the points already in QQ. Consider each point qq of the convex hull of SS that is not already in QQ, in an arbitrary order. Because qq is on the convex hull, it cannot be surrounded by a cycle of edges, each partially obscuring the next in the cycle: the visibility ordering of edges of QQ, as viewed from qq, is acyclic. Therefore, at least one edge of QQ is completely visible to qq. Replace this edge by a pair of edges through qq (gluing a triangle formed by this edge and qq onto the polygon; see Fig. 6). After gluing in all remaining convex hull vertices in this way, the result is a polygonalization of SS. ∎

4.4 Lower bound for near-convex sets

For point sets that have few points interior to their convex hull, we have a lower bound on the number of polygonalizations analogous to the bound of Lemma 18 for Hamiltonian paths on near-collinear sets. The main idea of the proof is the same: partition the interior points into a sequence of convex regions, associated with non-adjacent edges of the hull (in place of edges along a line), and show that each such partition can be represented by a polygonalization. However, compared to Lemma 18 some additional care is needed to ensure that the convex region associated with one hull edge does not block visibility to other hull edges and their regions. We do this by splitting the input by a line, with the convex regions on one side of the line and the hull edges they are associated to on the other side. In this way, the visibilities between hull edges and convex regions cannot be blocked. This part of our lower bound does not require a general position assumption.

Lemma 28.

Let SS be a set of points with |S|=n|S|=n, such that hh points of SS lie on its convex hull (either as vertices or within its edges). Then

#ham(S)(h/4+(nh)/21(nh)/2)\textsc{\#ham}(S)\geq\binom{\lfloor h/4\rfloor+\lceil(n-h)/2\rceil-1}{\lceil(n-h)/2\rceil}
Proof.

The points on the convex hull of SS partition it into hh segments. Consider any diagonal edge ee that partitions these segments into two subsequences of equal or nearly equal length; choose arbitrarily one of the two endpoints of ee to be first and the other to be second. At least one of the two sides of ee will contain at least (nh)/2\lceil(n-h)/2\rceil points that are not on the hull (shown on the right side of ee in Fig. 7); let II denote this set of points. On the other side of ee, we can find h/4\lfloor h/4\rfloor disjoint segments of the hull; let D=d1,d2,D=d_{1},d_{2},\dots denote this sequence of segments, in order from the first endpoint of ee to the second endpoint of ee (shown in red on the left side of Fig. 7).

Refer to caption
Figure 7: Partition of the convex hull of SS into convex regions CiC_{i} associated with segments did_{i}, for the proof of Lemma 28

We will partition the interior of the convex hull of SS into convex regions CiC_{i}, associated with and including each segment did_{i} (the four colored regions in Fig. 7, with interior points colored by which region they belong to). Given such a partition, we can find a polygonalization that modifies the convex hull (a surrounding polygon) by replacing each segment did_{i} by a Hamiltonian path through the non-hull points in CiC_{i}, according to Lemma 16. Let ni=|ICi|n_{i}=|I\cap C_{i}|; then the polygon constructed in this way has nin_{i} points of II between the endpoints of did_{i}, allowing it to be distinguished from any polygon coming from a partition with different values of nin_{i}. The numbers nin_{i} are non-negative and sum to |I||I|, and the number of ways of choosing non-negative numbers nin_{i} that sum to |I||I| is at least equal to the binomial coefficient in the lemma (possibly larger if DD or II are larger than their minimum sizes). It remains to prove that each such choice can be represented by a convex partition, and therefore also by a polygonalization.

As in Lemma 18 we construct these convex sets CiC_{i} by a greedy process in sequence order. At each step, we maintain the invariant that the remaining points not assigned to a convex set lie within a convex set Ki1K_{i-1} formed by the intersection of the convex hull of the input and a half-plane, and that Ki1K_{i-1} includes at least one point of ee. The convex sets KiK_{i} are not shown in the figure, but can be reconstructed as the union of the sets CjC_{j} for j>ij>i. As a base case, let K0K_{0} be the convex hull of all of the given points. To construct CiC_{i}, we consider the following cases.

  • If did_{i} is the last segment in sequence DD, let Ci=Ki1C_{i}=K_{i-1}. In the figure, C4C_{4} is constructed by this case.

  • If did_{i} is not the last segment, but all segments djd_{j} for j>ij>i have nj=0n_{j}=0, let pip_{i} be the second endpoint of did_{i}. Draw line LiL_{i} through pip_{i} and the second endpoint of ee, and cut Ki1K_{i-1} along LiL_{i} into two convex subsets. Let CiC_{i} be the subset containing did_{i} and let KiK_{i} be the other subset. Assign to CiC_{i} any points on line LiL_{i}.

  • If ni=0n_{i}=0, draw LiL_{i} from the same point pip_{i} to the point on eKi1e\cap K_{i-1} closest to the first endpoint of ee. As in the previous case, and cut Ki1K_{i-1} along LiL_{i} into CiC_{i} and KiK_{i}, assigning points on LiL_{i} to CiC_{i}. In the figure, C3C_{3} is constructed by this case.

  • In the remaining case, number the points in IKi1I\cap K_{i-1} in radial order around qq, breaking ties in favor of closer points to qq, and draw line LiL_{i} through qq and the point in position nin_{i} in this numbered sequence. Cut Ci1C_{i-1} along LiL_{i} into two convex subsets CiC_{i} and KiK_{i}, where CiC_{i} contains did_{i} and KiK_{i}. For points that lie on LiL_{i}, assign the one numbered nin_{i} and any closer points to CiC_{i}, and assign any farther points to KiK_{i}. For instance, in the figure, line L1L_{1} contains two interior points; the closer yellow point is the one labeled n1=3n_{1}=3, and is assigned to C1C_{1}, while the farther blue point is assigned to K1K_{1} and later to C2C_{2}.

In this way, the construction assigns exactly nin_{i} points of II to the convex region CiC_{i}. These regions partition the convex hull of SS, in such a way that all interior points of the hull (regardless of whether they belong to II) belong to exactly one of these regions. Each assignment can be used to construct a distinct polygonalization, and the number of assignments is at least the value given in the lemma. ∎

4.5 Putting the bounds together

Combining our lower bounds into a single formula, we have:

Lemma 29.

Let SS be a set of nn points with min(offline(S),inhull(S))=m\min(\textsc{offline}(S),\textsc{inhull}(S))=m. Then

log#poly(S)=Ω(m(lognm+1)).\log\textsc{\#poly}(S)=\Omega\left(m\left(\log\frac{n}{m}+1\right)\right).
Proof.

We consider the following cases:

  • If inhull(S)6n/7\textsc{inhull}(S)\leq 6n/7, the result follows from Lemma 28. In particular this applies when the largest subset of collinear points in SS has size n/7\geq n/7 and is part of the convex hull.

  • If the largest subset of collinear points in SS has size n/7\geq n/7 but is not part of the convex hull, then let LL be the line through this subset. Because LL does not lie on the convex hull, SLS\setminus L includes points on both sides of LL, with at least m/2m/2 points in one of these two halfplanes. By Lemma 18 the number of Hamiltonian paths through the points in LL and the points in this halfplane, starting and ending at the two extreme points of LL, meets or exceeds the lower bound in the statement of this lemma. Each of these Hamiltonian paths can be completed to a polygonalization through the points in the other halfplane bounded by LL, by Lemma 16.

  • In the remaining case, the largest subset of collinear points in SS has size <n/7<n/7 and inhull(S)6n/7\textsc{inhull}(S)\geq 6n/7. In this case, m=Ω(n)m=\Omega(n) and the bound of the lemma reduces to Ω(n)\Omega(n). The result follows from Lemma 27.

Since all cases have at least the number of polygonalizations stated, the bound holds.

For a bound of Ω(i)\Omega(i), apply Lemma 27, and for Ω(ilogn/i)\Omega(i\log n/i) when in/2i\leq n/2, apply Lemma 28, in both cases using Lemma 11 to estimate the logarithm of the binomial coefficient. ∎

From the fact that the upper bound of Corollary 24 and the lower bound of Lemma 29 have exactly the same form, we obtain a constant factor approximation to the logarithm of the number of surrounding cycles and of polygonalizations. For our bound on the complexity of the algorithm for listing polygonalizations we need it in the following form:

Theorem 30.

For a given point set SS,

#surround(S)=#poly(S)O(1).\textsc{\#surround}(S)=\textsc{\#poly}(S)^{O(1)}.

5 Nonlinearity

In this section we investigate the exponent of the polynomial bounds on non-crossing paths as a function of non-crossing Hamiltonian paths, and on surrounding cycles as a function of polygonalizations. In both cases we show that the exponent is bounded away from one, for inputs in which the number of non-crossing configurations is exponential. This implies, in particular, that the backtracking algorithms that we investigate for Hamiltonian paths and polygonalizations can in some instances be forced to take an amount of time per output that is exponential in the input size, despite being polynomial in the output size.

The construction for paths and Hamiltonian paths is very simple:

Theorem 31.

There exist sets SS of points for which

#path(S)#ham(S)log23o(1)#ham(S)1.585\textsc{\#path}(S)\geq\textsc{\#ham}(S)^{\log_{2}3-o(1)}\approx\textsc{\#ham}(S)^{1.585}

and moreover for which both the number of non-crossing paths and the number of non-crossing Hamiltonian paths is exponential in |S||S|.

Proof.

We may take SS to be in convex position. If a set SS in convex position has nn points, it has n2n3n2^{n-3} non-crossing Hamiltonian paths [27], but

n4(3n1+3)\frac{n}{4}(3^{n-1}+3)

non-crossing paths in total, considering a single vertex to count as a path of length zero.

Refer to caption
Refer to caption
Figure 8: Coloring-based arguments for the number of non-crossing paths and Hamiltonian paths of a point set in convex position. Each 2-coloring of the points and choice of starting point determines a non-crossing Hamiltonian path in which the colors determine the direction of the next step; each 3-coloring and choice of starting point determines a path, skipping vertices of one of the colors.

Both bounds can be proven by a simple coloring argument (Fig. 8). For non-crossing Hamiltonian paths, consider the 2n2^{n} ways of coloring the points red and blue, and nn choices of where to start. For each choice, follow a path that, at each red point, steps clockwise to the next available vertex, and at each blue point steps counterclockwise. Each non-crossing Hamiltonian path is found for exactly eight choices: the path can start at either end, and the final two vertex colors are irrelevant. Thus, the number of paths is n2n/8n2^{n}/8.

For the bound on non-crossing paths, consider instead the 3n3^{n} ways of coloring the points red, blue, and yellow, and skip the yellow points both in choosing a starting point and in considering which vertices are available in subsequent steps of the path. Cyclically permuting the colors in a coloring groups the 3n3^{n} colorings into 3n13^{n-1} orbits, each of which has a total of 2n2n red or blue starting points, so there are 2n3n12n\cdot 3^{n-1} choices. Again, each path is found for exactly eight choices, except for the single-vertex paths, which are found for only two choices. The total number of paths is obtained by dividing 2n3n12n\cdot 3^{n-1} by eight, and adjusting for the number of single-vertex paths. ∎

For an analogous separation between surrounding polygons and polygonalizations, we replace one edge of a triangle by a convex chain of n2n-2 edges, within the triangle (Fig. 9). The polygonalizations of this point set are obtained from non-crossing Hamiltonian paths through the points of the convex chain, with both ends of the path connected to the one point that does not belong to the convex chain (which we call the apex). The edges to the apex cannot cross any other edge, so all Hamiltonian paths lead to polygonalizations in this way. Therefore, by the same formula already used above, the number of polygonalizations is exactly (n1)2n4(n-1)2^{n-4}.

A surrounding polygon for these points must have the apex as a vertex (because it lies on the convex hull). It must also include as vertices all of the points of the convex chain that lie outside the two neighbors of the apex. The points of the convex chain that lie between the two neighbors of the apex may either be vertices of the surrounding polygon, or omitted; if omitted, they will automatically be surrounded. We may parameterize a surrounding polygon by three non-negative numbers: aa, the number of outer points of the convex chain that lie outside the two neighbors of the apex, bb, the number of inner points that lie between these two neighbors and are vertices of the polygon, and cc, the number of omitted points that are not vertices of the surrounding polygon. Necessarily, a+b+c=n3a+b+c=n-3, because the points that are counted by these three numbers include all points except the apex and its two neighbors.

Refer to caption
Figure 9: Points formed by replacing an edge of a triangle by a convex chain of points within the triangle, and a surrounding polygon (yellow) for these points. Points can be omitted as polygon vertices (red) only when they lie between the two neighbors of the apex (the rightmost point of the figure).

Once aa, bb, and cc have been chosen, the surrounding polygon itself may be determined by three more choices: how to partition the outer aa points into left and right subsets, with a+1a+1 possibilities, how to alternate between outer and inner points along the polygon, with (a+ba)\tbinom{a+b}{a} possibilities, and how to partition the points between the two neighbors of the apex into inner points and omitted points, with (b+cb)\tbinom{b+c}{b} possibilities. Therefore, the total number of surrounding polygons of this point set is

a+b+c=n3(a+1)(a+ba)(b+cb).\sum_{a+b+c=n-3}(a+1)\binom{a+b}{a}\binom{b+c}{b}.

These numbers, for n=3,4,5,n=3,4,5,\dots, are

1,4,13,40,120,354,1031,2972,8495,24110,,1,4,13,40,120,354,1031,2972,8495,24110,\dots,

a sequence having the generating function (12x)/(13x+x2)2(1-2x)/(1-3x+x^{2})^{2} and growing proportionally to n(φ+1)nn(\varphi+1)^{n}, where φ=(1+5)/2\varphi=(1+\sqrt{5})/2 is the golden ratio [26]. This example proves:

Theorem 32.

There exist sets SS of points for which

#surround(S)#poly(S)log2(φ+1)o(1)#poly(S)1.388\textsc{\#surround}(S)\geq\textsc{\#poly}(S)^{\log_{2}(\varphi+1)-o(1)}\approx\textsc{\#poly}(S)^{1.388}

and moreover for which both the number of surrounding polygons and the number of polygonalizations is exponential in |S||S|.

6 Conclusions

We have developed simple output-sensitive algorithms for listing all non-crossing Hamiltonian paths and all polygonalizations for a point set. However, their dependence on the output size is polynomial, not linear. It would be of interest to find alternative algorithms with a better dependence on the output size, as well as more accurate approximations for the numbers of non-crossing structures.

References

  • [1] Oswin Aichholzer, Franz Aurenhammer, Clemens Huemer, and Birgit Vogtenhuber. Gray code enumeration of plane straight-line graphs. Graphs Combin., 23(5):467–479, 2007. doi:10.1007/s00373-007-0750-z.
  • [2] Miklós Ajtai, Vašek Chvátal, Monroe M. Newborn, and Endre Szemerédi. Crossing-free subgraphs. In Alexander Rosa, Gert Sabidussi, and Jean Turgeon, editors, Theory and Practice of Combinatorics: A collection of articles honoring Anton Kotzig on the occasion of his sixtieth birthday, volume 12 of Annals of Discrete Mathematics, pages 9–12. North-Holland, 1982. doi:10.1016/S0304-0208(08)73484-4.
  • [3] Noga Alon, Sridhar Rajagopalan, and Subhash Suri. Long non-crossing configurations in the plane. Fund. Inform., 22(4):385–394, 1995. doi:10.3233/FI-1995-2245.
  • [4] Victor Alvarez, Karl Bringmann, Radu Curticapean, and Saurabh Ray. Counting triangulations and other crossing-free structures via onion layers. Discrete Comput. Geom., 53(4):675–690, 2015. doi:10.1007/s00454-015-9672-3.
  • [5] David Avis and Komei Fukuda. Reverse search for enumeration. Discrete Appl. Math., 65(1-3):21–46, 1996. doi:10.1016/0166-218X(95)00026-N.
  • [6] Sayan Bandyapadhyay, Aritra Banik, Sujoy Bhore, and Martin Nöllenburg. Geometric planar networks on bichromatic collinear points. Theoret. Comput. Sci., 895:124–136, 2021. doi:10.1016/j.tcs.2021.09.035.
  • [7] Sergei Bespamyatnikh. An efficient algorithm for enumeration of triangulations. Comput. Geom. Theory & Appl., 23(3):271–279, 2002. doi:10.1016/S0925-7721(02)00111-6.
  • [8] Gi-Sang Cheon, Hong Joon Choi, Guillermo Esteban, and Minho Song. Enumeration of bipartite non-crossing geometric graphs. Discrete Appl. Math., 317:86–100, 2022. doi:10.1016/j.dam.2022.04.008.
  • [9] Mirela Damian, Robin Flatland, Joseph O’Rourke, and Suneeta Ramaswami. Connecting polygonizations via stretches and twangs. Theory Comput. Syst., 47(3):674–695, 2010. doi:10.1007/s00224-009-9192-8.
  • [10] Erik D. Demaine, Sándor P. Fekete, Phillip Keldenich, Dominik Krupke, and Joseph S. B. Mitchell. Area-optimal simple polygonalizations: the CG challenge 2019. ACM J. Exp. Algorithmics, 27:Article 2.4, 2022. doi:10.1145/3504000.
  • [11] Adrian Dumitrescu and Csaba D. Tóth. Long non-crossing configurations in the plane. Discrete Comput. Geom., 44(4):727–752, 2010. doi:10.1007/s00454-010-9277-9.
  • [12] David Eppstein. Forbidden Configurations in Discrete Geometry. Cambridge University Press, 2018. doi:10.1017/9781108539180.
  • [13] David Eppstein. Counting polygon triangulations is hard. Discrete Comput. Geom., 64(4):1210–1234, 2020. doi:10.1007/s00454-020-00251-7.
  • [14] Sándor P. Fekete. On simple polygonalizations with optimal area. Discrete Comput. Geom., 23(1):73–110, 2000. doi:10.1007/PL00009492.
  • [15] Philippe Flajolet and Marc Noy. Analytic combinatorics of non-crossing configurations. Discrete Math., 204(1-3):203–229, 1999. doi:10.1016/S0012-365X(98)00372-0.
  • [16] Alfredo García, Marc Noy, and Javier Tejel. Lower bounds on the number of crossing-free subgraphs of KNK_{N}. Comput. Geom. Theory & Appl., 16(4):211–221, 2000. doi:10.1016/S0925-7721(00)00010-9.
  • [17] H. Guggenheimer. The Jordan curve theorem and an unpublished manuscript by Max Dehn. Archive for History of Exact Sciences, 17(2):193–200, 1977. doi:10.1007/BF02464980.
  • [18] Carmen Hernando, Michael E. Houle, and Ferran Hurtado. On local transformation of polygons with visibility properties. Theoret. Comput. Sci., 289(2):919–937, 2002. doi:10.1016/S0304-3975(01)00409-1.
  • [19] Michael Hoffmann, André Schulz, Micha Sharir, Adam Sheffer, Csaba D. Tóth, and Emo Welzl. Counting plane graphs: flippability and its applications. In János Pach, editor, Thirty Essays on Geometric Graph Theory, pages 303–325. Springer, 2013. doi:10.1007/978-1-4614-0110-0_16.
  • [20] Naoki Katoh and Shin-Ichi Tanigawa. Fast enumeration algorithms for non-crossing geometric graphs. Discrete Comput. Geom., 42(3):443–468, 2009. doi:10.1007/s00454-009-9164-4.
  • [21] D. T. Lee. Visibility of a simple polygon. CVGIP, 22(2):207–221, 1983. doi:10.1016/0734-189x(83)90065-8.
  • [22] Dániel Marx and Tillmann Miltzow. Peeling and nibbling the cactus: subexponential-time algorithms for counting triangulations and related problems. In Sándor P. Fekete and Anna Lubiw, editors, 32nd International Symposium on Computational Geometry, SoCG 2016, June 14-18, 2016, Boston, MA, USA, volume 51 of LIPIcs, pages 52:1–52:16. Schloss Dagstuhl – Leibniz-Zentrum für Informatik, 2016. doi:10.4230/LIPIcs.SoCG.2016.52.
  • [23] G. H. Meisters. Polygons have ears. Amer. Math. Monthly, 82(6):648–651, 1975. doi:10.2307/2319703.
  • [24] Joseph S. B. Mitchell and Joseph O’Rourke. Computational geometry column 42. Internat. J. Comput. Geom. Appl., 11(5):573–582, 2001. doi:10.1142/S0218195901000651.
  • [25] OEIS contributors. Sequence A180562. The On-Line Encyclopedia of Integer Sequences, March 26 2014. URL: https://oeis.org/A180562.
  • [26] OEIS contributors. Sequence A238846. The On-Line Encyclopedia of Integer Sequences, November 24 2021. URL: https://oeis.org/A238846.
  • [27] OEIS contributors. Sequence A001792. The On-Line Encyclopedia of Integer Sequences, April 13 2022. URL: https://oeis.org/A001792.
  • [28] Louis V. Quintas and Fred Supnick. On some properties of shortest Hamiltonian circuits. Amer. Math. Monthly, 72(9):977–980, 1965. doi:10.2307/2313333.
  • [29] Andreas Razen and Emo Welzl. Counting plane graphs with exponential speed-up. In Cristian S. Calude, Grzegorz Rozenberg, and Arto Salomaa, editors, Rainbow of Computer Science: Dedicated to Hermann Maurer on the Occasion of His 70th Birthday, volume 6570 of Lecture Notes in Computer Science, pages 36–46. Springer, 2011. doi:10.1007/978-3-642-19391-0_3.
  • [30] Micha Sharir and Adam Sheffer. Counting plane graphs: cross-graph charging schemes. Combin. Probab. Comput., 22(6):935–954, 2013. doi:10.1017/S096354831300031X.
  • [31] Micha Sharir, Adam Sheffer, and Emo Welzl. Counting plane graphs: perfect matchings, spanning cycles, and Kasteleyn’s technique. J. Combin. Theory Ser. A, 120(4):777–794, 2013. doi:10.1016/j.jcta.2013.01.002.
  • [32] Hugo Steinhaus. One Hundred Problems in Elementary Mathematics. Basic Books, 1964. See pp. 17, 85–86.
  • [33] Shin-Ichi Tanigawa. Enumeration of non-crossing geometric graphs. In Encyclopedia of Algorithms, pages 638–640. Springer, 2016. doi:10.1007/978-1-4939-2864-4_729.
  • [34] Emo Welzl. Counting simple polygonizations of planar point sets. In Proceedings of the 23rd Annual Canadian Conference on Computational Geometry, Toronto, Ontario, Canada, August 10-12, 2011, 2011. URL: https://www.cccg.ca/proceedings/2011/papers/invited3.pdf.
  • [35] Manuel Wettstein. Counting and enumerating crossing-free geometric graphs. J. Comput. Geom., 8(1):47–77, 2017. doi:10.20382/jocg.v8i1a4.
  • [36] Ro-Yu Wu, Jou-Ming Chang, Kung-Jui Pai, and Yue-Li Wang. Amortized efficiency of generating planar paths in convex position. Theoret. Comput. Sci., 412(35):4504–4512, 2011. doi:10.1016/j.tcs.2011.04.017.
  • [37] Katsuhisa Yamanaka, David Avis, Takashi Horiyama, Yoshio Okamoto, Ryuhei Uehara, and Tanami Yamauchi. Algorithmic enumeration of surrounding polygons. Discrete Appl. Math., 303:305–313, 2021. doi:10.1016/j.dam.2020.03.034.