The Shortest Path Problem for the Distant Graph of the Projective Line Over the Ring of Integers

The distant graph G=G(P(Z),△)\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$G=G({\mathbb {P}}(Z), \vartriangle )$$\end{document} of the projective line over the ring of integers is considered. The shortest path problem in this graph is solved by use of Klein’s geometric interpretation of Euclidean continued fractions. In case the minimal path is non-unique, all the possible splitting are described which allows us to give necessary and sufficient conditions for existence of a unique shortest path.


Introduction
The projective line P(R) over any ring R with 1 can be defined using admissible pairs [1]. For some rings, for example for commutative ones, it is equivalent to using unimodular pairs.
One of the basics concerning the projective line over ring P(R) is the distant relation on the set of points. A pair (x,ȳ) ∈ P(R)×P(R) is in the distant relation if the matrix [x , y ] ∈ G L 2 (R) for any choice of admissible elements x ∈x and y ∈ȳ. Here, and in the sequelx := Rx for all admissible x ∈ R 2 . In that way one defines distant graph G = G(P(R), ) for any ring P(R) [4]. The vertices of the distant graph on P(R) are the points of P(R), the edges of the graph are the undirected pairs of distant points. The distance function dist (x,ȳ) is the minimal number of edges needed to walk from x toȳ. The diameter of the G is the supremum of all distances between its points. The notion of the distant relation was introduced in the nineties of the previous century (see e.g. [6]). Blunck and Havlicek explored this notion later in [2,3]. They gave for instance the necessary and sufficient condition for the distant graph to be connected.
We consider the projective line over Z . In this case, points of P(Z ) are cyclic modules Z (a, b), where (a, b) ∈ Z × Z is a unimodular pair. From Z being a G E 2 ring follows the connectedness of the distant graph [2], but nothing can be said about its diameter. In this paper, we give a simple direct proof that the distant graph of the projective line over Z has the infinite diameter.
The aim of this paper is to analyse paths in the distant graph G(P(Z ), ) and solve the shortest path problem for it.
The main tool in our considerations is the transition algorithm introduced in [8] (see also [9]) for bases of Z 2 in order to investigate some kind of Markov partitions of automorphisms of the two-dimensional torus. This is in fact the reinterpretation of Klein's geometrization of continued fractions (see e.g. [7]).
The distant graph of a ring is defined in terms of "homogenous" ring coordinates. However, our statements follow from affine setup, hence we present in Sect. 2 the transition algorithm on Z × Z ⊂ R 2 . This is a repetition of [8] but we do it for seek of completeness.
In the next section, we adopt this algorithm to the language of the projective line. Then we make use of it to find the shortest paths connecting given two non-adjacent vertices. It also allows us to provide necessary and sufficient conditions for existence of exactly one shortest path between them.
For any non-adjacent verticesx ,ȳ ∈ G(P(Z ), ) we define so called cone relations on P(Z )\{x,ȳ} with precisely two equivalence classes. Any path entirely contained in one of this classes is called a consistent path. We prove that in each of the equivalence classes of the cone relation there is precisely one shortest path connectingx andȳ (Theorem 1). All vertices of those two paths together withx andȳ form the set of vertices of some subgraph, called by us the Klein graph K (x,ȳ).
If we abandon the assumption of consistency then the issue becomes more complicated. It turns out that in general there may be lots of shortest paths between two non-adjacent vertices. Nevertheless we prove that there is at least one shortest path which is contained in some induced subgraph of K (x,ȳ) called by us a corner graph. This observation allows us to give a recipe to find one of the shortest paths. Consequently, we obtain the formula for the distance dist(x,ȳ) between two vertices (Theorem 2).
Further, the careful insight into the corner graph enables to formulate the necessary and sufficient conditions for the existence of more than one shortest path (Theorem 3).
In [2], Blunck and Havlicek code a path connecting any pair of elements from connected component of the distant graph of a ring R as a product of elementary matrices.
In our modification, this product is a decomposition of an element of PG L(2, R) transforming the first pair of elements of the path onto the last one. In the last section, we get from this factorization the formula for the distance in the distant graph in algebraic language. We hope that this algebraic approach allows us to generalize the results to some wider class of rings, for instance to discretely ordered ones.

