Introduction

Deterministic models have unique advantages in improving our comprehension about some important physical mechanisms in complex networks. Especially, in comparison with the empirical and random models, the solutions of deterministic graphs can be obtained by rigorous derivation and the computation is ended by a small amount of calculation. A lot of deterministic models have been created imaginatively and studied carefully, which are inspired by simple recursive operation1,2 or the techniques of plane filling3 or generating processes of fractal4 or even the relationship between natural numbers5. The models always have important properties similar to random models, such as scale-free and small-world and high clustered, thus it could be used to imitating empirical networks appropriately. Recently, on the basis of the classical Farey sequences, Zhang et al. introduced Farey graphs in ref. 6. Farey graphs are simultaneously minimally 3-colorable, uniquely Hamiltonian and maximally outer-planar and perfect6,7. The merger of three Farey graphs coincide with the network created by edge iterations8, or evolving networks with geographical attachment preference9, or the general geometric growth model for pseudofractal scale-free web with parameter q = 2 and m = 110. The combination of six Farey graphs generated the networks with multidimensional growth11. The graphs in refs 6, 7, 8, 9, 10, 11 are named as Farey graphs here for they are all composed on the basis of Farey graphs. Many properties of Farey graphs are comparable to those of networks associated with technological and biological systems with a high clustering and small-world, like some electronic circuits and protein networks.

Networks are very often studied considering branch of discrete mathematics known as graph theory. One active subject in graph theory is graph labelling. This is not only due to its theoretical importance but also because of the wide range of applications in many fields, such as crystallography, coding theory, circuit design and communication design12. Finding shortest paths in networks is a well-studied and important problem with also many applications. The all-pairs shortest paths (APSP) problem is unquestionably one of the most well-known problems in algorithm design, frequently studied in textbooks; yet, the complexity of the problem has remained open to this day. For arbitrary dense (directed and undirected) real-weighted graphs, the classical algorithms run in sub-cubic time O(|V|3−δ), where δ > 013. The K shortest path routing algorithm is an extension algorithm of the shortest path routing algorithm in a given network14. The algorithm not only finds the shortest path, but also K − 1 other paths in order of increasing cost. K is the number of shortest paths to find. If the shortest path is not unique and K is small enough, the K shortest path routing algorithm in Farey graphs will shrink to finding out all the shortest paths.

The labelling and the routing in several deterministic models, on the basis of the relationship between vertices labels and the shortest paths, have been pioneered by Comellas and Zhang12,15,16. The graphs of which have some important properties similarly as empirical networks, for example, the expanded Apollonian networks are simultaneously scale-free, small-world, Euclidean, space filling and with matching graphs12. Only by their labels, one of the shortest paths between any pair of vertices is determined just by simple rules and few computations12,15,16.

However, the research on the label-based routing for a family of Farey graphs is still lacking. We are inspired by refs 12, 15 and 16 and give a vertex labelling for Farey graphs in this paper, so that queries for all the shortest paths between any two vertices can be efficiently answered thanks to it. It is the first algorithm that calculates all the shortest paths routings of a kind of deterministic graphs. Our labelling may be useful in aspects such as network optimization, information dissemination and so on, which are directly related to the problem of finding shortest paths between all pairs of vertices of the network and which may be of interest to understand the underlying mechanisms that have shaped their particular structure.

Results

Generation of Farey graphs

The generation of Farey graphs is shown as below.

Definition 1. The Farey graphs F(t) = (V(t), E(t)), t ≥ 0, with vertex set V(t) and edge set E(t) are constructed as follows6:

  • For t = 0, F(0) has two initial vertices and an edge joining them.

  • For t ≥ 1, F(t) is obtained from F(t − 1) by adding to every edge introduced at step t − 1 a new vertex adjacent to the end vertices of this edge (see Fig. 1a).

    Figure 1
    figure 1

    Farey graphs produced at iterations t = 0, 1 and 2.

    (a) Farey graphs F(t). (b) Farey graphs N(t) for q = 2 and m = 1. (c) Farey graphs DMG(t).

Definition 2. The Farey graphs N(t) are generated as follow:

  • For t = 0, N(0) has three initial vertices and an edge joining any two vertices.

  • For t ≥ 1, by linking a new vertex to the two vertices of every edge adding at step t − 1, N(t) is deduced from N(t − 1) (see Fig. 1b).

