Journal of Graph Algorithms and Applications Computational Search of Small Point Sets with Small Rectilinear Crossing Number 394 Fabila-monroy & López Small Point Sets with Small Rectilinear Crossing Number

Let cr(Kn) be the minimum number of crossings over all rectilinear drawings of the complete graph on n vertices in the plane. In this paper we prove that cr(Kn) < 0.380473 n 4 + Θ(n 3); improving thus on the previous best known upper bound. This is done by obtaining new rectilinear drawings of Kn for small values of n, and then using known constructions to obtain arbitrarily large good drawings from smaller ones. The " small " sets were found using a simple heuristic detailed in this paper.


Introduction
A rectilinear drawing of a graph is a drawing of the graph in the plane in which all the edges are drawn as straight line segments. For a set S of n points in general position in the plane, let cr(S) be the number of (interior) edge crossings in a rectilinear drawing of the complete graph K n with vertex set S. The rectilinear crossing number of K n , denoted by cr(K n ), is the minimum of cr(S) overall all sets of n points in general position in the plane. The problem of bounding the rectilinear crossing number of K n , is an important problem in Combinatorial Geometry. Most of the progress has been made in the last decade, for a state-of-the-art survey see [ÁFMS13]. Since two edges cross if and only if their endpoints span a convex quadrilateral, cr(S) is equal to the number (S), of convex quadrilaterals spanned by S. We use this equality extensively through out the paper. The current best bounds for cr(K n ) are [ÁFMLS08,ÁCFM + 10]: Our main result is the improvement of the upper bound to: Although it is a modest improvement, we note that the gap between the lower and upper bound is already quite small and that actually the lower bound is conjectured to be at least 0.380029 n 4 +Θ(n 3 ). In [ÁCFM + 10] the authors conjecture that every optimal set is 3-decomposable 1 , and show that every 3-decomposable set contains of S, such that the orthogonal projections of S onto the sides of T show A between B and C on one side, B between A and C on another side, and C between A and B on the third side. at least 0.380029 n 4 + Θ(n 3 ) crossings. The current general approach to produce rectilinear drawings of K n with few crossings, is to start with a drawing with few crossings (for a small value of n), and use it to recursively obtain drawings with few number of crossings for arbitrarily large values of n. This approach has been refined and improved over the years [Sin71, BDG03, AAK06,ÁFM07,ÁCFM + 10].
The upper bound provided by the best recursive construction to this date is expressed in Theorem 1.2. Given these recursive constructions, there is a natural interest in finding sets with few crossings for small values of n. The use of computers to aid this search was initiated in [AK07].

Results
For n ≤ 100, we improved many of best known point sets of n points with few crossings using the following simple heuristic.
Given a starting set S of n points in general position in the plane, do: • Step 1. Choose randomly a point p ∈ S.
• Step 2. Choose a random point q in the plane "close" to p.
Step 4. Go to Step 1. For each n = 3, . . . , 100, as a starting set we chose the best known point set; they can be downloaded from Oswin Aichholzer's homepage at: www.ist.tugraz.at/aichholzer/research/rp/triangulations/crossing/ In many instances we managed to improve the previous best examples. Our results are shown in Table 1. Theorem 1.1 now follows directly from Theorem 1.2 using the set of 75 points we found with 450492 crossings.