Basic Tools: Klein Sails and Fans of Bases
Formally P(Z ) is a set of cyclic modules Z (a, b) generated by unimodular pairs (a, b) ∈ Z × Z . To follow all considerations of this paper, it is convenient to lift the projective line to Z 2 understood as the subset of the plane R 2 .
Every two elementsx,ȳ ∈ P(Z ) determine two lines k, l ⊂ R 2 , respectively. Both lines contain the origin and other integer points, hence, are rational. They divide the plane into four closed quadrants. In each of them consider the boundary of the closed convex hull of all integer points distinct from the origin. This boundary is a infinite polyline. It splits into three parts. Two of those parts are contained in lines k and l and the middle one has precisely one common point with each of those lines (see Fig.1). This part is called a Klein sail. A similar construction may be carried out for irrational lines as well. The difference is that one gets a single polyline having no common points with the lines and asymptotic to them. Klein considered those polylines as geometrization of continued fraction expansions of irrational numbers.
By construction every integer point lying on any of Klein sails form a unimodular pair in Z × Z . We will be interested in the set of those points since every shortest walk betweenx andȳ must be contained in the set of Z -modules generated by them. The set of integer points on Klein sails may be found by use of the so called transition algorithm developed in [8] (see also [9]) for bases of Z × Z in order to investigate some kind of Markov partitions of automorphisms of the two-dimensional torus. Fix x ∈x and y ∈ȳ and consider k and l as horizontal and vertical axes positively directed by x and y. This gives us the enumeration of four quadrants determined by k and l. To start the transition algorithm first find, using the Extended Euclidean Algorithm, the bi-sequence (c n ) n∈Z of all vectors with det[x, c n ] = 1 enumerated in such a way that c n+1 = c n − x. If y ∈ {c n } then stop the algorithm. Otherwise there is precisely one n 0 ∈ Z such that c n 0 is in the first quadrant and c n 0 +1 is in the second one. Denote e 1 := c n 0 and f 1 := c n 0 +1 . Obviously β 1 = (e 1 , f 1 ) forms a basis in Z × Z (see the remark after Lemma 1). Assume the β k = (e, f) is a basis in Z × Z with e in the first quadrant and f in the second one. If y = e + f then the algorithm stops. Otherwise put β k+1 = (e + f, f) if e + f lies in the first quadrant and β k+1 = (e, e + f) lies in the second one.
If the set of bases {β k } were infinite then norms of their vectors would tend to infinity while the areas of parallelograms spanned by them would stay equal to 1, hence the angles would tend to 0 or π . In our construction, they converge to 0 since the angles are decreased step by step. It follows that y lies in the interior of the parallelogram spanned be vectors of β k for large enough k, which is a contradiction (see the remark after Lemma 1). Therefore, the algorithm eventually stops necessarily on y.
In order to translate the above algorithm in terms of the projective line we note that it can be rewritten in the following way. First we may assume that e 1 + f 1 is in the first quadrant. The other case is completely symmetric. If e 1 + f 1 = y then the algorithm stops. Otherwise we add f 1 to e 1 so many times until the resulting vector stays in the first quadrant. We get the finite sequence of vectors (e A 0 := e 1 , e 2 , . . . , e a 1 +1 =: e A 1 ). By construction f 2 := e A 1 + f 1 lies in the second quadrant. Then we keep adding e A 1 to f 1 so many times until the resulting vector stays in the second quadrant. We get the finite sequence of vectors (f B 0 := f 1 , f 2 , . . . , f b 1 +1 =: f B 1 ). Then we repeat the construction until the summation of vectors is equal to y.
We have constructed two sequences of vectors and where A k = k n=0 a n , k = 0, . . . , r + 1, and B k = k n=0 b n , k = 0, . . . , l + 1. Here a 0 = a r +1 = b 0 = b l+1 = 1. Those two sets together with x and y we will project to the projective line and the resulting set of vertices with appropriate edges we will call a Klein graph which is the main tool of this paper. The notion of a Klein graph does not depend on choice of representative elements ofx andȳ since opposite Klein sails are symmetric with respect to the origin.