Remark 1. The model is starting from three edges of a triangle; it is exactly the graphs created by edge iterations N(t)8, or evolving networks with geographical attachment preference9, or a general geometric growth model for pseudofractal scale-free web with parameter q = 2 and m = 110.

Definition 3. When the model is starting from six edges of a regular tetrahedron, the Farey graphs DMG(t) are obtained by the same construction mechanism (see Fig. 1c)11.

Farey graphs are obviously generated by starting from an edge with two vertices. From the construction method, it is easy to get the number of vertices adding to graphs at step t which is Δnt = 2t−1, so that the order and size of Farey graphs are |V(t)| = 2t + 1 and |E(t)| = 2t+1 + 1, respectively. The cumulative degree distribution of F(t) follows an exponential distribution with and the degree correlations knn(δ) is approximately a linear function of δ, which suggests that Farey graphs are assortative. The average paths length, which is μ(F(t)) = [(6t − 5) × 22t + (6t + 17) × 2t + (−1)t + 5]/[9 × 2t × (2t + 1)], is in direct proportion to the logarithmic scale of the network’s order, so that Farey graphs is with a characteristic of small-world.

When t ≥ 2, any new vertex adding to F(t) at step t will link to two vertices: a mother vertex and a father vertex. The mother joins in graph at step t − 1, while the father adds to graphs at step t − 2 or earlier. The two vertices with the same mother are called brothers.

By marking two initial vertices in F(t) with X and Y, all the vertices in F(t) can be divided into three groups by their distances to X and Y. Noticing that, the difference of the two distances is 0 or 1, for X and Y are neighbors. The vertices in the set Vx(t) (including X) have shorter distances from them to X than to Y, while the vertices in Vy(t) (including Y) have shorter distances to Y than to X, if the distances are equal, vertices are all in Vxy(t). That is to say, . From definition 1 and the classification of vertices above, if two copies of F(t) are named as F1(t) and F2(t), F(t + 1) is generated just by merging X1 and X2 into X and linking Y1 and Y2 directly. The schematic diagram is shown as Fig. 2a.

Figure 2
figure 2

Schematic illustration of the recursive construction of the Farey graphs.

(a) F(t + 1) is constructed of two copies of F(t). (b) N(t) is consisted of three copies of F(t). (c) DMG(t) is the merger of six copies of F(t).

The Farey graph N(t) is the combination of three Farey graphs marking with Fg(t) from Fig. 1(b), where g {0, 1, 2}, which is described as Fig. 2b.

For the networks with multidimensional growth are constructed from six edges of a regular tetrahedron, obviously DMG(t) is the consolidation of six Farey graphs Fq(t), where q {0, 1, 2, 3, 4, 5} and which is shown in Fig. 2c,

Labelling of Farey graphs

We here describe a method to label the vertices of F(t), such that all routing by shortest paths between any two vertices of F(t) are deduced from their labels.

Definition 4. The labelling of any vertex v in F(t) is performed according to the following rules:

  • Label the two initial vertices with labels 0.0 and 0.1.

  • At any step t ≥ 1, when 2t−1 new vertices are added and joined to F(t − 1), label them with labels from t.1 to t.2t−1 in clockwise direction.

Definition 5. The vertices in N(t) are labelled according to the following rules:

  • The three initial vertices are labelled with 0.0, 0.1 and 0.2.

  • Label the 3 × 2t−1 new vertices, which are joined to N(t − 1) at step t, with labels from g.t.1 to g.t.2t−1 in clockwise direction, where g {0, 1, 2} indicates which group the new vertex belongs to.

Definition 6. Label the vertices in DMG(t) as below:

  • Label the four initial vertices with 0.0, 0.1, 0.2 and 0.3.

  • For the 6 × 2t−1 new vertices which are joined to DMG(t − 1) at step t, the labels of them are from g.t.1 to g.t.2t−1 in a certain order, where the group indicator is g {0, 1, 2, 3, 4, 5}.

The labellings of F(6), N(2) and DMG(2) are illustrated in Fig. 3.

Figure 3
figure 3

Labels of all vertices in Farey graphs when t = 6, 2 and 2, respectively.

