 # On complexity of mutlidistance graph recognition in R^1

Let A be a set of positive numbers. A graph G is called an A-embeddable graph in R^d if the vertices of G can be positioned in R^d so that the distance between endpoints of any edge is an element of A. We consider the computational problem of recognizing A-embeddable graphs in R^1 and classify all finite sets A by complexity of this problem in several natural variations.

## Authors

##### This week in AI

Get the week's most popular data science and artificial intelligence research sent straight to your inbox every Saturday.

## 1 Introduction

### 1.1 Problem statement and motivation

Let  be a set of admissible distances. For a set of points  we construct an -distance graph of as a graph with vertices in  and edges between all pairs of vertices at admissible distances. A generic graph will be called an -distance graph in  if it is isomorphic to an -distance graph of a subset of .

The notion of an -distance graph is inspired by classic unit-distance graphs and is, indeed, a proper generalization since putting  yields exactly the unit-distance graphs. Unit-distance graphs appear in many classical problems such as Erdős’ unit distance problem (see [erdos]), Nelson—Hadwiger problem of the chromatic number of the plane (see [raigorborsuk]). For a comprehensive survey of these (and many other) discrete geometry problems see [brass]; a survey of results concerning unit-distance graphs can be found in [raigorcolor, raigorcliques, raigorcoding]. Some isolated properties of -distance graphs were studied for finite sets  (see [raigorcolor, kupav, gorskaya]).

In literature unit-distance graphs and objects of similar nature appear under different names, such as linkages ([schaefer]), embeddable ([saxe]), or realizable ([schaefer]) graphs. Also, the term “unit-distance graph” is sometimes applied to slightly different objects (e.g., in [horvat]). Before going further, we find it convenient to unify the different notions and extend them to the multidistance case.

Let  be a graph. If  is such a map that Euclidean distance between  and  is an element of  for all edges , then we will say that  is an -embedding of  in . We will call  an injective -embedding if it maps distinct vertices to distinct points of  (that is,  is an injective map). If for any pair  we have that the distance between  and  is not an element of , then  will be called a strict -embedding. Naturally, a graph is (strictly) (injectively) -embeddable in  if it admits an (strict) (injective) -embedding in . Note that strictly injectively -embeddable graphs are exactly the -distance graphs as defined above.

We now consider the computational problem of recognizing -embeddable graphs in . Throughout the paper we consider the distance set , the dimension , as well as the choice of one of the embeddability types (arbitrary, strict, injective, strict and injective) to be fixed parameters and not parts of the input.

The complexity of the unit-distance () case is studied in [saxe, horvat, schaefer, tikhomirov]: all variations of the problem are in P for , and are NP-hard for . Another example of a well-studied case is the case of -distance graphs, usually called unit ball graphs. In the  case (real line embedding) -distance graphs are unit interval graphs; they are recognizable in linear time ([booth, looges]). Recognizing -distance graphs in the plane is NP-hard ([breu]) and even hard for the existential theory of reals ([kang]). An interesting approach of [hlinveny] based on dense lattices in  allows to establish NP-hardness of -embeddability for .

The present paper is concerned with the most “primitive” case of the -embeddable graph recognition problem with  and finite distance sets. For each finite set  and each embedding type we classify the corresponding problem as belonging to P or an NP-complete. Note that since the set  is fixed, all functions that depend only on

rather than on the input graph are constant in complexity estimates.

### 1.2 Statement of the results

Let  be a non-empty finite set of non-zero real numbers. Suppose further that , that is,  implies . Let  be the additive group generated by elements of . A graph  is -embeddable in  if and only if a homomorphism of certain type exists between the graphs  and  — the Cayley graph of the group  with the generating set . We recall that by definition  with  and .

The group  is a free finitely generated abelian group, hence it is isomorphic to  for an integer . In the sequel we identify each element of  with the element of  being its image under a certain canonically chosen group isomorphism.

The following theorem provides a complete classification of finite sets  depending on the complexity of -embeddability checking in .

###### Theorem 1.
1. [label=()]

2. The problem of -embeddability checking in  is in P if the graph  is bipartite, otherwise the problem is NP-complete.