The Algorithm
In this section we describe an O(n 2 ) time algorithm used to compute cr(S) in step 3 of the heuristic. Recall that cr(S) is equal to (S). We compute this number instead. Quadratic time algorithms for computing (S) have been known for a long time [RWZ91,RWZ92]. We learned of these algorithms after we finished the implementation of our algorithm. We present our algorithm nevertheless, since in the process we obtained an equality(Theorem 3.1) between certain substructures of S and cr(S), which may be of independent interest. We also think that given that the main aim of this paper is to communicate the method by which we obtained these sets, it is important to provide as many details as possible so that an interested reader can obtain similar results.
Proof. Let X be a subset of S, of 4 points. Simple arithmetic shows that if X is not in convex position then it determines 3 patterns of type A and 9 patterns of type B; on the other hand if X is in convex position then it determines 4 patterns of type A and 8 patterns of type B. Assume that we assign a value of 3 to type A patterns and a value of −1 to type B patterns. If X is not in convex position its total contributed value would be zero and if it is convex position it would be 4. Thus 4 (S) = 3A(S) − B(S), and the result follows.
Note that the total number patterns is n(n − 1) n−2 2 . Thus by Theorem 3.1 to compute (S) it is sufficient to compute A(S). Let p be a point in S. We now show how to count the number of type A patterns in which p is the apex of the corresponding wedge.
Sort the points in S\{p} counterclockwise by angle around p. Let y 1 , y 2 , . . . , y n−1 be these points in such an order. For 1 ≤ i ≤ n − 1, starting from y i and going counterclockwise, let i ′ be the first index (modulo n) such that the angle ∠y i py i ′ is more than π. Let m i := i ′ − i mod (n − 1). Note that for 1 ≤ j ≤ m i there are exactly j − 1 type A patterns of the form (p, q), {y i , y i+j } for some q ∈ S. In total, summing over all such j's, this amounts to mi j=1 (j − 1) = mi 2 . Thus the total number of type A patterns in which p is the apex of the corresponding wedge is equal to n−1 i=1 mi 2 . Compute y 1 ′ and m 1 from scratch in linear time. For 2 ≤ i ≤ n − 1, to compute y (i+1) ′ and m i+1 , assume that we have computed y i ′ and m i . Start from y i ′ and go counterclockwise until the first y (i+1) ′ is found such that the angle ∠y i py (i+1) ′ is more than π; then m i+1 = (i + 1) − (i + 1) ′ . Since one pass is done over each y i ′ , this is done in O(n) total time. Finally, sorting S \ p by angle around p, for all p ∈ S, can be done in O(n 2 ) total time. This is done by dualizing S to a set of n lines. The corresponding line arrangement can be constructed in time O(n 2 ) with standard algorithms. The orderings around each point can then be extracted from the line arrangement in O(n 2 ) time.

Implementation
In this section we provide relevant information of the implementation of the algorithm described in Section 3 and of the searching heuristic we used to obtain the point sets of Table 1.
Instead of sorting in O(n 2 ) time the points by angle around each point of S, we used standard sorting functions. This was done because these functions have been quite optimized, and the known algorithms to do it in O(n 2 ) time are not straight forward to implement. Thus our implementation actually runs in O(n 2 log n) time.
All our point sets have integer coordinates. This was done to ensure the correctness of the computation. The only geometric primitive involved in the algorithm is to test whether certain angles are greater than π; this can be done with a determinant. Therefore as long as all the points have integer coordinates, the result is an integer as well. We did two implementations of our algorithm, one in Python and the other in C. In Python, integers have arbitrarily large precision, so the Python implementation is always correct. In the C implementation we used 128-bit integers. Here, we have to establish a safety margin-as long as the absolute value of the coordinates is at most 2 62 , the C implementation will produce a correct answer. Empirically we observed a 30× speed up of the C implementation over the Python implementation. At each step of the heuristic we checked if it was safe to use the (faster) C implementation.
To find the point q replacing p = (x, y) in Step 2, we first chose two natural numbers t x and t y . These number were distributed exponentially with a prespecified mean M and rounded to the nearest integer. Afterwards with probability 1/2 they were replaced by their negative. Point q was then set to (x + t x , y + t y ). After choosing an initial mean, the heuristic was left to run for some time, if no improvement was found by then, the mean was halved (or rather the point set was doubled by multiplying each of its points by two).
All the code used in this paper and the point sets obtained are available upon request from the first author. All the point sets obtained are available for download at the ArXiv page of this paper.