(a) Farey graphs F(6). (b) Farey graphs N(2). (c) Farey graphs DMG(2).

Routing protocol in F(t)

To find all the shortest paths between any two vertices in Farey graphs, the relationships between the labels of different vertices should be studied firstly. By the help of vertex labels, these relationships are explored by a quantitatively and precisely manner as follows. For convenience, the vertices labelling with 0.0, 0.1 and 1.1 in F(t) are marked as Y1, Y2 and X, respectively. The vertex with label 1.1 is denoted as the hub for it has the highest degree in F(t). Next, we give several properties about the above labelling (the proof of which will be described in the Method section). Assuming two arbitrary vertices in F(t) are labelled with ti.k and tj.l.

Property 1. (The family of ti.k)

  • When ti ≥ 1, the two children of ti.k are (ti + 1).2k and (ti + 1).(2k − 1).

  • When ti ≥ 2 and k is odd, the brother of ti.k is ti.(k + 1), else if k is even, the brother is ti.(k − 1).

  • When ti ≥ 2, the three vertices, vertex ti.k and its parents, shape a triangle. The mother is , the father is , in which is a function rounding the real number x toward negative infinity, rem(k, 2) keeps the remainder of k divided by 2, the integer l denotes the sum of one and the number of the continuous zeros from right to left in the binary sequence which is converted by the decimal number k − rem(k, 2). If ti ≥ tj, the ti − tj generations of maternal ancestor of ti.k is .

Property 2. (The neighbors of ti.k)

  • When ti ≥ 2, the set of neighbor vertices of ti.k is (ti + x).2x−1(2k − 1), (ti + x).[2x−1(2k − 1) + 1]}, where x {1, 2, ..., t − ti}.

  • The neighbors set of 0.0 is {ti.1}, where ti {0, 1, 2, ..., t}.

  • The set about 0.1 is , in which ti {1, 2, ..., t}.

  • The set of 1.1 is {0.0, 0.1, (1 + x).2x−1(2k − 1), (1 + x).[2x−1(2k − 1) + 1]}, x {1, 2, ..., t − 1}.

Property 3. If any pair of vertices ti.k and tj.l are located in different subgraphs F1(t − 1) and F2(t − 1) of F(t) respectively.

• The shortest paths between them pass the hub X if

(a). and ,

(b).or and ,

(c).or and ,

(d).or and .

• The shortest paths go through the two initial vertices Y1, Y2 and the edge between them, if

(a). and ,

(b).or and .

• The shortest paths go by X, or Y1 and Y2, simultaneously, if

(a). and ,

(b).or and .

Property 4. All the shortest paths between any pair of vertices are located in a minimum common subgraph (MCSG) which is denoted as Fmcsg(tmin). Moreover, one vertex is positioned in the outermost layer of a subgraph in Fmcsg(tmin), the other vertex is an initial vertex or a vertex seating in the p + 1 layer of the other subgraph , where η = 1, 2.

Here we give the shortest paths routing protocol between any two vertices in Farey graphs F(t). The algorithm of finding out the shortest paths is unique, as the routing is generated both from each vertex until all vertices in the routing are attained. However, to obtain all the full routing the only information needed are the labels of the source and destination vertices. To find all the shortest paths between any pair of vertices which are labelled with ti.k and tj.l in Farey graphs, the three main steps are as follows. Firstly, the MCSG Fmcsg(tmin) of two target vertices is ascertained. Then, the hub X and two initial vertices Y1 and Y2 in Fmcsg(tmin) are determined whether on the road of the shortest paths or not. Thirdly, the new pairs of vertices are generated which are combined ti.k or tj.l together with X or Y1 or Y2. The shortest paths between any pair of vertices are obtained by repeating the three steps till all new vertices pairs are neighbors. The detailed shortest routes in Farey graphs F(t) are shown as below.

Routing Algorithm 1. (SPAF) The shortest path algorithm in F(t) is shown as below.

Step 1. Given any vertices pair are labelled with ti.k and tj.l (for the convenience of analysis, assuming ti ≥ tj).

Step 2. Determine whether the two vertices are neighbors or not.