3. The problem of strict and/or injective -embeddability checking in  is in P if , otherwise the problem is NP-complete.

Note that  if and only if all pairwise quotients of elements of  are rational, or, equivalently,  for a real .

The (a) part of Theorem 1 is an immediate corollary of the result [macgillivray] on the complexity of -coloring for infinite graphs  of bounded degree. It is possible to obtain a more explicit condition in terms of elements of :

###### Proposition 1.2.1.

If is a symmetrical generating set of , then is bipartite iff there is a subset such that for each we have that

is odd.

###### Proof.

If there is a set that satisfies the premise, then is bipartite with parts  defined by . Conversely, let be bipartite with parts , i.e. , , , and for any edge of neither nor contains both and . Note that if is bipartite, then there is only one correct partition. Without loss of generality, assume that . Consider a basis element , with all coordinates except -th equal to 0, and -th coordinate equal to 1. If , then by vertex transitivity we must have that for any the elements and belong to the same part. If , then and must belong to different parts for any . Define . For any element we must have since is an edge of , hence is odd, which concludes the proof.

The case  of the (b) part follows from the result [matousek] on the time-polynomial solution of SUBGRAPH-ISOMORPHISM for graphs of bounded treewidth; the details are given in Section 1.3 (a discussion of treewidth and a survey of relevant algorithmic results can be found in [bodlaendertourist]). The bulk of the present paper is dedicated to proving NP-completeness of strict and/or injective -embeddability checking in  in the case  with . Let us outline the scheme of the proof.

In Section 2 we study automorphisms of the Cayley graph  and its finite subgraphs. The main result of the section is Theorem 2 that asserts existence of finite subgraphs of  such that each of their automorphisms acts linearly on elements of  and can be extended uniquely to an automorphism of the full graph . The existence of “-rigid” subgraphs provided by Theorem 2 allows us to avoid most of the complications arising from the “graphical” nature of -embeddability and lead the discussion of the subsequent constructions in geometric terms.

In order to establish NP-completeness, we implement the “logic engine” setup (see Section 3.1) to reduce from the NP-complete NAE-3-SAT problem to strict and/or injective -embeddability checking via an intermediate problem LOGIC-ENGINE. In Section 3 we describe the reduction from logic engine realizability to each case of strict and/or injective -embeddability checking in using two different logic engine implementations for the cases  and .

Note that all embeddability problems in  belong to NP since they are equivalent to the -coloring problem (with possible additional constraints) which admits polynomial certificate, namely, integer coordinates of corresponding elements of .

### 1.3 The G∼Z case, strict and/or injective A-embeddability

Since , the elements of  become mutually coprime integers under a canonical group isomorphism of  and . Let us put .

First consider the injective (possibly non-strict) embeddability case.

###### Lemma 1.3.1.

Let be a finite subgraph of . Then the treewidth (and, moreover, the pathwidth) of  is at most .

###### Proof.

Note that adding edges to a graph does not decrease its path- or treewidth. Without loss of generality, suppose that the subgraph  is induced by a vertex set . If , then take the trivial path decomposition with a single vertex . This decomposition has width , hence the claim holds.

Now suppose that . We will build a path decomposition  of the graph  with width . Take subsets  for all integer  from 0 to  as vertices of . The edges of  will connect subsets that are different in a single element.

Let us ensure that  is indeed a path decomposition of . Clearly  is a path, and for every vertex  the vertices of  containing  form a subpath. Suppose that  and . Then  and , hence both endpoints of any edge of  are covered by a vertex of . Thus all requirements of a path decomposition are met. Finally, it can easily be seen that the width of  is .

Suppose that a connected graph  is the input to the -embeddability checking problem, and  is a subgraph of  induced by the vertex set {, …, }. Clearly, the graph  is (strictly/non-strictly) injectively -embeddable in  if and only if  is isomorphic to an (induced/non-induced) subgraph of .

