General-position subsets In
computational geometry, finite sets of points with no three in line are said to be in
general position. In this terminology, the no-three-in-line problem seeks the largest subset of a grid that is in general position, but researchers have also considered the problem of finding the largest general position subset of other non-grid sets of points. It is
NP-hard to find this subset, for certain input sets, and hard to
approximate its size to within a constant factor; this hardness of approximation result is summarized by saying that the problem is
APX-hard. If the largest subset has a solution with the non-constant
approximation ratio O(\sqrt k) can be obtained by a
greedy algorithm that simply chooses points one at a time until all remaining points lie on lines through pairs of chosen points. One can get a finer-grained understanding of the running time of algorithms for finding the exact optimal solution by using
parameterized complexity, in which algorithms are analyzed not only in terms of the input size, but in terms of other parameters of the input. In this case, for inputs whose largest general position subset has it can be found in an amount of time that is an exponential function of k multiplied by a polynomial in the input with the exponent of the polynomial not depending Problems with this kind of time bound are called
fixed-parameter tractable. For point sets S having at most \ell points per line, with there exist general-position subsets of size nearly proportional The example of the grid shows that this bound cannot be significantly improved. The proof of existence of these large general-position subsets can be converted into a
polynomial-time algorithm for finding a general-position subset of size matching the existence bound, using an algorithmic technique known as
entropy compression.
Greedy placement Repeating a suggestion of ,
Martin Gardner asked for the smallest subset of an n\times n grid that cannot be extended: it has no three points in a line, but every proper
superset has three in a line. Equivalently, this is the smallest set that could be produced by a
greedy algorithm that tries to solve the no-three-in-line problem by placing points one at a time until it gets stuck. If only axis-parallel and diagonal lines are considered, then every such set has at least n-1 points. However, less is known about the version of the problem where all lines are considered: every greedy placement includes at least \Omega(n^{2/3}) points before getting stuck, but nothing better than the trivial 2n upper bound is known.
Higher dimensions Non-collinear sets of points in the three-dimensional grid were considered by . They proved that the maximum number of points in the n\times n\times n grid with no three points collinear Similarly to Erdős's 2D construction, this can be accomplished by using points where p is a prime congruent to . Just as the original no-three-in-line problem can be used for two-dimensional graph drawing, one can use this three-dimensional solution to draw graphs in the three-dimensional grid. Here the non-collinearity condition means that a vertex should not lie on a non-adjacent edge, but it is normal to work with the stronger requirement that no two edges cross. In much higher dimensions, sets of grid points with no three in line, obtained by choosing points near a
hypersphere, have been used for finding large
Salem–Spencer sets, sets of integers with no three forming an arithmetic progression. However, it does not work well to use this same idea of choosing points near a circle in two dimensions: this method finds points forming convex polygons, which satisfy the requirement of having no three in line, but are too small. The largest convex polygons with vertices in an n\times n grid have only O(n^{2/3}) vertices. The
cap set problem concerns a similar problem to the no-three-in-line problem in spaces that are both high-dimensional, and based as
vector spaces over
finite fields rather than over the integers. Another generalization to higher dimensions is to find as many points as possible in a three dimensional N \times N \times N grid such that no four of them are in the same plane. This sequence begins 5, 8, 10, 13, 16, ... for , etc.
Torus Another variation on the problem involves converting the grid into a discrete
torus by using
periodic boundary conditions in which the left side of the torus is connected to the right side, and the top side is connected to the bottom side. This has the effect, on slanted lines through the grid, of connecting them up into longer lines through more points, and therefore making it more difficult to select points with at most two from each line. These extended lines can also be interpreted as normal lines through an infinite grid in the Euclidean plane, taken modulo the dimensions of the torus. For a torus based on an m\times n grid, the maximum number of points that can be chosen with no three in line is at most When both dimensions are equal, and prime, it is not possible to place exactly one point in each row and column without forming a linear number of collinear triples. Higher-dimensional torus versions of the problem have also been studied. ==See also==