If ti − tj = 1 and , or ti − tj = m and , by property 1, two vertices are the relationship of mother-child or father-child. Insert the two labels to the labels set of the shortest paths (LSSPm(h)) and h = h + 1. Notice that, h is the shortest distance between any two vertices, m is the number of the shortest paths and LSSPm(0) = . Go to step 6.

Step 3. If the relationship of the two vertices is offspring and maternal ancestor, ascertain the MCSG of two vertices.

If , tj.l is the ti − tj generations maternal ancestor of ti.k, then the MCSG is depended on which range the number k belongs to.

If , or , or …, or , the MCSG is the homomorphic graph from F(2) to F(ti − tj), respectively. The vertex tj.l is the initial vertex 0.0 and ti.k is an outermost layer vertex of MCSG.

Or, if , or , or …, or , the MCSG is also the homomorphic graph from F(2) to F(ti − tj), but tj.l is the other initial vertex 0.1 in Fmcsg(tmin) and ti.k is still an outermost layer vertex in the MCSG.

Go to step 5.

Step 4. Find out the MCSG Fmcsg(tmin) when tj.l is not the maternal ancestor of ti.k.

If , then denote , i.e., tj.m is the ti − tj generations maternal ancestor of ti.k. Separate the set into subsets which are with the same order of 2p by increasing integer p from 0 to tj − 1, till m and k belong to a same subset. Then, the MCSG is F(ti − tj + p + 1) and ti.k is an outermost layer vertex in subgraphs , while tj.l is a p + 1 layer vertex in the other subgraph of Fmcsg(tmin). Go to step 5.

Step 5. Confirm hub X and two initial vertices Y1 and Y2 of Fmcsg(tmin) are whether on the shortest paths or not.

Firstly, in order to facilitate the calculation of shortest paths routing on the basis of the labels of vertices in MCSG, the one-to-one correspondence between the labels of two graphs, Fmcsg(tmin) and F(tmin), is established, for they are isomorphic graphs.

Secondly, all the vertices in F(tmin) are divided into six sets by their distances to two initial vertices of : , and , where η = 1, 2 and ascertained which sets ti.k and tj.l belong to.

Then, the three vertices X, Y1 and Y2 are determined whether on the shortest paths or not by property 3.

If X is on the paths, insert the label of X, assuming tp.q, in the middle of two labels ti.k and tj.l in the set LSSPm(h) and h = h + 1. Therefore, we can make up two new pairs of labels: ti.k and tp.q and tp.q and tj.l, respectively. Go to step 1.

If the shortest paths pass two initial vertex Y1 and Y2, insert the labels of Y1 and Y2, tp1.q1 and tp2.q2, in the middle of ti.k and tj.l in the set LSSPm(h) and h = h + 2. Two new pairs of labels, ti.k and tp1.q1, tp2.q2 and tj.l, are obtained in turn. Go to step 1.

If the shortest paths go through X or Y1 and Y2, simultaneously, insert tp.q into LSSPm(h) and h = h + 1. Then, insert tp1.q1 and tp2.q2 into LSSPm+1(h) and h = h + 2. The four new pairs of labels is deduced: ti.k and tp.q, tp.q and tj.l, ti.k and tp1.q1 and tp2.q2 and tj.l, respectively. Go to step 1.

Step 6. Get the shortest paths routing and the distance.

Based on all the sets of LSSPm(h), the distance between vertices ti.k and tj.l is h, m is the number of the shortest paths and the shortest routes are exactly traversed every elements in every set of LSSPm(h) in order.

Example 1. The 10 shortest paths routings from vertices 5.3 to 6.22 in Fig. 3(a) are {5.3, 3.1, 0.0, 0.1, 2.2, 4.6, 6.22}, {5.3, 3.1, 0.0, 1.1, 2.2, 4.6, 6.22}, {5.3, 3.1, 0.0, 1.1, 3.3, 4.6, 6.22}, {5.3, 3.1, 0.0, 1.1, 3.3, 5.11, 6.22}, {5.3, 3.1, 2.1, 1.1, 2.2, 4.6, 6.22}, {5.3, 3.1, 2.1, 1.1, 3.3, 4.6, 6.22}, {5.3, 3.1, 2.1, 1.1, 3.3, 5.11, 6.22}, {5.3, 4.2, 2.1, 1.1, 2.2, 4.6, 6.22}, {5.3, 4.2, 2.1, 1.1, 3.3, 4.6, 6.22} and {5.3, 4.2, 2.1, 1.1, 3.3, 5.11, 6.22}, the distance is 6.