Basic Tools in Terms of the Projective Line
This section is devoted to presenting the material of the previous one in terms of the projective line. This allows us to conduct all considerations independently on choice of representative elements of vertices in the projective line.
Having two distinct elementsx,ȳ ∈ P(Z ) we define an equivalence relation on P(Z )\{x,ȳ}:ū Since each of vectors in the inequality appears twice, the relation is well defined. Each such relation is called a cone relation.
For two vectors x, y ∈ Z 2 denote positive and negative cones in R 2 by Every cone relation has two equivalence classes being images of by the canonical projection from Z 2 \{(0, 0)} onto the projective line. The basic property of those relations is the following lemma proved in [8]: ȳ then either {x,ȳ} = {x ,ȳ } or precisely one equivalence class of each cone relations ∼ {x,ȳ} and ∼ {x ,ȳ } is contained in the equivalence class of another cone relation.
The above lemma may be expressed in various ways. It is, for example, equivalent to the fact that the interior of the parallelogram spanned by members e, f of any basis in Z 2 contains no vectors from Z 2 . In other words the only vectors in the closed parallelogram spanned by e and f are its vertices. By Pick's formula this is equivalent for this parallelogram to have area equal to one. This is in turn equivalent to the equality where [e, f] stands for the matrix with columns equal to e and f respectively.
We will need also the following obvious observation.
In graph theory, a set of vertices is called a clique if its elements are pairwise adjacent. From Lemma 1, one can easily deduce the following corollary.
Corollary 1 1. Any maximal clique in P(Z ) has exactly three elements.

