DeepAI
Log In Sign Up

Nearest-Neighbor Decompositions of Drawings

Let 𝒟 be a set of straight-line segments in the plane, potentially crossing, and let c be a positive integer. We denote by P the union of the endpoints of the straight-line segments of 𝒟 and of the intersection points between pairs of segments. We say that 𝒟 has a nearest-neighbor decomposition into c parts if we can partition P into c point sets P_1, …, P_c such that 𝒟 is the union of the nearest neighbor graphs on P_1, …, P_c. We show that it is NP-complete to decide whether 𝒟 can be drawn as the union of c≥ 3 nearest-neighbor graphs, even when no two segments cross. We show that for c = 2, it is NP-complete in the general setting and polynomial-time solvable when no two segments cross. We show the existence of an O(log n)-approximation algorithm running in subexponential time for partitioning 𝒟 into a minimum number of nearest-neighbor graphs. As a main tool in our analysis, we establish the notion of the conflict graph for a drawing 𝒟. The vertices of the conflict graph are the connected components of 𝒟, with the assumption that each connected component is the nearest neighbor graph of its vertices, and there is an edge between two components U and V if and only if the nearest neighbor graph of U ∪ V contains an edge between a vertex in U and a vertex in V. We show that string graphs are conflict graphs of certain planar drawings. For planar graphs and complete k-partite graphs, we give additional, more efficient constructions. We furthermore show that there are subdivisions of non-planar graphs that are not conflict graphs. Lastly, we show a separator lemma for conflict graphs.

READ FULL TEXT VIEW PDF

page 1

page 2

page 3

page 4

08/04/2017

Geometric Embedding of Path and Cycle Graphs in Pseudo-convex Polygons

Given a graph G with n vertices and a set S of n points in the p...
03/30/2021

Approximate Nearest-Neighbor Search for Line Segments

Approximate nearest-neighbor search is a fundamental algorithmic problem...
02/19/2019

Euclidean TSP, Motorcycle Graphs, and Other New Applications of Nearest-Neighbor Chains

We show new applications of the nearest-neighbor chain algorithm, a tech...
04/14/2020

Online Graph Exploration on Trees, Unicyclic Graphs and Cactus Graphs

We study the problem of exploring all vertices of an undirected weighted...
01/13/2018

Not-All-Equal and 1-in-Degree Decompositions: Algorithmic Complexity and Applications

A Not-All-Equal (NAE) decomposition of a graph G is a decomposition of t...
03/17/2019

Circumscribing Polygons and Polygonizations for Disjoint Line Segments

Given a planar straight-line graph G=(V,E) in R^2, a circumscribing poly...
06/22/2022

Proximity Graph Maintenance for Fast Online Nearest Neighbor Search

Approximate Nearest Neighbor (ANN) search is a fundamental technique for...

1 Introduction

Let be a finite planar point set, and let be a finite set of colors. A coloring is a function that assigns a color to each point in . For any color , we write for the points in that were colored with .

In the following, we assume all pairwise distances in are distinct. The nearest-neighbor graph for a color , , is the embedded graph with vertex set and a straight-line edge between if and only if is the nearest neighbor of among all points in , or vice versa.222Our notion of nearest-neighbor graph is undirected, but a directed version also exists. We will consider both as a combinatorial graph, consisting of vertices and edges, and as a subset of the plane, consisting of the points in and the line segments that represent the edges. We write for the union of the nearest-neighbor graphs of all colors. Again, we consider both as a graph and as a set.

Figure 1: (a) A drawing. (b) A 3-colored point set. (c) The nearest-neighbor graphs.

We are interested in the following problem: suppose we are given a drawing , i.e., a set of straight-line segments in the plane such that if two segments intersect, then their intersection is a point and the two segments are not parallel. Under this assumption, by considering a drawing as a set of points in the plane, the input segments of are the inclusion maximal segments in . The special points of are the endpoints of the segments in and the intersection points between pairs of segments in . We denote the set of special points by . We require that the pairwise distances between the special points of are all distinct. Our general task is to find a set of colors and a color assignment , such that the union of the nearest-neighbor graphs for and equals , interpreted as subsets of the plane. We call an NN-decomposition of with vertex set , where stands for Nearest-Neighbor and we call the color-number of : see Figure 1.

Figure 2: The possible violations that make a drawing non-plane.