Routing protocol in N(t)

On the basis of our efficiently labelling and routing algorithms of Farey graphs F(t), Farey graphs N(t) can be labelled and routed similarly. The labelling schematic diagram is shown in Fig. 3(b). The routing algorithm of any two vertices in N(t) is deduced as below. Supposing any two vertices are labelling with g1.ti.k and g2.tj.l, in which g1, g2 {0, 1, 2}.

Routing Algorithm 2. (SPAN) The shortest path algorithm in N(t) is shown as below.

Step 1. If two vertices are in the same subgraph Fg(t), i.e., g1 = g2 = g, the routing of the shortest paths is the same as the algorithm of SRAF above. The shortest paths are obtained by SRAF when the input labels are ti.k and tj.l.

Step 2. If g1 ≠ g2, the two vertices are located in different subgraphs and . From the recursive construction of F(t) and N(t), the two subgraphs above constitute a Farey graphs F(t + 1). Thus, the routing algorithm is similar as SRAF, but the input labels are (ti + 1).k and if {g1, g2}  {{2, 1}, {1, 0}, {0, 2}}, or, and (tj + 1).l if {g1, g2}  {{1, 2}, {0, 1}, {2, 0}}.

Routing protocol in DMG(t)

By assuming the label of two arbitrary vertex in DMG(t) as g1.ti.k and g2.tj.l, in which g1, g2 {0, 1, 2, 3, 4, 5}, the shortest paths routing protocol is similar with SRAN above. The labelling schematic diagram is shown in Fig. 3(c).

Routing Algorithm 3. (SPAD) The shortest path algorithm in DMG(t) is presented below.

Step 1. When g1 = g2, the two vertices are in the same subgraph Fg(t), the shortest paths are obtained just by calling the function of SPAF by inserting ti.k and tj.l into it.

Step 2. If g1 ≠ g2 and {g1, g2}  {{0, 1}, {1, 0}, {0, 2}, {2, 0}, {1, 2}, {2, 1}, {0, 4}, {4, 0}, {0, 5}, {5, 0}, {4, 5}, {5, 4}, {2, 3}, {3, 2}, {2, 4}, {4, 2}, {3, 4}, {4, 3}, {1, 3}, {3, 1}, {1, 5}, {5, 1}, {3, 5}, {5, 3}}, two vertices are locating in different subgraphs and and the two subgraphs share a common initial vertex. This condition is exactly the same as the step 2 of SPAN.

Step 3. If g1 ≠ g2 and {g1, g2}  {{0, 3}, {3, 0}, {1, 4}, {4, 1}, {2, 5}, {5, 2}}, two vertices are in different subgraphs and but with no common initial vertex.

Apparently, the four initial vertices of and shape a complete graph with four nodes and the routings in the six conditions above are similar to one another, thus we take {g1, g2} = {2, 5} as an example. Divide all the vertices in F2(t) and F5(t) into six sets, , , , , and , by the distances from them to the two initial vertices which are labelled with 0.0 and 0.1, or, 0.2 and 0.3, respectively.

(1) If : (a) if , all the shortest paths pass vertices 0.0 and 0.2; (b) else if and , all the paths go through 0.0 and 0.2, or, 0.0 and 0.3; (c) else if and , the paths go by 0.0 and 0.3.

(2) If : (a) if , all the shortest paths pass 0.0 and 0.2, or, 0.1 and 0.2; (b) else if , all the paths go through 0.0 and 0.2, 0.1 and 0.2, 0.0 and 0.3, or, 0.1 and 0.3; (c) else if , the paths go by 0.0 and 0.3, or, 0.1 and 0.3.

(3) If : (a) if , all the shortest paths pass through 0.1 and 0.2; (b) else if , the paths go through 0.1 and 0.2, or, 0.1 and 0.3; (c) else if , the paths go by 0.1 and 0.3.

(4) Then, all the new pairs of vertices are in the same Farey graphs F(t); the rest vertices in shortest paths are obtained by SPAF, in which the inserting parameters are just the labels of each new pair of vertices.