The following result is due to [matousek]: suppose that the maximal degree of a connected graph  is bounded by a constant , and a graph  has treewidth bounded by a constant , then finding an (induced/non-induced) subgraph of  that is isomorphic to  can be done in  time. The maximal degree of the graph  is at most , thus we can assume that the maximal degree of  is at most  as well (otherwise  can not be isomorphic to a subgraph of ). Further, by the previous lemma the treewidth of  is at most . Thus, by using the algorithm of [matousek], we obtain an algorithm for checking injective (strict/non-strict) -embeddability in  time.

Finally, consider the case of strict non-injective -embeddability. Let  denote the set of neighbours of a vertex  in the graph . We will say that vertices  are equivalent if , and will write .

###### Proposition 1.3.2.

Suppose that  is a subset of  that contains a single vertex from each equivalence class of , and  is the subgraph of  induced by . Then the graph  is strictly -embeddable in  if and only if  is strictly injectively -embeddable in .

###### Proof.

Suppose that  is a strict -embedding of  in . If , then by strictness of  for every other vertex  the edges  and  are either both inside or both outside of , and we must have . Since no two distinct vertices of are equivalent, then the restriction  is a suitable strict injective -embedding of the graph .

Conversely, consider a strict injective -embedding  of the graph  in . Define an embedding  by , where  is the only vertex of that satisfies . If , then we must have . But  is strict, hence , thus  is a strict -embedding.

The graph  can be easily constructed by  in polynomial time, and strict injective -embeddability of  can be checked in polynomial time in the  case. Thus the first half of the (b) part of Theorem 1 is proven.

## 2 Balls in Γ and their automorphisms

### 2.1 Balls and embeddings

Recall that  is a free finitely generated abelian group,  is a finite generating set of , and .

Let . Since for each  the translation  is an automorphism of , the length of the shortest path between vertices  and  in the graph  depends only on ; let  denote this length ( is the same as the word metric of the group  with the generating set ). Also let  denote the number of shortest paths between  and  in . In the sequel we will omit the upper index  when the set  is clear from the context.

If  and , then we will write  for a copy of  translated by  element-wise. Similarly, if is a subgraph of , we will write  for a subgraph obtained from  by shifting all vertices and endpoints of edges by .

###### Definition 2.1.1.

Suppose that  is a non-negative integer. Let  denote the subgraph of  induced by the vertex set . We will call the graph  the ball of radius .

###### Proposition 2.1.2.

Suppose that  is a subgraph of , and  is a graph isomorphism. Then .

###### Proof.

Since for any path , …, in the graph  there is a path , …, in the graph , then for any vertex  we have

 ρ(φ(x)−φ(0))⩽ρ(x)⩽r,

hence . But

 |V(λ)|=|V(Br)|=|V(Br+φ(0))|,

thus we have . Edges of  and  are in one-to-one correspondence, thus

 |E(Br)|=|E(λ)|⩽|E(Br+φ(0))|=|E(Br)|,

and .

We are interested in possible embeddings of the ball of radius  in the graph , that is, graph isomorphisms . Since  is vertex-transitive, it suffices to consider the group , because every embedding  is composed of an automorphism of  and a translation by .

Consider the group  of automorphisms of  that stabilize the origin. It follows from the results of [ryabchenko] that each automorphism  is additive (that is, satisfies  for all ), hence it is unambigiosly determined by the values  on all .

Linearity is a stronger property of an automorphism. We will say that is linear if there exists a non-degenerate linear map  such that  for all . Clearly, linearity implies additivity.

From each  we can construct an element of , namely, the restriction . Since an element of  is induced by its values on , we have that distinct elements of  have distinct restrictions on  (if  is positive). It should be noted, however, that in many cases the graph admits different kinds of automorphisms: for example, if is a standard basis of (after adjoining the inverse elements) and , then the group is isomorphic to since each automorphism can freely exchange the axes and/or flip their directions. At the same time, we have that  is isomorphic to  since the graph  is isomorphic to . Moreover, for each integer  we can construct a set  such that : if we take, for example,

 A={±(2r+1,0),±(0,2r+2),±(1,1)},

then the graph  is isomorphic to a ball of radius  in the lattice  with standard basis, hence , while  and contains only the trivial automorphism and the central symmetry.

