Vertex Labeling and Routing for Farey-Type Symmetrically-Structured Graphs

The generalization of Farey graphs and extended Farey graphs all originate from Farey graphs. They are simultaneously scale-free and small-world. A labeling of the vertices for them are proposed here. All of the shortest paths between any two vertices in these two graphs can be determined only on their labels. The number of shortest paths between any two vertices is the product of two Fibonacci numbers; it is increasing almost linearly with the order or size of the graphs. However, the label-based routing algorithm runs in logarithmic time O(logn). Our efficient routing protocol for Farey-type models should help contribute toward the understanding of several physical dynamic processes.


Introduction
In comparison with empirical and random graphs, deterministic models have unique advantages in improving our comprehension in complex networks. For instance, we can obtain the solutions for a deterministic model by rigorous derivation, and the computation is only a small quantity of calculations. Deterministic models can be created by simple recursive operation [1][2][3][4], construction of fractal processes [5], plane filling techniques [6], the relationships between natural numbers [7], or perspectives and methods from classical research of physical processes [8][9][10][11]. Recently, Zhang et al. introduced Farey graphs (FG) on the basis of classical Farey sequences. Farey graphs are simultaneously uniquely Hamiltonian, minimally three-colorable, maximally outer-planar, and perfect [12,13]. FG can be used as modules of multiple networks. The networks created by edge iterations [14], or evolving graphs with geographical attachment preference [15], coincide with the combination of three FG, while the merger of six FG generates graphs with multidimensional growth [16]. Moreover, two new kinds of Farey-type graphs, the generalization of Farey graphs (GFG), and the extended Farey graphs (EFG) are deduced by generalizing the construction mechanism of FG, and they all are scale-free and small-world [17][18][19].
Deterministic graphs also provide a new perspective and methodology for classical research of physical processes. For example, some important dynamical processes on the basis of Apollonian models [20], a kind of deterministic matching graph, space-filling, Euclidean, small-world, and scale-free, • F(0) has two vertices and an edge. • For t ≥ 1, F(t) is obtained from F(t − 1) by adding a new vertex to every edge which is introduced at step t − 1 in F(t − 1), then to linking the new vertex to the two vertices of that edge. connected feedforward neural networks [23], traffic gridlock [24], Bose-Einstein condensation [25], free-electron gas [26], and so on. However, the study of physical processes using FG is still lacking, as the recursive relationships in FG are more complex than for Apollonian networks. The label-based routing protocol for all shortest paths may also bridge Farey-type graphs with the fields below. The all-pairs shortest paths problem is frequently studied in textbooks and it has remained open to this day, the classical algorithms such as the A*, Bellman-Ford, Floyd-Warshall and Dijkstra algorithms all run in subcubic time [27][28][29][30][31]. The K shortest path routing (KSPR) algorithm is an extension of the shortest path routing algorithm, in which K is the number of shortest paths to find [32]. KSPR finds K paths in order of increasing cost, including the shortest path. KSPR in Farey-type graphs will partly reduce to finding out all the shortest paths. Similar to the minimum spanning problem, the graph Steiner tree problem (GSTR) interconnects a set V of vertices by using a network of shortest length, and the length is the sum of the lengths of all edges [33]. Most versions of GSTR are NP (non-deterministic polynomial) complete. Moreover, the bottleneck of many network analysis algorithms is the exorbitant computational complexity of calculating the shortest paths, so that scientists are forced to use approximation algorithms [34].
Graph labeling is one active subject in graph theory. Graph labeling has a wide range of applications in many fields, such as communication design, circuit design, crystallography, and coding theory [35]. Finding the shortest paths in graphs is an open problem, which has been well studied. Zhang and Camellas pioneered the relationship between the shortest paths and vertex labels [35][36][37][38][39]. They can determine the shortest path just by applying simple rules and a few computations based only on their labels.
We propose an algorithm for labeling nodes-all of the shortest paths between any pair of vertices can be efficiently derived only on the basis of their labels. We found that the number of shortest paths between two vertices is huge, but the routing algorithm runs in logarithmic time O(logn).
Furthermore, the existence of symmetry in real-world graphs have been underlined by analyzing of over 1500 graph datasets [40][41][42][43]. It was found that over 70% of the empirical networks contain symmetries, independent of size and modularity. All the graphs we proposed here are symmetrically-structured on the basis of Farey-type graphs, and therefore our labeling and routing algorithms can provide a new viewpoint on empirical networks which are containing symmetries.