A drawing is called plane if its segments meet only at their endpoints, i.e., no segment of contains a special point in its relative interior; see Figure 2 for an illustration where the bold edges contain an endpoint or crossing point (marked with a square) in their interior which is not allowed by the definition.

Let be a connected component in a plane drawing , and let be a special point in . We denote by the special point in that is closest to (with distance ). Let be the set of special points in whose distance to is strictly less than . By definition, . Let and be two distinct connected components. We say that and are conflicting if there is a special point such that , or vice-versa. We denote by the connected components of . We define as the set of pairs where and are conflicting. We say that the graph is the conflict graph of . We call the connected component NN-representable if is the nearest-neighbor graph of its special points. An abstract graph is a conflict graph if it is the conflict graph of some plane drawing.

Related work.

The nearest-neighbor graph of a planar point set is well understood [1, 10]. It is a subgraph of the relative neighborhood graph of  [7, 10], which in turn is a subgraph of the Delaunay triangulation. The problem of recognizing whether a given abstract graph can be realized as a nearest-neighbor graph of a planar point set is open and we conjecture it to be hard. In contrast, testing whether a given embedded graph is a (single) nearest-neighbor graph is easy, as it suffices to test if each vertex is indeed conencted to its closest point.

Our problem also has applications in automated content generation for puzzle games: van Kapel introduces a version of connect-the-dots puzzles where the task is to connect dots based on colors rather than numbers [12]. In this puzzle, points may have multiple colors; see Figure 3

. Van Kapel implemented a heuristic approach for generating such puzzles. The heuristic works well for small instances, but for larger instances, it generates too many colors to be practical 

[9].

Figure 3: (a) Multi-colored points with 5 colors: blue, red, green, yellow, and orange: (b) the orange nearest-neighbor graph. (c) The union of all nearest-neighbor graphs. Figure taken from [9].

Our Results.

First, we consider the problem of testing whether a given drawing can be decomposed into nearest-neighbor graphs. We show that under the assumption that the drawing is plane, meaning that segments in may only meet at their endpoints, this problem is in P for , and NP-complete for . If we allow the segments of to cross the problem is already NP-complete for .

Inspired by our algorithms, we also introduce the new graph class of conflict graphs of drawings. We show that string graphs are conflict graphs and give additional, more efficient constructions in terms of size complexity for planar graphs and complete -partite graphs. On the other hand, subdivisions of non-planar graphs are not conflict graphs.

We show a separator lemma for conflict graphs, which allows us to provide an algorithm for computing a maximum independent set in conflict graphs in subexponential time. Using it as a subroutine, we obtain an -approximation algorithm for coloring conflict graphs that runs in subexponential time. This problem is of importance to us because we show that coloring conflict graphs is equivalent to partitioning a plane drawing into nearest-neighbor graphs.

2 Existence of NN-Decompositions on Special Points

2.1 The Plane Case

Let be a straight-line drawing. If is a line segment with such that is not a segment of , we say that is covered by . Recall that the vertex set of the NN-decomposition consists of the special points in . We investigate the question under which circumstances it is possible to find such a NN-decomposition of .

Let be a plane drawing. Suppose there is a NN-decomposition of , and let be the underlying coloring of . Then, for any connected component of , the coloring assigns the same color to all special points in .

Proof.

Suppose has a connected component in which assigns two distinct colors. Then, has a segment between two special points and such that . However, the line segment must be covered by , and thus, there exists a segment in that contains , , and another special point of (since the segments in are derived from nearest-neighbor relations between points of the same color). By our assumption that is a plane drawing, the segment is not in , so is not an NN-decomposition of , a contradiction. ∎

Let be a set of colors with . There is a polynomial-time algorithm for the following task: given a plane drawing , is there a NN-decomposition of with color set ?

Proof.

Let be a plane drawing. If there is a decomposition of with color set , then, by Section 2.1, every connected component is colored with a single color of , i.e., every connected component of is NN-representable. The latter necessary condition can be checked in polynomial time, as we only need to compute the nearest-neighbor graph of the special vertices in each component. If there is a connected component where this is not the case, the algorithm answers that there is no solution.

Otherwise, we construct the conflict graph of , and we check if can be colored with . This takes polynomial time since (for , check whether is bipartite, for , check that has no edges). Now, if is -colorable, we give all special points in a component the color assigned to the corresponding vertex in . Since all connected components are NN-representable, this is also a NN-decomposition of with . On the other hand, if has a NN-decomposition with color set , then must be -colorable, by definition of . ∎