Discussion

We have provided a labelling and routing algorithm for a wide family of Farey graphs, including the model created by edge iterations, evolving networks with geographical attachment preference, general geometric growth model for pseudofractal scale-free web and the networks with multidimensional growth.

The labelling and routing algorithms have several characteristics or advantages. Firstly, our labelling method is simpler than that of refs 12, 15 and 16, because it is easier to deduce the labels of the new vertices which are linked to graphs at step t, by our labelling method. Secondly, the routing algorithm of Farey graphs is the first routing algorithm in a deterministic model which has lesser symmetry. General speaking, the lesser symmetry a model has, the harder the properties we can derive. If the symmetry of a deterministic model is defined as the number of similar nodes in the graph, the numbers in Farey graphs and which models of refs 12, 15 and 16 are 2, 3, 4 and 2d, respectively, where d is a positive integer. Apparently, Farey graph has the least symmetry in all these deterministic models. Lastly, it is the first algorithm that all the shortest paths are obtained only by their labels in deterministic graphs, while only one shortest path is got by similar methods at past literatures.

The time complexity of the routing algorithm in F(t) is decided by the maximum number of the shortest paths between two vertices, or the steps when the two vertices are adding to graphs. By coincidence, the number is related to the famous Fibonacci numbers. The maximum number is exactly the product of two Fibonacci numbers (Fn, in which Fn = Fn−1 + Fn−2 and F0 = F1 = 1). Because the construction mechanism of Farey graphs is recursive, all the vertices on the shortest paths shape rhombuses which are zigzagged adjacent. Moreover, the number reaches maximum only when the two vertices are situated in the different subgroups of Farey graphs: Fx(t) and Fy(t). Supposing the labels of these two vertices are ti.k and tj.l, the maximum number of rhombuses from ti.k to is , meanwhile, which maximum number from tj.l to is . For the rhombuses are staggered adjacent to each other, the number of shortest paths from ti.k to is , while the number from tj.l to is , so that the maximum number is   =   . When ti  =  tj  =  t, the maximum number in F(t) is . The number increases almost exponentially. Fortunately, only at most 2t + 1 vertices are needed to be ascertained in the routing algorithm of SPAF. For instance, vertices of 0.1, 0.0, 1.1, 2.1, 3.1, 4.2, 5.4 and 6.7 shape three rhombuses, while 0.1, 4.8, 5.16 and 6.31 form one rhombus, so that the number of shortest paths between 6.7 and 6.31 is F4 × F2 = 10.

In this algorithm, only five additions and seven multiplications of operations are needed for ascertaining one vertex which is on the shortest paths. As a result, all the shortest paths between any pair vertices can be determined in linear time of O(n). For arbitrary graphs, the classical algorithms of all-pairs shortest paths problem run in sub-cubic time13, while the SPAF for all-pairs in, also only in, Farey graphs runs in sub-quadratic time O(n2−δ) at most. Because Farey graphs are composed by special and recursive manner, so that the shortest paths between vertices of inner layers are covered by the shortest paths between vertices which are located on outer layers.

The algorithms can also be extended to the weighted or delayed models, such as weighted scale-free small-world networks17 and delayed pseudofractal networks18.

Methods

The routing algorithm of Farey graphs is on the basis of the discovery of several important properties about it; we here proof it in detail.

The proof of Property 1

The family of a vertex ti.k includes a father, a mother, a brother and offspring, the labels for others vertices are very obvious besides the father’s, here we only proof it. If ti ≥ 2, let Δt denotes the time difference ti − tj, thus, Δt {2, ..., ti − 2}. For k = 1 and with any step ti, the fathers are all the vertex 0.0. When k is even, the time difference Δt is the sum of one and the number of the continuous zeros from right to left of the binary numbers of k, so that the father’s label is ; When k is odd but excluding one, Δt is the sum of one and the number of the continuous zeros from right to left of the binary numbers of k − 1, the father labels with . In summary, when ti ≥ 2, the father of ti.k is marked with . □

Remark 2. The vertex 1.1 has two mothers 0.0 and 0.1, no father and brother. The initial vertices 0.0 and 0.1 have no parents and brother.

The proof of Property 2