Generation of Farey-Type Graphs
GFG and EFG are generalized from FG; we present the definitions of the three in turn.   Remark 1. The number of vertices added at step t is ∆n t = 2 t−1 , so that the order of FG is |V(t)| = 2 t + 1 and the size is |E(t)| = 2 t+1 + 1, respectively. The cumulative degree distribution follows an exponential distribution P cum (δ) = 2 − δ 2 , and the degree correlation k nn (δ) is approximately a linear function of δ [6,7]. All the vertices in F(t) are divided into three groups by their distances to two initial vertices X and Y: V x (t), V xy (t) and V y (t). The nodes in V y (t) (including Y) have shorter distances to Y than to X, while V x (t) (including X) have shorter distances to X, and in V xy (t) the distances are equal. That is to say,

Definition 1. (Generation of FG) Farey graph
. As X and Y are neighbors, the difference in distances above are 0 or 1. If two copies of F(t) are named as F 1 (t) and F 2 (t), the initial vertices are X 1 , Y 1 and X 2 , Y 2 , then F(t + 1) is generated as shown in Figure 2.
. As X and Y are neighbors, the difference in distances above are 0 or 1. If two copies of () Ft are named as 1 () Ft and 2 () Ft+ is generated as shown in Figure 2.

Definition 2.
(Generation of GFG) GF(t, k) is deduced by the rules (see Figure 3):

•
For t = 0, GF(0, k) is composed of three initial vertices which are linked to each other. • For t ≥ 1, GF(t, k) is constructed from GF(t − 1, k) by adding k new vertices to every edge introduced at step t − 1, then linking the k new vertices to the two end vertices.
Remark 2. GF(t, 1) is exactly the graphs created by edge iterations [8]. It is just the evolving graphs with geographical attachment preference [9]. GFG can also be treated as a flower, which has 3 × k identical petals, denoting as P i (t), i = 1, 2, . . . , 3 × k. All petals are rooted from two initial vertices, as a GFG is made up of three groups, so that each group contains k identical petals.
. As X and Y are neighbors, the difference in distances above are 0 or 1. If two copies of () Ft are named as 1 () Ft and 2 () Ft+ is generated as shown in Figure 2.

Definition 2. (Generation of GFG)
( , ) GF t k is deduced by the rules (see Figure 3): GF k is composed of three initial vertices which are linked to each other.
• For

Remark 2.
( ,1) GF t is exactly the graphs created by edge iterations [8]. It is just the evolving graphs with geographical attachment preference [9]. GFG can also be treated as a flower, which has 3 k  identical petals, denoting as () i Pt , 1, 2,...,3 ik = . All petals are rooted from two initial vertices, as a GFG is made up of three groups, so that each group contains k identical petals.

Definition 3. (Generation of EFG) The construction of ( , ) EF t k is shown as below:
• For 0 t = , (0, ) EF k holds three vertices that are linked to each other.
• For by adding k new vertices to every edge linked at step 1 t − and three initial edges added at 0 t = , then linking the k new vertices to the two end vertices (see Figure 4).

Definition 3. (Generation of EFG) The construction of EF(t, k) is shown as below:
• For t = 0, EF(0, k) holds three vertices that are linked to each other. • For t ≥ 1, EF(t, k) is constructed from EF(t − 1, k) by adding k new vertices to every edge linked at step t − 1 and three initial edges added at t = 0, then linking the k new vertices to the two end vertices (see Figure 4). ( ,1) GF t is exactly the graphs created by edge iterations [8]. It is just the evolving graphs with geographical attachment preference [9]. GFG can also be treated as a flower, which has 3 k  identical petals,  . All petals are rooted from two initial vertices, as a GFG is made up of three groups, so that each group contains k identical petals.