Let be a set of colors with . The following task is NP-complete: given a plane drawing , is there a NN-decomposition of with color set ?

Proof.

Gräf, Stumpf, and Weißenfels [6] showed how to reduce -colorability to -colorability of unit disk graphs. Our proof is inspired by theirs. Let . We show the NP-hardness of coloring the special points of with colors by means of a reduction from -colorability. We make use of four types of gadgets: -wires, -chains, -clones, and -crossings. They are depicted in Figures 7, 6, 5 and 4, together with their conflict graphs. The symbol consisting of a number in a circle denotes a clique of size . A vertex connected to such a symbol means that there is an edge between and all the vertices of the clique. These conflict graphs are exactly the gadgets defined by Gräf, Stumpf, and Weißenfels. Note that each connected component in these gadgets is NN-representable. The gadgets shown are for .

Figure 4: A -wire of length and the conflict graph of a -wire of length . The symbol consisting of a number in a circle denotes a clique of size .
Figure 5: A -chain of length and the conflict graph of a -chain of length .

In Figures 6, 5 and 4, there are several sets of four segments that are very close and nearly vertical. For other values of , the gadgets are analogous, but with almost vertical segments instead of four. Similarly, in Figure 7, there are five sets consisting of three close segments. For other values of , there are five sets of segments. In Figures 5 and 4, -wires and -chains are drawn as if they were on a line, but they may also bend with a right angle. Note that in Figures 7, 6, 5 and 4 some vertices are specially marked with larger empty circles. These vertices will be called extreme vertices.

Figure 6: A -clone of length and and the conflict graph of a -clone of length .
Figure 7: The -crossing gadget and the conflict graph of the -crossing gadget.

In Figure 7, there seem to be points lying on a segment between two other points. Actually, these points are shifted by a sufficiently small , to ensure that the resulting drawing is plane.

The main property of a -wire is that in any coloring with colors of its conflict graph, the extreme vertices are assigned the same color. In contrast, in a -chain, the extreme vertices are assigned different colors. In a -clone of length , there are extreme vertices. In any coloring with colors from , all extreme vertices have the same color. Finally, for the -crossing, opposite extreme vertices must have the same color; a pair of consecutive extreme vertices (e.g., top and left extreme vertices) may or may not be assigned the same color, as shown in [5].

Figure 8: A graph with four vertices (left). Converting it to an NN-graph (right).

Now we follow the proof of Gräf, Stumpf, and Weißenfels. Suppose we are given a graph . We describe a drawing whose conflict graph can be colored with color set if and only if the vertices of can be colored with . Refer to Figure 8. For each vertex of degree in , we draw a -clone of size . The clones are drawn so that they are arranged on a horizontal line and such that their upper points have the same -coordinate. Then, for each edge , we draw it on the plane as two vertical segments, each incident to one -clone, and one horizontal segment that connects the two upper points of the vertical segments. We do that such that for any pair of edges, their horizontal segments have distinct -coordinates. Then we replace each crossing between a pair of edges by a -crossing. Finally, let us consider one edge , and let us orient it arbitrarily, say toward . We replace each part of the edge between two -crossings by -wires of sufficient length. If there are no crossings, we replace the edge by a -chain. Otherwise, the part of the edge between and the first -crossing is replaced by a -wire, and the part between the last -crossing and is replaced by a chain. As the points of distinct gadgets are sufficiently remote (except for pairs of gadgets that are connected on purpose), the conflict graph of this drawing is the union of the conflict graphs of the individual gadgets.

It is possible to find positions with a polynomial number of bits such that all pairwise distances are distinct but at the same time the positions are sufficiently close to the prescribed positions. This concludes the reduction.

It is straightforward to see that the problem is in NP with the certificate being a coloring of the vertices. For each point we can easily find its closest point with the same color (we compare squared distances to avoid taking square roots) and add the edges to the resulting graph. We can then compare the edges with the segments of the original drawing. ∎

2.2 The non-plane case

We show that if drawings are not required to be plane, the problem is hard for two colors.

Let be a set of colors with . The following problem is NP-complete: given a drawing , is there a NN-decomposition of with color set ?

Proof.
Figure 9: Structure of the conversion of the NAE-3SAT formula with clauses , , and into a 2-color graph.