Theorem 2 shows that for sufficiently large radius  the group  precisely captures the structure of , or, in other words, each automorphism of  can be extended to an automorphism of  (in this case, the extension is unique). Moreover, all automorphisms of  and  turn out to be linear.

###### Theorem 2.

Suppose that  is a free finitely generated abelian group, and  is an arbitrary finite symmetrical generating set of  that doesn’t contain 0. Then there exists an integer  such that for every integer  each automorphism of the graph  is linear and has a unique extension to an element of .

Let us outline the proof of Theorem 2. First, we establish that each automorphism of a sufficiently large ball stabilizes the set of vertices of convex hull of  (these vertices are called the primary elements of ). We will refer to the corresponding permutation of primary elements of  as an orientation of the automorphism. We also show that orientation is well-defined for any “bundle” of balls, that is, the induced union of balls with a connected set of centers. We will use this to show that each automorphism of a large enough ball is linear on the partial lattice induced by primary elements.

On the other hand, we will show that the restriction of any automorphism to the lattice induced by non-primary (secondary) elements is an automorphism of the ball in the Cayley graph of the additive group induced by the secondary elements. By induction on the size of , this implies linearity of this automorphism if the ball is large enough. The final part of the proof is “gluing” of the two linear automorphisms and extending them to all vertices of the ball that do not belong to any of the lattices. Finally, we exclude each automorphism of  that does not allow extension to an automorphism of  simply by increasing since the set of permutations of , and therefore, of possible automorphisms, is finite.

### 2.2 Properties of ball embeddings in Γ

###### Proposition 2.2.1.

For each graph automorphism  and each vertex  the equalities  and  hold.

###### Proof.

For each ball subgraph any shortest path in  between the center  and any vertex of  contains only edges of , hence there is a bijection between shortest paths in  from  to  and from  to .

###### Definition 2.2.2.

We will say that  is a primary element if for any integer  we have  and . Any other element of  will be a secondary element.

Let  denote the set of all primary elements of . It is clear from the symmetry argument that .

By definition, there exists an integer  such that for all secondary  we have either  or . Aside from characterization of primary elements of , the next proposition contains a constructive way of choosing a suitable value of  in the second part of the proof.

If , then we will write  for the convex hull of the set .

###### Proposition 2.2.3.

An element  is primary if and only if  is a vertex of .

###### Proof.

Let  be a vertex of , then there is a linear function  such that  for all  that are different from . It follows that , and . Suppose that  is a sequence of edge transitions in leading from 0 to , that is, . Then we have

 tl(x)=l(tx)=l(d1)+…+l(ds)⩽sl(x),

hence  and . If  and not all elements , …,  are equal to , then , a contradiction. Thus the shortest path in between 0 to  has length  and is unique, hence is indeed a primary element.

Now suppose that  is not a vertex of . Note that the origin of  lies inside of  since . Then  belongs to the convex hull of the origin and a certain set  (with all ) over the field . Hence we have  for some non-negative rational numbers  such that . After multiplying by a common denominator of the numbers  we obtain the equality , where  and all  are non-negative integers, and . From this equality we obtain that there is a path in  between 0 and  of length at most  that contains transitions other than , thus  or , and  is not a primary element.

From the second part of the proof we can also obtain the following

###### Proposition 2.2.4.

For each element  there exists an integer  such that  can be represented as a sum of at most  primary elements (with repetitions allowed).

The next proposition can be informally stated as follows: in any embedding of a large enough ball in  the “rays” (i. e., the unique shortest paths) that correspond to the primary directions are <<rigid>> and can only be permuted among themselves, while opposite rays stay opposite and form a “straight line”.

###### Proposition 2.2.5.

Suppose that  and  is a graph isomorphism. Then for each  there exists  such that . Moreover,  for all integer .

###### Proof.

Proposition 2.2.1 implies that

 ρ(φ(rx)−φ(0))=ρ(rx)=r

and

 ω(φ(rx)−φ(0))=ω(rx)=1.

However, if for all , then we must have . Indeed, an arbitrarily chosen shortest path from to must contain different transitions, thus by permuting them we obtain a different shortest path. Therefore we have  for a certain . Moreover, , thus is a primary element by the choice of .