Definition 3. (Generation of EFG)
The construction of ( , ) EF t k is shown as below: by adding k new vertices to every edge linked at step 1 t − and three initial edges added at 0 t = , then linking the k new vertices to the two end vertices (see Figure 4).   Remark 3. The generation method of EFG is slightly different from GFG, which lies in the three initial edges, not only the edges merged at step t − 1, but as active edges that can generate new vertices. EFG has 3 × t × k petals, named P i (t j ), i = 1, 2, . . . , 3 × k and t j = 0, 1, . . . , t; a GFG is therefore just part of an equivalent EFG.

Labeling and Routing of F(t)
The labeling and routing protocol of GFG and EFG are extended from FG; the label-based routing algorithm was originally derived in [33], but we redefine it here for completeness and clarity. In order to save space, we do not repeat the proofs of these properties in this section.

Definition 4.
Labeling any vertex in FG as follow (see Figure 5): • Label two initial vertices as 0.1 and 0.0 when t = 0. • When t ≥ 1, the new vertices added at step t are marked with labels from t.1 to t.2 t−1 in a clockwise direction. Remark 3. The generation method of EFG is slightly different from GFG, which lies in the three initial edges, not only the edges merged at step ; a GFG is therefore just part of an equivalent EFG.

() Ft
The labeling and routing protocol of GFG and EFG are extended from FG; the label-based routing algorithm was originally derived in [33], but we redefine it here for completeness and clarity. In order to save space, we do not repeat the proofs of these properties in this section.

Definition 4.
Labeling any vertex in FG as follow (see Figure 5): • Label two initial vertices as 0.1 and 0.0 when t = 0.
• When 1 t  , the new vertices added at step t are marked with labels from .1 t to  Supposing any two vertices are labeled with t i .k and t j .l, and t i ≥ t j . Then the mother vertex of t i .k added to the graph at step t i − 1. Two vertices with same mother are brothers. The father is added to the graph at step t i − 2 or earlier. The following relationships between different vertices, are extracted with the help of their labels.

Property 1. (The family of t i .k)
Two children of t i .k are (t i + 1).(2k − 1) and (t i + 1).2k when t i ≥ 1. When t i ≥ 2, The brother of t i .k is t i .(k + 1) (when k is odd) or t i .(k − 1) (when k is even). When t i ≥ 2, t i .k and its parents shapes a triangle. The mother is (t i − 1). k 2 and the father is (t i − l). k−rem(k,2) 2 l (in which rem(k, 2) is the remainder of k divided by 2, x = f loor(x) is a function rounding the real number x down towards the nearest integer. The integer l(≥ 2) is the number of the continuous zeros from right to left in the binary sequence created by converting the value of k − rem(k, 2) to base 2, plus one, that is, l = Function(k-rem (k,2)).
Property 3. When two vertices are located in different subgraphs F 1 (t − 1) and F 2 (t − 1) of F(t), the hub X of F(t) is on the shortest paths, if ( or t i .k ∈ V y 1 (t − 1) and t j .l ∈ V y 2 (t − 1). Vertices X, Y 1 and Y 2 lie on the shortest paths simultaneously if (1) t i .k ∈ V y 2 (t − 1) and t j .l ∈ V xy 1 (t − 1), (a) or t i .k ∈ V y 1 (t − 1) and t j .l ∈ V xy 2 (t − 1).

Property 4.
All the shortest paths between any pair of vertices are located a minimum common subgraph (MCSG) denoted as F mcsg (t min ). Moreover, one vertex is an initial vertex or a (p + 1)th layer vertex in F , by Property 1, the two vertices are in a mother-child or father-child relationship. Insert the two labels to the labels set of the shortest paths (LSSP m (h) ). Noticing that LSSP m (0) = ∅ and m is an integer increasing from one, go to step 6.
3. Find out MCSG when l = k 2 t i −t j , namely, where t j .l is the (t i − t j )th generation of maternal ancestor of t i .k.
l is the initial vertex 0.0 and t i .k is an outermost layer vertex in MCSG.
MCSG is also the embedded subgraph from F(2) to F(t i − t j ), but t j .l is the other initial vertex 0.1. Go to step 5.

Find out MCSG when l
If t j .m is the (t i − t j )th generation of maternal ancestor of t i .k, then F mcsg (t min ) = F(t i − t j + p + 1), in which 2 p−1 ≤ |m − l| ≤ 2 p . Go to step 5. Map the labels of F mcsg (t min ) onto labels of F(t min ) and divide all the vertices in F(t min ) into six sets as above: V x η (t min − 1), V xy η (t min − 1) and V y η (t min − 1). Then, decide whether X, Y 1 and Y 2 are on the shortest paths by Property 3 or not.
If only the node X is on the paths, then insert the label of X, assuming the label is t p .q, in the middle of t j .l and t i .k in LSSP m (h), and h = h + 1. Thereafter, go back to step 1 with two new pairs of labels: t i .k and t p .q, t p .q and t j .l.
If only Y 1 and Y 2 are on the paths, insert the labels of Y 1 and Y 2 , being t p1 .q1 and t p2 .q2 respectively, in the middle of t i .k and t j .l in LSSP m (h), and h = h + 2. Get two new pairs of labels, t i .k and t p1 .q1, t p2 .q2 and t j .l, and go back to step 1.
If X, Y 1 and Y 2 are all on the paths at the same time, 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), h = h + 2. Go back to step 1 with four pairs of labels: t i .k and t p .q, t p .q and t j .l, t i .k and t p1 .q1, t p2 .q2 and t j .l.
The shortest paths are traversed over every element in every set of LSSP m (h) in order, where m is the number of the shortest paths and h is the distance between t i .k and t j .l. Property 6. The shortest paths routing algorithm in Property 5 between any two vertices of a Farey graph runs in logarithmic time.
Proof. Each algorithm has its time complexity and space complexity.
The space complexity of the shortest paths routing algorithm in Property 5 is decided by the number of shortest paths. The number is exactly the product of two Fibonacci numbers. When ], increasing almost exponentially [33]. The order and size of FG is |V(t)| = 2 t + 1, so the space complexity increases almost linearly with O(n). However, the time complexity is determined by the maximum number of the vertices, which are located in the shortest paths in two Farey-type graphs. We can obtain that all the vertices on the shortest paths shape rhombuses which are zigzagged adjacent from the construction mechanism. The max number of rhombuses from t i .k to 0.
. That is to say, only at most 2t + 1 vertices need to be ascertained in the routing algorithm. When determining a vertex of 2t + 1 vertices, several operations of addition and multiplication are needed. For the order of FG is |V(t)| = 2 t + 1 and log|V(t)| ∝ t, all the shortest paths can be determined in logarithmic time O(log n).