We reduce from Not-All-Equal 3SAT (NAE-3SAT), where each clause has three variables and is satisfied if not all variables are equal. Let be an NAE-3SAT formula with variable set and clause set . Let be the associated bipartite graph with vertex set , where two vertices and are adjacent if and only if is a variable that appears in clause . We draw as follows: clauses are represented by vertical segments on the -axis of length . Variables of degree are represented as horizontal segments on the -axis of length . Each edge is drawn as the union of one vertical and one horizontal segment. The vertical segment is incident to the variable gadget for . The horizontal segment is incident to a clause gadget for . See Figure 9 for an example.

Figure 10: A clause gadget with (a) a valid assignment, (b)–(c) two invalid assignments. The dashed circles indicate distance to the nearest neighbor.
Figure 11: A non-plane crossing gadget.

We use some gadgets from the proof of Theorem 2.1. We replace each variable by a -clone of length . We replace each clause by the gadget in Figure 10a (see Figure 10b-c for assignments where all literals have the same color). In Figure 10a, there seem to be points lying on a segment between two other points. Actually, these points are shifted by a sufficiently small , to ensure that the resulting drawing is plane. We replace each crossing by the gadget in Figure 11. In Figure 11, some points have been colored. Note that this does not correspond to an assignment of truth values, but is supposed to provide visual information for the reader. The distance between a green point and a blue point is , for a sufficiently small . The distance between a blue point and the red point is . The distance between the red point and an orange point is . The blue point on the left and the orange point on the right are finally shifted by a suitable with , so that no two points are at the same distance from the red point. The points in the clause gadget that are on the vertical connected component on the left side are arranged so that this connected component is NN-representable. Finally, each part of an edge between two gadgets is replaced by a -wire of suitable length. We have thus obtained a drawing .

Figure 12: Two valid assignments of the non-plane crossing gadget. (a) All extreme segments have the same color. (b) Opposite segments have the same color.

We claim that is satisfiable if and only if there exists a special-point NN-decomposition of with two colors. First, notice a clause gadget has a special-point NN-decomposition if and only if two of the horizontal segments on the right side are assigned different colors. Indeed, we show in Figure 10b-c that if all literals have the same color, then the corresponding NN-graph is not the one that is required, the one shown in Figure 10a. It remains to show that if not all literals have the same color, then we obtain the correct NN-graph. By symmetry, if the top and bottom literals do not have the same color, then we are in the situation of Figure 10a. If the top and bottom literals have the same color, say red, then we keep the color of the remaining points of the clause gadget as in Figure 10a. Let us denote by the point of the clause gadget incident to the middle literal. By assumption, is blue. Let us denote by the top right vertex of the clause gadget, which is also colored in blue. Therefore the closest neighbohr of which is also blue is . Likewise, in the NN-graph, the closest neighbohr colored in blue of the bottom right vertex is . This shows that in this situation, the NN-graph is the same as in Figure 10a.

In the non-plane crossing gadget opposite segments are assigned the same color. All of them may be assigned the same color, as in Figure 12a, or consecutive segments might be assigned different colors, as in Figure 12b. Therefore, by associating the colors of with truth values, has a special-point NN-decomposition if and only if is satisfiable.

That the problem is in NP can be seen the same way as in the proof for Section 2.1. ∎

3 Conflict Graphs and Related Graph Classes

We show in Theorem 2.1 that -coloring of conflict graphs is NP-complete, for any fixed . To put this result into context, we will show that there exist graphs that are not conflict graphs. Moreover, we will prove the inclusion of some well-known graph classes in the class of conflict graphs. The aim is to characterise the class of conflict graphs, as it gives some information about what kind of running time we can expect for the vertex coloring algorithms on conflict graphs.

Let be a graph, and let us denote by the graph obtained from by subdividing each edge of once (i.e., for each edge in , we add a vertex in whose neighbors are exactly and ). In this section we will show that is a conflict graph if and only if is planar. Sinden [11] showed the same statement for being a string graph, i.e., an intersection graph of continuous curves in the plane.

First, let us recall Sinden’s proof for string graphs. Let be a graph, and let be obtained from as described above. Assume that is a string graph, and consider a representation of as a string graph. Contract to a point each curve in that corresponds to a vertex in and extend the curves corresponding to the edges in . In the process, one can maintain the property that the curves corresponding to the edges in intersect only two other curves, which are now reduced to single points. Observe that the resulting drawing is a plane embedding of . We adapt this method for conflict graphs.