The neighbors of vertex ti.k include a father, a mother and 2(t − ti) offspring, so that the labels of neighbors can be deduced by Property 1. Here we only proof offspring. For vertices (ti + x).2x−1(2k − 1) and (ti + x).[2x−1(2k − 1) + 1], where x {1, 2, ..., t − ti}, the numbers of the continuous zeros from right to left of the binary numbers of 2x−1(2k − 1) − rem[2x−1(2k − 1), 2] and 2x−1(2k − 1) + 1 − rem[2x−1(2k − 1) + 1, 2] are all x − 1 for 2k − 1 is odd, so that l = x in and , that is to say, (ti + x).2x−1(2k − 1) and (ti + x).[2x−1(2k − 1) + 1] are neighbors of ti.k. □

Remark 3. The neighbors set of 0.0 is {ti.1}, ti {0, 1, 2, ..., t}. The set of 0.1 is , ti {1, 2, ..., t}. The set of 1.1 is {0.0, 0.1, (1 + x).2x−1(2k − 1), (1 + x).[2x−1(2k − 1) + 1]}, where x {1, 2, ..., t − 1}.

The proof of Property 3

From the generating algorithm of Farey graph, F(t) is combined with two subgraphs F1(t − 1) and F2(t − 1) and all the vertices in Fη(t − 1) (η = 1, 2) can be divided into three groups , and (η = 1, 2) by the distance from the vertices in them to the two initial vertices of Vη(t − 1). The vertices in have shorter distance to initial vertex X than to Y. In contrast, the vertices in have shorter distance to Y than to X. If the distances are equal, the vertices are in . Because X and Y are neighbors which are linked together, the distances difference is 0 or 1. Therefore, if and , the route between ti.k and tj.l may go by X, or by Y1 and Y2, but the distances, if by X, are one or two or three shorter than by Y1 and Y2, so that the shortest paths in this condition should pass X. But in the occasion of and , the paths going by Y1 and Y2 are one shorter than by X, then the shortest paths go through Y1 and Y2. While in case of and , the paths go by X, or Y1 and Y2, the distance are equal, so that the shortest paths will go by X, or Y1 and Y2, simultaneously. Other seven conditions can be proved similarly. □

Remark 4. If the sum of the distances from ti.k to X and from tj.l to X equals the sum of one and the distances from ti.k to Y1 and from tj.l to Y2, the shortest paths between ti.k and tj.l go through X, or Y1 and Y2, at the same time.

The proof of Property 4

By the construction algorithm of F(t), all the shortest paths between ti.k and tj.l, where ti ≥ tj, are irrelevant to vertices which are added to F(t) after ti iterations. Namely, if ti ≥ tj, all the shortest paths are in the common subgraph F(ti). However, the two vertices may located in a common subgraph which is smaller than F(ti). The smallest common subgraph, or MCSG Fmcsg(tmin), which is contained all the shortest paths between ti.k and tj.l, is obtained by decreasing ti till the minimum tmin.

If , i.e., tj.l is the ti − tj generations of maternal ancestor of ti.k, then, the MCSG is located on both sides of tj.l and ascertained precisely by k. If ti.k is a neighbor of tj.l, by Property 2, the MCSG is F(0). Else, if , the MCSG is F(2); If , the MCSG is F(3), …, if k {(l − 1) × , the MCSG is F(ti − tj), where tj.l is the initial vertex 0.0 in MCSG. If , or , the MCSG is F(2), F(3), …, F(ti − tj), in turn and tj.l is the other initial vertex 0.1 in Fmcsg(tmin). In sum, in this occasion, tj.l is an initial vertex of Fmcsg(tmin) and ti.k is an outermost layer vertex in Fmcsg(tmin).

If , let , then the position relationship of l and m determines the MCSG. For , the set is split evenly into subsets which have the same order of 2p, till m and k are located in the same subset by increasing integer p from 0 to tj − 1, then Fmcsg(tmin) = F(ti − tj + p + 1), where ti.k is an outermost layer vertex and tj.l is a p + 1 layer vertex which are seated in different subgraph of Fmcsg(tmin). □

Additional Information

How to cite this article: Zhai, Y. and Wang, Y. Label-based routing for a family of small-world Farey graphs. Sci. Rep. 6, 25621; doi: 10.1038/srep25621 (2016).