Next, let us establish the second part of the statement for , that is,

 φ(−rx)−φ(0)=−rx′.

Suppose that  with . Note that there is a unique path of length  between  and  in the graph  since  is a primary element. At the same time, consider the following path of length  from  to  that passes through : transitions by  followed by  transitions by . Let us exchange -th and -th step of this path, the resulting path will pass through  instead of . Since  and , the new path lies completely inside of , and thus we have at least two different paths of length  between and in . It follows that the graph isomorphism  does not preserve the number of paths of length  between a pair of vertices, which is a contradiction. Hence we have .

Finally, let us prove the second part for all other values of . First, let . The vertex  must belong to the only shortest path between  and . But this path consists only of transitions by , hence . The case is handled similarly by considering the shortest path between and .

Let us define the orientation of a ball embedding as a way of permuting the primary elements.

###### Definition 2.2.6.

Suppose that  and  is a graph isomorphism. Let  denote the orientation of the isomorphism  as a function that maps each  to . If  is an isomorphism between two subgraphs of , and  is a subgraph of , let us write  for the orientation of the restriction of  to .

Proposition 2.2.5 immediately implies

###### Corollary 2.2.7.

is a permutation of that satisfies .

###### Definition 2.2.8.

For  define the norm  as an -norm of the corresponding element of  (i. e., the largest absolute value of coordinates). For a subset  put .

The next proposition states that if two large enough balls (possibly having common vertices) are subgraphs of an induced subgraph of , and the centers of the balls are adjacent, then their orientations must coincide in any embedding of the subgraph.

###### Proposition 2.2.9.

Suppose that . Suppose further that , that  and  are balls of radius  with centers at vertices  and  respectively, and that  is the subgraph of  induced by vertices of  and . Finally, suppose that  is a subgraph of , and  is a graph isomorphism of  and . Then the restrictions of  to  and  have equal orientations.

###### Proof.

Let us assume that for some , that is,

 φ(x)=φ(0)+x′, φ(x+z)=φ(z)+x′′, x′≠x′′.

Proposition 2.2.5 implies that

 φ(rx)=φ(0)+rx′, φ(rx+z)=φ(z)+rx′′.

Since  is an edge of , we have the inequality

 ||φ(rx+z)−φ(rx)||⩽||A||.

But

 ||φ(rx+z)−φ(rx)||=||r(x′′−x′)+φ(z)−φ(0)||⩾
 r||x′′−x′||−||φ(z)−φ(0)||⩾r−||A||>||A||,

###### Corollary 2.2.10.

In the assumptions of Proposition 2.2.9, if we additionally have , then  for all integer .

Informally this corollary can be restated as follows: if one of the balls has its center on the “line” that corresponds to a primary direction of another ball, then in any embedding the “lines” that correspond to this direction in both balls must be aligned.

###### Proof.

Only the case  is uncovered by the Proposition 2.2.5. Applying this proposition to  we have . But

 χφB′r(z)=−χφB′r(−z)=−(φ(0)−φ(z))=φ(z)−φ(0).

After substitution and transfer of  to the left-hand side we obtain the desired equality.

###### Corollary 2.2.11.

Suppose that . Further, let  be a connected subset of vertices of , and  is the subgraph of  induced by the set

 ⋃x∈MV(Br+x).

Finally, suppose that  is a subgraph of , and  is a graph isomorphism of  and . Then restrictions of to have equal orientation for all .

We will write  for the orientation of restriction of  to any ball when Corollary 2.2.11 is applicable.

### 2.3 Lattices induced by primary and secondary elements

Before proceeding, let us point out a simple fact.

###### Proposition 2.3.1.

Suppose that  is a vertex of , and  is a non-negative integer that satisfies . Then  is a subgraph of .

###### Proof.

Each vertex  of the graph  can be represented as , where , hence , which implies . Further, both subgraphs are induced, thus .

Now, let us show that each automorphism of a large enough ball is additive on sums of primary elements of .

###### Lemma 2.3.2.

Suppose that . Denote , and put . Suppose that  is an integer,  is an automorphism of , and , …,  are non-negative integers which sum does not exceed . Then the following equality holds:

 φ(α1a1+…+αsas)=α1φ(a1)+…+αsφ(as).