Let be a graph, and let be the edge-subdivision of . Suppose that is a conflict graph, and let be a representation of as a conflict graph. We still would like to contract each connected component of that corresponds to a vertex in to a single point. However, now it is not clear that we can extend the connected components corresponding to edges in such that they only intersect two other connected components (now reduced to points). This is illustrated in Figure 13. The connected components in blue correspond to the vertices in , those in red correspond to the edges in . The dashed segments show a conflict between two connected components. Inside the green square, we have a connected component blocking another one. We therefore want to reroute the connected component so that there is no intersection. To show how we do it, we first need the following lemmas.

Figure 13: A representation of the subdivision of ( is shown on the right side) as a conflict graph. The connected components in blue correspond to vertices in , the ones in red correspond to edges in . The dashed segments show a conflict between two connected components. In the green zone, a conflict overlaps with a connected component.

Let be a plane drawing. Let be its conflict graph. Let be a pair of connected components that are conflicting. Let us consider two points and that certify this conflict (for instance, assume without loss of generality , , ). We denote by the segment with endpoints and .

Figure 14: Illustration of Lemma 3. The disk contains .

If a connected component intersects the line segment , then this connected component is conflicting with or .

Proof.

The proof is illustrated in Figure 14. Let us denote by a segment in a component which intersects . Let us assume that is not conflicting with , and let us show that it is conflicting with . Let us consider the circle centered at going through , the closest point to among the ones that are in the same connected component. By assumption, the endpoints of , denoted by and , are not inside . In contrast, is inside . We consider the disk with diameter . To show that is conflicting with , it is sufficient to show that is contained in , for then we have or . We know that intersects twice. By assumption, is not contained in . As two circles can intersect at most twice, contains all of on at least one side of . Therefore, contains . ∎

Let us consider another pair of conflicting components, denoted by and . Let and be two points that certify this conflict. Let us assume without loss of generality . We denote by the segment with endpoints and .

Assume that and are not in . If the segments and intersect, then or is in . In particular, at least one of and is conflicting with or .

Proof.

The situation is similar to the one of Lemma 3. By assumption, the segment intersects twice the circle centered at with radius . Therefore the proof of Lemma 3 can be applied in this situation, too. ∎

We are now ready to prove the theorem. As we are considering conflict graphs, there might be obstacles when we try to follow Sinden’s proof that were not there with string graphs. We use the two lemmas above to reroute these obstacles.

Let be a graph and let denote the subdivision of . If is a conflict graph then is planar.

Proof.

Let us assume we have a representation of as a conflict graph. We denote by the vertices in corresponding to vertices in and by the vertices in corresponding to edges in . For each vertex , we pick an arbitrary point on the connected component that represents in the conflict representation. We are going to reduce all connected components to their corresponding point . Let be the vertex in corresponding to the edge in . We want to extend to a curve that contains and at each endpoint. We want to do that for all vertices in , such that no two curves intersect, except maybe at endpoints. Therefore, we would obtain a plane representation of .

Let us first consider all connected components in the representation as a conflict graph, before reducing some of them to points, and extending the rest to curves. For each pair of connected components that are conflicting, we find two points and that certify it, meaning that is in or vice versa. We now draw the segment with endpoint and , for each such pair of conflicting components. We denote by the set of segments we have obtained. Let us consider a connected component corresponding to a vertex in , that intersects with some segments in . For one of these segments it intersects, say , we name its endpoints and . Without loss of generality, we assume and . By Lemma 3, is conflicting with or . By assumption, and are conflicting. Therefore one of them, say , corresponds to a vertex in , and the other corresponds to a vertex in . By definition of , no two vertices in are connected by an edge. This implies that is conflicting with . This shows that when we want to extend a connected component to a curve that contains and at each endpoint (see the notation above), we might be blocked by other curves, but these curves have to also contain or at an endpoint. This is the situation depicted in Figure 13. Here we simply have to reroute the edge going from vertex to .

One issue that might still occur is that when trying to extend a connected component into a curve, we are not blocked by another connected component, but by the extension into a curve of a connected component. Namely, how do we do the rerouting when two segments in intersect? Let and be those two segments. By construction, is a segment between two connected components and . Without loss of generality, we can assume that corresponds to a vertex in and to a vertex in . Likewise, is a segment between two connected components and , with corresponding to a vertex in and to a vertex in . Now we use Lemma 3, which states that one connected component from each pair are conflicting. By construction, this pair is or . This shows that we are in the same situation as in the paragraph above. Thus it is possible to reduce each connected component corresponding to a vertex in to a point, and then extend the connected components from into curves. By doing that, we obtain a plane drawing of . ∎