Labeling of GF(t, k) and EF(t, k)
Definition 5. (The labeling of GFG) The labeling of any vertex in GF(t, k) adheres to the following rules: • The three initial vertices are labeled with 0, 1 and 2. Labeling of GF(2, 2) and EF (2,2) are illustrated in Figure 6.

Remark 4. A GFG has more petals than an EFG, such that d
When t ≥ 2, any new vertex, added to GFG/EFG at step t i , links to two vertices: a mother and a father. The vertices added to graphs at the same time are siblings if they have the same parents. Supposing that two arbitrary vertices in GFG/EFG are labeled with a 1 .b 1 .c 1 .d 1 and a 2 .b 2 .c 2 .d 2 , in which b 1 ≥ b 2 , then, we give several properties satisfying GFG and EFG at once.  ≥ 1, a.b.c.d belongs to a set of siblings {a c.d and its parents define a triangle, the mother is a.
Proof. The above results are self-evident, with the exception of the formulation of the father's label, which we shall now prove. If b ≥ 2, let l denotes the difference b − b 1 , thus, l ∈ {2, . . . , b − 2}. When c = 1 and with any b, the fathers are all the initial vertexes. When c is odd but excluding one, l is one plus the number of the continuous zeros from right to left in the binary representation of c − 1, such that the father is labeled as a.(b − l). c−1 2 l . d k l . When c is even, the time difference l is one plus the number of the continuous zeros from right to left of the binary representation of c, such that the Property 9. (The projection of GFG/EFG) By merging vertices a.b.c.d, which have the same a.b.c but a different d, into a vertex labeling with a.b.c, GF(t, k)/ EF(t, k) is projected onto a graph which is exactly the combination of three Farey graphs starting from each edge of a triangle.
Proof. From the spatial relationship between vertices in different petals, all the vertices of a.1.1.d are linked to common vertices up until two initial vertices {0, 1, 2}/{a} are reached, so that all of a.1.1.d can merged into a vertex of a.1.1. By recursively using the spatial relationship, GF(t, k)/ EF(t, k) is projected into a combination of three Farey graphs. Although the labels of the three initial vertices in GFG and EFG are slightly different from the labels of the two initial vertices in FG, the shortest paths protocol in GFG/EFG also benefit from the routing algorithm in FG. From the generation mechanism, GFG/EFG is divided into three groups by symmetry, and each group is consisted of k or tk  petals, and furthermore vertices in each group can also be divided into three sets by the differences in distance, similar to the equivalent division for FG: sets  . d k l and a mother a.(b − 1). c 2 . d k by Property 7, and the three vertices define a triangle. Then, the father's mother, or the mother's father, is obtained by recursively using Property 7. From the spatial relationship of vertices, a.b.c.d and all these parents define a slice.

Routing of GF(t, k) and EF(t, k)
Although the labels of the three initial vertices in GFG and EFG are slightly different from the labels of the two initial vertices in FG, the shortest paths protocol in GFG/EFG also benefit from the routing algorithm in FG. From the generation mechanism, GFG/EFG is divided into three groups by symmetry, and each group is consisted of k or t × k petals, and furthermore vertices in each group can also be divided into three sets by the differences in distance, similar to the equivalent division for FG: sets V x (t), V xy (t) and V y (t).

Property 12.
(The characteristic of shortest paths when two vertices lie in different slices of same group) If a.b 1 .c 1 .d 1 and a.b 2 .c 2 .d 2 are located in different petals, the shortest paths between them are positioned in two slices which are connected by two common vertices.
Proof. From the generating algorithm, if a.b 1 .c 1 .d 1 and a.b 2 .c 2 .d 2 are located in different petals or subpetals, then the neighbor sets of a.b 1 .c 1 .d 1 and a.b 2 .c 2 .d 2 are ascertained by Property 8. When two common neighbors are created during the same step, then a.b 1 .c 1 .d 1 and a.b 2 .c 2 .d 2 are positioned in different slices, and the two slices can be determined by Property 10. Supposing that the first two common neighbors are a.b 3 .c 3 .d 3 and a.(b 3 + 1).c 4 .d 4 , the two slices are rooted in them and belong to . Compared with the construction schematic diagram in Figure 2, the linking of are linked exactly by merging X 1 and Y 1 into a.b 3 .c 3 .d 3 and linking X 2 and Y 2 into a.(b 3 + 1).c 4 .d 4
Property 13. (The characteristic of shortest paths when two vertices are in same slice) If a.b 1 .c 1 .d 1 and a.b 2 .c 2 .d 2 are in the same slice of a petal or subpetal of same group, the shortest paths between them are determined by Property 5, as they have been projected onto a Farey graph.
The detailed shortest routing algorithm in GFG/EFG is described as follows.
2. If a 1 = a 2 , and both a 1 .b 1 .c 1 .d 1 and a 2 .b 2 .c 2 .d 2 are not initial vertices, then this is exactly the condition of two vertices being in different groups. Three initial vertices {0, 1, 2}/{a 1 , a 2 }, a 1 and a 2 are ascertained as being on the shortest paths or not by property 11.

Conclusions
We presented label-based routing algorithms for Farey-type graphs, including standard Farey graphs, generalized Farey graphs and extended Farey graphs. Our results can be extended easily to several Farey-type deterministic models, such as models created by edge iteration, evolving graphs with general geometric growth models for pseudofractal scale-free webs, geographical attachment preference, graphs with multidimensional growth, and so on. In contrast with prior research results, which can only get one shortest path from the labels of any pair of vertices, we can ascertain all the shortest paths using only their labels in all Farey-type graphs.
As all Farey-type graphs are structurally isomorphic, the time complexity of the routing algorithm in generalized Farey graphs (GFG) and extended Farey graphs (EFG) are essentially equivalent to that of standard Farey graphs, and thus the routing algorithms run in logarithmic time O(logn).
For weighted scale-free small-world graphs [44] and delayed pseudofractal graphs [45], our solutions can also be easily extended to these weighted or delayed models.