###### Proof.

Consider a linear combination

 v=α1a1+…+αsas

that satisfies the premise of the lemma. Without loss of generality, let us assume that  is the largest among the coefficients . Put , and

 t=α′1+α2+…+αs.

Note that . Indeed, if  is at least , then the claim is obvious. Otherwise we have , and  for all , thus

 α′1+α2+…+αs<(s−1)r0=r−r0.

Put . Let us construct a path , …,  in  from  to  as follows. Start from the zero sum . To transfer from  to , choose a primary element  and put , thus increasing -th coefficient of the sum by 1. At each step we choose  in such a way that no coefficient of  exceeds the corresponding coefficient of . The process stops once  (obviously, this will take  steps).

Suppose that after  steps we have . Let us show by induction that for each  from 0 to  we have

 φ(ui)=β1φ(a1)+…+βsφ(as).

The base case  is trivial. Let us ensure correctness of the inductive step from  to . Without loss of generality, we will assume that , then we have to prove

 φ(ui+1)=(β1+1)φ(a1)+…+βsφ(as).

Note that , thus by Proposition 2.3.1  is a subgraph of . Further, since  is a connected set of vertices of , by Corollary 2.2.11 the restrictions  and  have the same orientation, hence

 φ(ui+1)−φ(ui)=φ(ui+a1)−φ(ui)=φ(0+a1)−φ(0)=φ(a1),

because . After adding this to the representation of  as a linear combination of , …, , we obtain the induction claim for , which proves the claim for all  from 0 to .

Now we have , and . We also have , thus  is a subgraph of . Since the restriction  has the same orientation as , by Proposition 2.2.5 we obtain

 φ(v)−φ(ut)=(α1−α′1)φ(a1).

After adding this to , we obtain the claim of the lemma.

Suppose that . Let  denote the set of vertices of  that are representable as a sum of primary elements in the sense of Lemma 2.3.2. Since for any  and each primary  the element  is also primary, Lemma 2.3.2 implies that .

###### Lemma 2.3.3.

There is an integer  such that for each integer  and each  there is a linear map  with  for all .

###### Proof.

Since  has full rank in , we can choose a basis of  among elements of ; let , …,  denote elements of the basis. Any element  is representable as a rational linear combination of :

 a=α1ai+…+αkak.

After multiplying by a common denominator, we obtain:

 Ka=β1a1+…+βkak,

where  and all  are integers. Put . Invoking Lemma 2.3.2 for a ball of radius  and the equality

 Ka−β1a1−…−βkak=0,

we obtain that

 Kφ(a)−β1φ(a1)−…−βkφ(ak)=φ(0)=0.

Division by  and a transfer to the right-hand side yields

 φ(a)=α1φ(ai)+…+αkφ(ak).

Choose  as the largest value of  for all , then the linear map  induced by the values of

on vectors

, …, agrees with  on all elements of  once , thus by Lemma 2.3.2 it must agree with  on all elements of .

Let  denote the set of all secondary elements of .

###### Proposition 2.3.4.

If , and  satisfies , then for each secondary element  the element is secondary as well.

###### Proof.

The graph  is a subgraph of , hence by Proposition 2.2.5 the map  permutes , thus it must also permute .

Let  denote the ball of radius  in the Cayley graph  of the additive group generated by . Trivially, for each  the graph  is a subgraph of . We will write  for the length of the shortest path between 0 and  in the graph .

###### Lemma 2.3.5.

Suppose that . Then the restriction of any automorphism  to  is an automorphism of .

###### Proof.

We have to prove  for all , and  for all .

Suppose that . Consider a shortest path in  from 0 to , denote its vertices , …, with , and  for all integer  from 0 and . For each vertex  we have

 ρ(ui)⩽ρ′(ui)⩽t⩽r−r0,

hence Proposition 2.3.4 implies . Thus there exists a path , …, between  and  that has length at most  and consists exclusively of transitions by elements of , therefore .

Similarly, consider an edge . The above reasoning implies that . Since  is an edge of , we have that . By invoking Proposition 2.3.4 once again we obtain that