Theorem 3 and its analogy to the proof for string graphs in [11] may suggest that the class of conflict graph is equal to the class of string graphs. We show that, indeed, the string graphs are contained in the conflict graphs, but conjecture that the opposite is not true.

All string graphs are conflict graphs.

Proof.

Let be a string graph. We start by embedding as a set of strings (curves) in the plane. We may assume the strings are non-self-intersecting, but they could intersect other strings multiple times. For ease of exposition, we further assume that all curves are orthogonal polylines aligned to a unit grid. The proof steps are illustrated in Figure 15.

Fix a resolution such that if we place points on each string at distance from each other, then these points will always be closer to each other than to points on other strings, except near crossings. Pick an arbitrary string . Consider the ?tunnel? of width around ; by construction the other strings cross this tube in consecutive proper crossings. Consider the ordered list of crossings of with other strings (note that could be independent of ).

Figure 15: Illustration of the proof of Theorem 3. (a) A string representation with strings. (b) The tunnel around the red string. (c) Rerouting the blue and green strings inside the red tunnel. Note that the blue string crosses the red string twice. (d) The final set of strings after one iteration of the algorithm. The red string no longer intersects any other strings. (e-h) The second (and last) iteration of the algorithm.

Set . We increase the resolution of all strings except to . Now we reroute all other strings inside the tube of so that they keep distance from each other and from the tube boundary, but such that the crossings with are close to the start point of ; specifically, crossing should be at distance from the start point of . Note that this rerouting is always possible.

Now, we shorten by deleting the first length of it. After this, does not intersect any other strings, but if we keep the resolution of at , it will have a conflict with exactly those strings that it originally intersected. Since the resolutions of the remaining strings were increased, they do not have any conflicts except near crossings with each other.

We recursively apply this strategy: pick an arbitrary remaining string , keep its resolution at , determine its crossings and a finer resolution , reroute all strings, and shorten . In the end, we will have strings at increasingly fine resolutions whose conflict graph is exactly the original string graph. ∎

Note that the resolution (and hence the size of the components) has a superexponential growth. Hence, this does not give us a polynomial-time reduction, and thus we cannot conclude that coloring embedded conflict graphs is NP-hard from the fact that coloring embedded string graphs is NP-hard.

However, the following lemmas show that both planar graphs as well as complete -partite graphs are conflict graphs and the proof gives a polynomial-time reduction (for a fixed in the latter case). Note that Lemma 3 gives us an alternative proof that coloring embedded conflict graphs is NP-hard.

Every planar graph with vertices is a conflict graph of a set of components of complexity polynomial in .

Proof.

Given a plane straight-line drawing of a planar graph (obtained by Fáry’s theorem [2]) such that no two points are on a common vertical or horizontal line. We construct a drawing such that its conflict graph is . The rough idea is to replace every vertex by the gadget in Figure 16, and replace each edge by two edges which enforce a conflict.

Figure 16: Every vertex is replaced by this gadget. Here for .

The gadget’s drawing (Figure 16) depends on the number of vertices of . We construct a horizontal line with points with small distance

. To every odd vertex we add vertical lines, starting with 4 additional vertices on the left and right end, increasing by 4 vertices every step towards the center (with same distance

). The topmost and bottommost vertex of these lines are denoted by and respectively, from left to right.

We replace every vertex in with a copy of , called . Let and denote and of respectively. Consider an edge of . Without loss of generality assume is above and to the left of (the other cases are symmetric). We consider all vertices in this quadrant of in clockwise order and assume that is the -th such vertex. Accordingly, assume is the -th vertex in clockwise order below and to the right of .

We draw the edge and replace it by a path of segments of length from to a point with . The points and enforce the conflict between and and hence the edge in .

The conflict graph of obviously contains all the edges of . It remains to show, that no additional edges are introduced by showing that any introduced path only conflicts with the corresponding component . Assume that the distance between every edge and every vertex not incident to is at least . If is chosen small enough then the distance of to every gadget except and is larger than .

Assume is a path that conflicts with . If does neither start at nor at , then cannot conflict with since the distance between two independent edges is at least . If starts at we have two cases. If is below , then the slope of is less than the slope of . If is above , then the slope of is greater than the slope of . In both cases the smallest distance is between the starting points of and which is at least by construction. Hence, there does not exist such a further conflict. ∎