Every pair of adjacent vertices belongs to precisely two maximal cliques.
3. If {x,ȳ,ū} and {x,ȳ,v} are two maximal cliques then It is not difficult to find maximal cliques for every pairx ȳ. Indeed {x,ȳ, x + y} and {x,ȳ, x − y} are the only maximal cliques containingx andȳ. Now we will express the transition algorithm described in the previous section in terms of the projective line. We do this to demonstrate that the notion of Klein graph is really a projective notion as well as to establish some notation used later in the paper. The concept of the Klein graph is a main tool of the next two sections used to find shortest paths connecting an arbitrary pair of vertices of the distant graph.
Using the Extended Euclidean Algorithm find a sequence (c n ) n∈Z of all vertices of the distant graph adjacent tox. The sequence (c n ) n∈Z may be ordered in such a way that {c n ,c n+1 ,x} is a clique for every n ∈ Z . Ifȳ ∈ (c n ) then stop.
If not, there is precisely one n 0 ∈ Z such thatc n 0 {x,ȳ}cn 0 +1 . Denotec n 0 and c n 0 +1 byē 1 andf 1 arbitrarily. By 1. and 2. of Corollary 1 there is precisely oneḡ 2 =x such that In the sequel of this paper we assume the case (TR). The other case is completely symmetric. It means that considering (TL) instead of (TR) we have to mutually exchange all notations. For instance we exchange symbolsē j andf j . Later on we introduce some numbers r , a j , A j associated to verticesē j and l, b j , B j associated to verticesf j . We also must exchange them considering the case (TL) instead of (TR).
If not, denote the above vertex byf 2 and repeat the same construction withē a 1 +1 andf 2 playing the role off 1 andē 2 , respectively. We get the sequence (f 2 , . . . , Then repeat the above construction withē a 1 +1 andf b 1 +1 playing the role ofē 1 andf 1 , respectively. The transition algorithm is depicted in Fig. 1   Since all lines in R 2 determined by members of P(Z ) are rational our algorithm eventually stops after reachingȳ as we have shown in the previous section. We have constructed two sequences of vertices: This is caused by the fact thatē A r andf B l are both adjacent toȳ so we also haveē A r +1 =f B l+1 =ȳ.
By construction both sequences are contained in different equivalence classes of ∼ {x,ȳ} and two consecutive vertices in each of them are adjacent. Verticesē A k andf B k , excludedȳ, will be called corner vertices. Note that by construction r − l ∈ {0, 1}.
Two sequences constructed in the above algorithm may be organized as a sequence of adjacent pairs of vertices.
To the set of vertices defined above addx andȳ. The resulting set with appropriate edges is an induced subgraph of the distant graph and will be called a Klein graph associated tox andȳ. Denote it by K (x,ȳ). If we consider only corner vertices in this graph we get an induced subgraph which we will call a corner graph and denote by K (x,ȳ). The Klein graph is depicted in Fig. 2. All vertices of the corner graph are marked in black. The bolded edges are edges of the standard path to be defined in the beginning of Sect. 5.

Consistent Paths
Definition 1 A path connectingx andȳ in the distant graph is called consistent if all its elements butx andȳ are contained in the same equivalence class of ∼ {x,ȳ} .
The length of the shortest consistent path betweenx andȳ is denoted by d c (x,ȳ).  Proof Takex,ȳ ∈ P(Z ). Consider the path where verticesē 1 , . . . ,ē A r are taken from the transition algorithm described in the previous section. It is by construction consistent. Take another consistent path p =p(x,ȳ) = {x =z 0 ,z 1 . . . ,ȳ} contained in the same equivalence class C of ∼ {x,ȳ} as p. We will show that p ⊂p. The set C\{ē 1 , . . . ,ē A r } is a disjoint union of equivalence classes C k of cone relations ∼ {ē k ,ē k+1 } , k = 0, . . . , A r (hereē 0 =x). Ifē 1 =z 1 ∈p we are done. Otherwisē z 1 ∈ C 0 . It follows from the fact thatē 1 is the last vertex in the sequence of adjacent tō x vertices contained in C and moreover by Lemma 1, all other vertices in this sequence contained in C belong to C 0 . We have eitherz 2 =ē 1 or, again by Lemma 1,z 2 ∈ C 0 . Eventually we getē 1 =z k ∈p ∩ p because we have to go out of C 0 in order to getȳ. Assumingz k =ē l we are able to show, by the same arguments as above, thatē l+1 ∈p which shows that p ⊂p. Therefore p is a unique shortest consistent path betweenx andȳ contained in C. When computing the length of p we have to count steps between e 1 andē A r whose number is A r − 1 and add one step betweenx andē 1 and another one betweenē A r andȳ. We have finished the proof of 1. Now 2. and 3. immediately follows from 1.

Definition 2 A Hamiltonian cycle
is a union of two consistent paths connectingx and y.
Formally to run the transition algorithm we have to fix both verticesx andȳ. But actually we may fix onlyx and arbitrary finite sequences of positive integers (a n ) and (b m ) whose lengths differ by one. Then we may run the transition algorithm starting from the longer sequence. After using all numbers a n and b m we get two last corner verticesē A r andf B l . Then letȳ be such that it forms a clique with these corner vertices andē A r {x,ȳ}fB l . The above consideration gives the following.

Corollary 2 For everyx ∈ P(Z ) and every positive integers d > 2, d a and d b with d = d a + d b there exists a Hamiltonian consistent cycle containingx whose length is equal to d. Moreover there isȳ ∈ P(Z ) such that d a = d a (x,ȳ) and d b = d b (x,ȳ).
Note that one can eliminateȳ from the cycle and get again a Hamiltonian one. In this way one is able to construct decreasing sequence of Hamiltonian cycles containingx that lengths decrease by one. Of course the shortest such cycle has length 3 and forms a clique. In the forthcoming paper it will be shown how to construct all such sequences of Hamiltonian cycles.

Non-consistent Paths
While, as has been shown in the previous section, there are at most two shortest consistent paths between two vertices in the distant graph of the projective line over Z , it turns out that in general you can find many shortest paths if we abandon the assumption of consistency.
In order to compute the length of a shortest path between two verticesx,ȳ ∈ P(Z ) first run the transition algorithm described in Sect. 3 assuming the case (TR). Then it is convenient to consider the following path which exhaust all vertices of the corner graph: depending on whether r = l or r = l + 1. Denote this path by p s (x,ȳ) and call it a standard path betweenx andȳ (see Fig. 2). Let us agree that the verticesē A k lie on the right side of the corner graph and the vertices off B k lie on its left side. The direct insight into the graph K (x,ȳ) gives the following result.

Lemma 3 The length of the standard path between non-adjacentx andȳ is equal to
The key observation of this section is the fact that if want to make a shortest walk fromx toȳ then we have to use only vertices of K (x,ȳ) but we may also use only vertices of K (x,ȳ).

Lemma 4 Every shortest path betweenx andȳ is a subgraph of K (x,ȳ). Moreover among all the shortest paths at least one is a subgraph of K (x,ȳ).
Proof We intend to show that having a pathp fromx toȳ one can find a path fromx toȳ contained in K (x,ȳ) which is not longer thanp.
Let thenz ∈p\K (x,ȳ). We have eitherz ∼ {x,ȳ}ē1 orz ∼ {x,ȳ}f1 . Assuming the former case we can find precisely one k withz ∈ C k , where C k are taken from the proof of Theorem 1. By Lemma 1 all vertices adjacent toz belong to C k ∪ {ē k ,ē k+1 }. Therefore the predecessor as well as the successor ofz inp are contained in the same set, hence {ē k ,ē k+1 } ⊂p. Sinceē k ē k+1 , we may shortenp rejecting all vertices fromp ∩ C k . We argue analogically in the latter case.
Assume now thatp is one of the shortest paths betweenx andȳ. We already know thatp ⊂ K (x,ȳ). Let 1 ≤ m ≤ r and A m < k < A m+1 be such thatē k ∈p. In general we have alwaysē Am+1 ∈p since we can not omitē Am+1 ∈p walking from e k toȳ. Walking fromx toē k we must go throughf B m orē A m sof B m ∈p orē A m ∈p. Sincef B m ē Am+1 andp is one of the shortest paths,f B m / ∈p andē A m+1 ∈p. We know thatē Am f B m ē A m+1 is a path in K (x,ȳ) of the length 2, hence there are no other vertices betweenē Am andē A m+1 butē k . We may replaceē We analogically considerf k ∈p instead ofē k which ends the proof. Now let us ponder the question when the standard path is one of the shortest between x andȳ. Let The other case is if all numbers c k , k = 1, . . . , r + l, are distinct from 0 (which is equivalent to c 2 = 0) and all but c 1 or c r +l are greater than 1. In such a situation no pairs (ē A k ,ē A k+1 ), k = 1, . . . , l − 1, (f B k ,f B k+1 ), k = 0, . . . , r − 2, are adjacent.

It means that the shortest walk fromē
We have shown the following.
Note that even c 1 = 1 or c r +l = 1 the standard path remains one of the shortest ones. Indeed, if c 1 = a 1 = 1 thenē 1 ē 2 , hence there are two shortest paths fromx tō e 2 , namelyx One can ask what is a necessary and sufficient condition for the Klein graph K (x,ȳ) so that the standard path is the only shortest one. The above considerations immediately convince us that first of all we must have c 1 > 1 and c r +l > 1. We must also have c k > 1 for k = 2, . . . , r + l − 1 to assure that the standard path is one of the shortest ones. Assume now that c k = 2 for some k ∈ {2, . . . , r + l − 1}. If c k = a j then We have just shown that the necessary and sufficient condition is the following.
Let us now consider a case when the standard path is not the shortest one. We already know that this is equivalent to On the other hand, by Lemma 4, to compute the length of the shortest path between x andȳ it is enough to find the shortest one contained in the corner graph associated with those two vertices.
The considerations similar to those above allow us to give a recipe for finding one of the shortest paths in K (x,ȳ). First assume the following convention: walking along the standard path we say that we meet the number a k+1 or b k+1 if we are in the vertex e A k orf B k , respectively. Then the recipe is the following: start fromx and walk along the standard path until you meet the number one. Then walk along the consecutive vertices on the same side of the corner graph. Once you meet the number different from one you come back to the standard path. Perform this procedure till you reach e A r orf B l . Then make one step more to end atȳ. In the sequel the path we have just described is called a standard shortest path.
To compute the distance betweenx andȳ it is left to determine by how many steps we shortened the standard path. For the first observe that if r = l then we never meet a 1 nor b l and if r = l + 1 then we never meet a 1 nor a r . Every other appearance of the number one in the "proper" place results in shortening of the standard path by precisely one step. It is possible to shorten the standard path by one step in precisely two cases: 2. b k > 1 and a k = 1.
The first case always works. To decide whether 2. works or not we must check if it satisfies some additional condition. Put and t k = max{ j : a k−1 = . . . = a k− j = 1} : a k−1 = 1, 0 : Then 2. results in shortening iff s k ≤ t k . Now we are in position to determine by how many steps we shorten the standard path. To end this defineã k = a k : k = 2, . . . , l; max(a k , 2) : k = 1 (4) if r = l. If r = l + 1 the former condition remains unchanged and the latter one becomesb Now remove from {1, . . . , l} those k's that satisfy 2. with s k > t k and denote the received set by D = Dx ,ȳ . By the above consideration we see that we shorten the standard path by steps. The symbol · stands for the floor function.
Theorem 2 Assume thatx,ȳ ∈ P(Z ) are not adjacent. Then the length of the shortest path connectingx andȳ is equal to In particular, G(P(Z ), ) is of infinite diameter.

Uniqueness of the Shortest Paths
In this section we formulate necessary and sufficient conditions for the existence of more than one shortest path between two vertices. In the previous section we described the construction of one of the shortest paths between two non-adjacent vertices. This path may split, but need not to, into more shortest paths because of appearance of 1 or 2 in the sequence (c 1 , . . . , c r +l ). Two next lemmas explain the situation. First we deal with ones. We say the two blocks of 1's overlap if there are natural numbers 0 ≤ l 1 ≤ l 2 ≤ l + 1 and 0 ≤ r 1 ≤ r 2 ≤ r + 1 satisfying (o1) l 1 < r 1 ≤ l 2 + 1 ≤ r 2 with l 2 < l + 1 iff r = l + 1 or (o2) l 1 < r 1 ≤ l 2 = r 2 = r + 1 = l + 1 or  Proof First note that 1 in (c 1 , . . . , c r +l ) causes splitting of any path p contained in the Klein graph iff it appears in one of the following configurations depicted in Fig. 3: In particular to split the shortest path 1 has to appear in both sides of the Klein graph. Then fix some block B of 1's in the left side of the Klein graph: b l 1 = · · · = b l 2 = 1, where 0 < l 1 ≤ l 2 < l. Then imagine that we "shift" some block A of 1's in the right side: a r 1 = . . . = a r 2 = 1, where 0 < r 1 ≤ r 2 < r . We want to assure that meeting of those two blocs results in splitting the shortest path.
Assume that |A| = r 2 − r 1 + 1 ≤ |B| = l 1 − l 2 + 1. Then in order to gain the configuration (s1) or (s2) that causes splitting we must have Indeed, if neither of the above conditions holds then there are three possibilities. Two of them are l 2 + 1 < r 1 or l 1 > r 2 . In this cases neither (s1) nor (s2) holds. The last case is r 1 > l 1 and l 2 ≥ r 2 . This forces |A| < |B| and appearance of (s1) and (s2). Nevertheless this does not cause splitting because the standard shortest path has as a part the pathf B l 1 −1 f B l 1 · · · f B l 2 . Walking along this part we do not "jump" onto the right side of the Klein graph although we meet 1's in configuration (s1) and (s2). Therefore we are not able to gain splitting. Together with |A| ≤ |B| the former condition gives (o1) and the latter one gives (o4). Similarly, if |A| ≥ |B| then we must have Together with |A| ≥ |B| the former condition gives (o1) and the latter one gives (o4). Until now we have assumed that our blocks neither start nor end atx andȳ. Now we assume opposite.
Next let r = l and r 2 = l 2 = r . Then in order to have splitting we must have l 1 < r 1 which is (o2). If l 2 = l = r = r 2 then r 2 < r which is equivalent to r 2 < r + 1. Moreover we must have r 1 ≤ l 1 ≤ r 2 . This gives the additional condition in (o4). If l 2 = l = r = r 2 then l 2 + 1 ≤ r 2 and we must have l 1 < r 1 ≤ l 2 + 1 which is (o1). Now assume that r = l + 1. First consider r 2 < r . Then r 2 < r = l + 1 = l 2 and in order to guarantee splitting we must have r 1 ≤ l 1 ≤ r 2 . This gives (o4). If r 2 = r + 1 then to obtain splitting the standard shortest path has to end in the right side of the Klein graph. Therefore if r 1 ≤ l 1 then l 2 ≤ l + 1 < r 2 = l + 2 and we get (o5). On the other hand if r 1 > l 1 then we must have r 1 ≤ l 2 + 1 and we have to "jump" into the right side of the Klein graph which forces l 2 < l + 1. This is the additional condition in (o1).
There is left one case. Namely, c 1 = · · · = c r +l = 1. In this case it obvious that one has splitting iff r = l.
We have considered all possible configurations of two blocks of 1's that result in splitting. Since we get all conditions (o1)-(o5) and each of them obviously forces splitting, we have finished the proof.
Another reason of splitting is appearance of 2 in this sequence. By direct insight into the graph K (x,ȳ) we get the following result. where the numbers s k and t k in the above are defined in (2) and (3).
Proof Note that if b k = 2 then necessary and sufficient condition to split the standard shortest path is that it contains verticesf B k−1 ,f B k andē A k (see the left side of Fig. 4). The standard shortest path containsf B k−1 iff k > 1 and a k > 1 or k = 1 even if a 1 = 1. It necessarily containsē A k since b k = 2 > 1. The standard shortest path containsf B k iff a k+1 > 1. Now assume that a k = 2. Then necessary and sufficient condition to split the standard shortest path is appearance of verticesē A k−1 ,f B k−1 andē A k (see the right side of Fig. 4). The vertexē A 0 =ē 1 is never contained in the standard shortest path so k must be greater than 1. The vertexē A k−1 appears in it iff s k ≤ t k . This path necessarily containsf B k−1 since a k = 2 > 1. Then we see thatē A k appears in the standard shortest path iff b k > 1.
Observe that in the both cases k must be less then r + 1. This gives range of k in the thesis of the lemma.
All discussion of this section and direct insight into the Klein graph convince us that the following statement is true.
Theorem 3 Assume thatx,ȳ ∈ P(Z ) are not adjacent. There is more than one shortest path betweenx andȳ if and only if -two blocks of 1's overlap or -r = l and all numbers a k and b k are equal to one or -one of the conditions of Lemma 6 holds.

Algebraic Representation of Paths in the Klein Graph
In [2] there is described a one-to-one correspondence between products of matrices of the form E(a) = a 1 −1 0 and paths in G = G (P(Z ), ). The length of a path is equal to the number of matrices in an associated product. This together with some relations in G E 2 (Z ) noted in [5] gives the algebraic method to find the shortest walks between arbitrary vertices of the distant graph. For any two non distant verticesx andȳ of the distant graph we express the method of finding the shortest path developed in Sect. 5 in terms of matrices form G E 2 (Z ). Fix two representative elements x ∈x and y ∈ȳ. In order to use the Blunck-Havlicek algorithm we establish as a standard basis in Z 2 the basis (x, f 1 ), where f 1 is defined in Sect. 2 for x and y. Let y represents as [ p, q] in the above basis. Then by construction q/ p ≥ 1. The (TR) case of Sect. 3 requires y to have the slope not less then 2. If 1 ≤ q/ p < 2 then we change the basis to (−x, e 1 ). In this basis y represents as [q − p, q], hence it has the slope not less than 2.
The standard path fromx toȳ is associated by the Blunck-Havlicek algorithm with the matrix where q/ p = [d 0 ; d 1 , . . . , d n ] is a continued fraction expansion with d n > 1.
The number of matrices in the product in (7) may be reduced using the following two formulas E(a)E(±1)E(b) = ±E(a ∓ 1)(b ∓ 1).
There are two more formulas reducing a number of matrices in any product of matrices of the form (6), namely E(a)E(±2) 2 E(b) = ∓E(a ∓ 1)E(∓3)E(∓1).
Nevertheless, it is not difficult to see that after all possible reductions of (7) using (8) the expression from the left hand side of (9) does not appear in the resulting product. Any change of order of reductions may effect the resulting representation of A as a product of matrices of the form (6). In spite of this all representations that cannot be reduced any more have the same number of matrices since they all represent the shortest paths fromx toȳ.
We say that a matrix A represents a path fromx toȳ if in the basis described above for any choice x ∈x to y ∈ȳ the product given by the Blunck-Havlicek algorithm is equal to A.
By results of Sect. 5 the matrix given by (7) represents at least one shortest path fromx toȳ. There may be other matrices representing such a path. The situations is described in the below proposition whose thesis directly follow from analysis of the Klein graph.

Proposition 3
There are at most two matrices representing the shortest paths fromx toȳ, among them there is always a matrix A given by (7).
If there are two matrices representing the shortest paths fromx toȳ then the other one is equal to