Label-based routing for a family of small-world Farey graphs

We introduce an informative labelling method for vertices in a family of Farey graphs, and deduce a routing algorithm on all the shortest paths between any two vertices in Farey graphs. The label of a vertex is composed of the precise locating position in graphs and the exact time linking to graphs. All the shortest paths routing between any pair of vertices, which number is exactly the product of two Fibonacci numbers, are determined only by their labels, and the time complexity of the algorithm is O(n). It is the first algorithm to figure out all the shortest paths between any pair of vertices in a kind of deterministic graphs. For Farey networks, the existence of an efficient routing protocol is of interest to design practical communication algorithms in relation to dynamical processes (including synchronization and structural controllability) and also 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 follows 6 : • 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).

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 preference 9 , or a general geometric growth model for pseudofractal scale-free web with parameter q = 2 and m = 1 10 .

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 Δ n t = 2 t−1 , so that the order and size of Farey graphs are |V(t)| = 2 t + 1 and |E(t)| = 2 t+1 + 1, respectively. The cumulative degree distribution of F(t) follows an exponential distribution with δ = − δ P ( ) 2 cum 2 and the degree correlations k nn (δ) is approximately a linear function of δ, which suggests that Farey graphs are assortative. The average paths length, which is μ(F(t)) = [(6t − 5) × 2 2t + (6t + 17) × 2 t + (− 1) t + 5]/[9 × 2 t × (2 t + 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 V x (t) (including X) have shorter distances from them to X than to Y, while the vertices in V y (t) (including Y) have shorter distances to Y than to X, if the distances are equal, vertices are all in V xy (t). That is to say, . From definition 1 and the classification of vertices above, if two copies of F(t) are named as F 1 (t) and F 2 (t), F(t + 1) is generated just by merging X 1 and X 2 into X and linking Y 1 and Y 2 directly. The schematic diagram is shown as Fig. 2a.
The Farey graph N(t) is the combination of three Farey graphs marking with F g (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 F q (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 2 t−1 new vertices are added and joined to F(t − 1), label them with labels from t.1 to t.2 t−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 × 2 t−1 new vertices, which are joined to N(t − 1) at step t, with labels from g.t.1 to g.t.2 t−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 × 2 t−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.2 t−1 in a certain order, where the group indicator is g ∈ {0, 1, 2, 3, 4, 5}.

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 Y 1 , Y 2 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 t i .k and t j .l. • When t i ≥ 1, the two children of t i .k are (t i + 1).2k and (t i + 1).(2k − 1).
• When t i ≥ 2 and k is odd, the brother of t i .k is t i .(k + 1), else if k is even, the brother is t i .(k − 1).
• When t i ≥ 2, the three vertices, vertex t i .k and its parents, shape a triangle. The mother is − .
x floor x ( ) 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 Property 3. If any pair of vertices t i .k and t j .l are located in different subgraphs F 1 (t − 1) and F 2 (t − 1) of F(t) respectively.
• The shortest paths between them pass the hub X if (a).
• The shortest paths go through the two initial vertices Y 1 , Y 2 and the edge between them, if

Property 4.
All the shortest paths between any pair of vertices are located in a minimum common subgraph (MCSG) which is denoted as F mcsg (t min ). Moreover, one vertex is positioned in the outermost layer of a subgraph − , the other vertex is an initial vertex or a vertex seating in the p + 1 layer of the other 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 t i .k and t j .l in Farey graphs, the three main steps are as follows. Firstly, the MCSG F mcsg (t min ) of two target vertices is ascertained. Then, the hub X and two initial vertices Y 1 and Y 2 in F mcsg (t min ) are determined whether on the road of the shortest paths or not. Thirdly, the new pairs of vertices are generated which are combined t i .k or t j .l together with X or Y 1 or Y 2 . 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 t i .k and t j .l (for the convenience of analysis, assuming t i ≥ t j ).
Step 2. Determine whether the two vertices are neighbors or not.
, 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 (LSSP m (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 LSSP m (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.
l is the t i − t j generations maternal ancestor of t i .k, then the MCSG is depended on which range the number k belongs to.
, respectively. The vertex t j .l is the initial vertex 0.0 and t i .k is an outermost layer vertex of MCSG. O , the MCSG is also the homomorphic graph from F(2) to F(t i − t j ), but t j .l is the other initial vertex 0.1 in F mcsg (t min ) and t i .k is still an outermost layer vertex in the MCSG.
Go to step 5.
Step 4. Find out the MCSG F mcsg (t min ) when t j .l is not the maternal ancestor of t i .k.
subsets which are with the same order of 2 p by increasing integer p from 0 to t j − 1, till m and k belong to a same subset. Then, the MCSG is F(t i − t j + p + 1), and t i .k is an outermost layer vertex in sub- of F mcsg (t min ). Go to step 5.
Step 5. Confirm hub X and two initial vertices Y 1 and Y 2 of F mcsg (t min ) 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, F mcsg (t min ) and F(t min ), is established, for they are isomorphic graphs. Secondly, all the vertices in F(t min ) are divided into six sets by their distances to two initial vertices of − xy min y min , where η = 1, 2, and ascertained which sets t i .k and t j .l belong to.
Then, the three vertices X, Y 1 and Y 2 are determined whether on the shortest paths or not by property 3.
If X is on the paths, insert the label of X, assuming t p .q, in the middle of two labels t i .k and t j .l in the set LSSP m (h), and h = h + 1. Therefore, we can make up two new pairs of labels: t i .k and t p .q, and t p .q and t j .l, respectively. Go to step 1.
If the shortest paths pass two initial vertex Y 1 and Y 2 , insert the labels of Y 1 and Y 2 , t p1 .q1 and t p2 .q2, in the middle of t i .k and t j .l in the set LSSP m (h), and h = h + 2. Two new pairs of labels, t i .k and t p1 .q1, t p2 .q2 and t j .l, are obtained in turn. Go to step 1.
If the shortest paths go through X or Y 1 and Y 2 , simultaneously, insert t p .q into LSSP m (h), and h = h + 1. Then, insert t p1 .q1 and t p2 .q2 into LSSP m+1 (h) and h = h + 2. The four new pairs of labels is deduced: t i .k and t p .q, t p .q and t j .l, t i .k and t p1 .q1, and t p2 .q2 and t j .l, respectively. Go to step 1.
Step 6. Get the shortest paths routing and the distance.
Based on all the sets of LSSP m (h), the distance between vertices t i .k and t j .l is h, m is the number of the shortest paths, and the shortest routes are exactly traversed every elements in every set of LSSP m (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

Routing protocol in N(t).
On the basis of our efficiently labelling and routing algorithms of Farey graphs 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 g 1 .t i .k and g 2 .t j .l, in which g 1 , g 2 ∈ {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 F g (t), i.e., g 1 = g 2 = 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 t i .k and t j .l.
Step 2. If g 1 ≠ g 2 , the two vertices are located in different subgraphs F t ( ) . 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 (t i + 1).k and

Routing protocol in DMG(t).
By assuming the label of two arbitrary vertex in DMG(t) as g 1 .t i .k and g 2 .t j .l, in which g 1 , g 2 ∈ {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 g 1 = g 2 , the two vertices are in the same subgraph F g (t), the shortest paths are obtained just by calling the function of SPAF by inserting t i .k and t j .l into it.
Step 2. If g 1 ≠ g 2  , and the two subgraphs share a common initial vertex. This condition is exactly the same as the step 2 of SPAN.
Step 3. If g 1 ≠ g 2  Apparently, the four initial vertices of F t ( ) shape a complete graph with four nodes, and the routings in the six conditions above are similar to one another, thus we take {g 1 , g 2 } = {2, 5} as an example. Divide all the vertices in F 2 (t) and and F t ( ) 5 3 , 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.

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 (F n , in which F n = F n−1 + F n−2 and F 0 = F 1 = 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: F x (t) and F y (t). Supposing the labels of these two vertices are t i .k and t j .l, the maximum number of rhombuses from t i .k to .    For the rhombuses are staggered adjacent to each other, , while the number , so that the maximum number is 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 time 13 , while the SPAF for all-pairs in, also only in, Farey graphs runs in sub-quadratic time O(n 2−δ ) 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 networks 17 , and delayed pseudofractal networks 18 .

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 t i .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 t i ≥ 2, let Δ t denotes the time difference t i − t j , thus, Δ t ∈ {2, ..., t i − 2}. For k = 1 and with any step t i , 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  The proof of Property 3. From the generating algorithm of Farey graph, F(t) is combined with two subgraphs F 1 (t − 1) and F 2 (t − 1), and all the vertices in F η (t − 1) (η = 1, 2) can be divided into three groups − y (η = 1, 2) by the distance from the vertices in them to the two initial vertices of V η (t − 1). The vertices in − η V t ( 1) x have shorter distance to initial vertex X than to Y. In contrast, the vertices in − η V t ( 1) y have shorter distance to Y than to X. If the distances are equal, the vertices are in − xy . Because X and Y are neighbors which are linked together, the distances difference is 0 or 1. Therefore, if , the route between t i .k and t j .l may go by X, or by Y 1 and Y 2 , but the distances, if by X, are one or two or three shorter than by Y 1 and Y 2 , so that the shortest paths in this condition should pass X. But in the occasion of . ∈ − t k V t ( 1) i y 1 and . ∈ − t l V t ( 1) j y 2 , the paths going by Y 1 and Y 2 are one shorter than by X, then the shortest paths go through Y 1 and Y 2 . While in case of . ∈ − t k V t ( 1) , the paths go by X, or Y 1 and Y 2 , the distance are equal, so that the shortest paths will go by X, or Y 1 and Y 2 , simultaneously. Other seven conditions can be proved similarly. □ Remark 4. If the sum of the distances from t i .k to X and from t j .l to X equals the sum of one and the distances from t i .k to Y 1 and from t j .l to Y 2 , the shortest paths between t i .k and t j .l go through X, or Y 1 and Y 2 , at the same time.
The proof of Property 4. By the construction algorithm of F(t), all the shortest paths between t i .k and t j .l, where t i ≥ t j , are irrelevant to vertices which are added to F(t) after t i iterations. Namely, if t i ≥ t j , all the shortest paths are in the common subgraph F(t i ). However, the two vertices may located in a common subgraph which is smaller than F(t i ). The smallest common subgraph, or MCSG F mcsg (t min ), which is contained all the shortest paths between t i .k and t j .l, is obtained by decreasing t i till the minimum t min .