Every complete -partite graph with vertices is a conflict graph of a set of components of complexity polynomial in .

Proof.

Given a complete -partite graph where each set with index has vertices. We will construct a graph with a drawing such that is the conflict graph of , i.e., each set will consist of components which are not in conflict with each other but with all other components from the other sets.

For each group the drawing needs two properties: the components’ resolution and the components’ minimum distance to each other . The idea of the construction is that for all but for all so that components in the same set do not conflict but all components in a set conflict with all other components (and thus also with all ).

Figure 17: Left: The drawing for the first set. Right: The drawing for the third set with rerouted first set.

We start with parallel components where and , see Figure 17 (left). For all following sets we set and . We place the components from the th set orthogonal to the th, starting at the opposite corner of a square of size , as seen in Figure 17 (right). We finally route the th set between the last two components of the th set with distance to the last component. This requires that and are multiples of and that is a multiple of which in ensured by our choices for and .

Figure 18: A conflict graph representation of the complete -partite graph .

A depiction of the resulting drawing for , , and can be found in Figure 18. From the construction it is immediate that a component is not in conflict with a component of the same group but with all other components. Hence the initial graph is a conflict graph of our constructed drawing . ∎

4 Separators of conflict graphs and chromatic number

Let us recall the motivation for our problem. Starting from a drawing , we want to color the vertices of that drawing such that the nearest-neighbor graph on those colored vertices is the drawing . If the drawing is plane, we have shown that this problem boils down to coloring a conflict graph, where one vertex corresponds to a connected component of the drawing. We have shown in Theorem 2.1 that this problem is NP-hard, even for -coloring plane drawings. In this section, we show the following theorem:

There exist an exact algorithm for maximum independent set, and an -approximation algorithm for vertex coloring in conflict graphs with vertices, running in -time.

The exact algorithm for maximum independent set is used as a subroutine to obtain the -approximation algorithm for coloring conflict graphs in subexponential time, where denotes the number of vertices in the conflict graph. Indeed, coloring vertices can be seen as a covering problem, where there is a hyperedge for a set of vertices if and only if those are independent. As we have an exact algorithm for maximum independent set, we can use the greedy algorithm for covering to obtain the approximation.

In [4], Fox and Pach present an algorithm running in -time for maximum independent set in string graphs. The input is an abstract graph, and it outputs a maximum independent set or a certificate that the input graph is not a string graph. As they observe, the only property they use is the following separator lemma: Every string graph with edges and maximum degree contains a separator of order at most  [4]. A separator in a graph with vertices is a subset such that there is partition of into three sets , with and , such that there is no edge between a vertex in and a vertex in . We show that this lemma also holds for conflict graphs, which immediately implies that the algorithm by Fox and Pach also applies to our setting. The lemma was actually proven in another paper by the same authors, denoted there as Theorem 2.5 [3]. The proof uses several lemmas, but the assumption that the considered graph is a string graph appears only once. As defined in [3], the pair-crossing number of a graph is the minimum number of pairs of edges that intersect in a drawing of . Fox and Pach showed that if is a string graph, then is at most the number of paths of length or in , where the length of a path is the number of its edges. Following the proof of their Theorem 2.5 [3], it is sufficient for us to show the following:

If is a conflict graph, then is at most the number of paths of length or in .

Proof.

We use a similar notation to [3]. Let us consider a representation of a conflict graph. For each pair of conflicting connected components and , we consider two points and , such that . We now consider the drawing consisting of the union of the connected components and the line segments with endpoints , for each pair of conflicting connected components. If three or more line segments intersect at the same point, we shift slightly the relative interior of one so that this is not the case anymore. It is not an issue that those are not segments anymore, we only want them to be Jordan curves. For simplicity, we keep referring to them as line segments with endpoints . For each connected component , we consider an arbitrary point on . Let denote a pair of conflicting connected components. We denote by a curve that starts at , goes along until it reaches the line segment between and that we have added to the drawing, follows this line segment until it reaches , and finally goes along until it reaches . Observe that this gives us a drawing of in the plane. Suppose that two edges and in this drawing intersect. We claim that they determine a unique path of length or in .

First if and share a connected component , then they determine a path of length where is the middle vertex. Now let us assume without loss of generality that and . If the curves and intersect inside one of the connected components, say , then we can apply Lemma 3 to infer that is in conflict with one of the components in , say . If and intersect outside of a connected component (i.e., the line segment between and intersects the line segment between and ) we can similarly apply Lemma 3 to show that one component from , say , is in conflict with one component in , say . In both cases the vertices , , , form a path of length . We have shown that a pair of edges that intersect in the drawing determine a unique path of length or in . ∎

Lemma 4 is sufficient to show that conflict graphs with edges and maximum degree contain a separator of order at most , as shown by Fox and Pach [3]. Following their notation, the bisection width of a graph is the least integer such that there is a partition with , and the number of edges between and is . As shown by Kolman and Matoušek [8], we have for every graph on vertices where is a constant and is twice the number of paths of length or in . By denoting by the number of paths of length at most in , we derive from Lemma 4 that if is a conflict graph, then . A simple argument proven by Fox and Pach states that is at most for a graph with edges and maximum degree  [3], which concludes the proof.

5 Conclusion and open problems

In this work we studied the decomposition of a drawing into nearest-neighbor graphs. First, we studied the decision problem, whether for a given natural number it is possible to decompose a drawing into nearest-neighbor graphs. If we allow that segments of the drawing cross the problem is NP-complete. If we assume that the segments only meet at endpoints, it is NP-complete for and polynomial-time solvable for . We provided an -approximation algorithm running in subexponential time for coloring plane drawings with a minimum number of colors, which we showed to be equivalent to partitioning a plane drawing into a minimum number of nearest-neighbor graph. It would be interesting to find better approximation algorithms, with respect to the approximation ratio or the running time. Also, it would be interesting to study other variants of this problem; specifically, where points can have multiple colors.

We introduced so called conflict graphs and showed that not every graph is a conflict graph, but every string graph is a conflict graph. It is an open problem, whether there is a conflict graph, which is not a string graph. Further it would be interesting to know relations between other graph classes and conflict graphs.

References

  • [1] D. Eppstein, M.S. Paterson, and F.F. Yao. On nearest-neighbor graphs. Discrete Comput Geom, 17:263–282, 1997. doi:10.1007/PL00009293.
  • [2] István Fáry. On straight-line representation of planar graphs. Acta scientiarum mathematicarum, 11(229-233):2, 1948.
  • [3] Jacob Fox and János Pach. A separator theorem for string graphs and its applications.

    Combinatorics, Probability and Computing

    , 19(3):371–390, 2010.
  • [4] Jacob Fox and János Pach. Computing the independence number of intersection graphs. In Proceedings of the twenty-second annual ACM-SIAM symposium on Discrete algorithms, pages 1161–1165. SIAM, 2011.
  • [5] Michael R. Garey, David S. Johnson, and Larry J. Stockmeyer. Some simplified NP-complete graph problems. Theoretical Computer Science, 1:237–267, 1976. doi:10/dwvqpj.
  • [6] Albert Gräf, Martin Stumpf, and Gerhard Weißenfels. On coloring unit disk graphs. Algorithmica, 20(3):277–293, 1998.
  • [7] J.W. Jaromczyk and G.T. Toussaint. Relative neighborhood graphs and their relatives. Proc. of the IEEE, 80(9):1502–1517, 1992.
  • [8] Petr Kolman and Jiřı Matoušek. Crossing number, pair-crossing number, and expansion. Journal of Combinatorial Theory, Series B, 92(1):99–113, 2004.
  • [9] Maarten Löffler, Mira Kaiser, Tim van Kapel, Gerwin Klappe, Marc van Kreveld, and Frank Staals. The connect-the-dots family of puzzles: Design and automatic generation. ACM Transactions on Graphics, 33(4):72, 2014. doi:10.1145/2601097.2601224.
  • [10] Joseph S. B. Mitchell and Wolfgang Mulzer. Proximity algorithms. In Jacob E. Goodman, Joseph O’Rourke, and Csaba D. Tóth, editors, Handbook of Discrete and Computational Geometry, chapter 32, pages 849–874. CRC Press, Boca Raton, 3rd edition, 2017. doi:10.1201/9781315119601.
  • [11] F. W. Sinden. Topology of thin film RC circuits. The Bell System Technical Journal, 45(9):1639–1662, 1966. doi:10.1002/j.1538-7305.1966.tb01713.x.
  • [12] Tim van Kapel. Connect the closest dot puzzles. Master’s thesis, Utrecht University, 2014. URL: http://dspace.library.uu.nl/handle/1874/296600.