# Vertex Labeling and Routing for Farey-Type Symmetrically-Structured Graphs
## 3 Labeling and Routing of \(F(t)\)
Moreover, one vertex is an initial vertex or a \((p+1)\)th layer vertex in \(F^{mcsg}_{3-\eta}(t_{\min}-1)\), the other is positioned in the outermost layer of \(F^{mcsg}_{\eta}(t_{\min}-1)\)._  
**Property 5**. : _(The shortest paths routing algorithm of Farey graphs)_  
_1. Given a pair of vertices labeled with \(t_{i}.k\) and \(t_{j}.l\)._  
_2. Determine whether the two vertices are neighbors or not._  
_If \(t_{i}-t_{j}=1\) and \(l=\left\lfloor\frac{k}{2}\right\rfloor\), or \(t_{i}-t_{j}=m\) and \(l=\left\lfloor\frac{k-rem(k,2)}{2^{m}}\right\rfloor\), 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)=\varnothing\) and \(m\) is an integer increasing from one, go to step 6._  
_3. Find out MCSG when \(l=\left\lfloor\frac{k}{2^{t_{i}-t_{j}}}\right\rfloor\), namely, where \(t_{j}.l\) is the \((t_{i}-t_{j})\)th generation of maternal ancestor of \(t_{i}.k\)._  
_If \(k\in\left\{(l-1)\times 2^{t_{i}-t_{j}}+2^{t_{i}-t_{j}-1}+2\right\}\), or \(k\in\left\{(l-1)\times 2^{t_{i}-t_{j}}+2^{t_{i}-t_{j}-1}+3,\right.\)\(\left.\left(l-1\right)\times 2^{t_{i}-t_{j}}+2^{t_{i}-t_{j}-1}+4\right\}\), or..., or \(k\in\left\{(l-1)\times 2^{t_{i}-t_{j}}+2^{t_{i}-t_{j}-1}+2^{t_{i}-t_{j}-2}+1,l \times 2^{t_{i}-t_{j}}\right\}\), MCSG is the embedded subgraph from \(F(2)\) to \(F(t_{i}-t_{j})\). \(t_{j}.l\) is the initial vertex \(0.0\) and \(t_{i}.k\) is an outermost layer vertex in MCSG._  
_If \(k\in\left\{(l-1)\times 2^{t_{i}-t_{j}}+2^{t_{i}-t_{j}-1}-2\right\}\), or \(k\in\left\{(l-1)\times 2^{t_{i}-t_{j}}+2^{t_{i}-t_{j}-1}-3,(l-1)\times 2^{t_{i}-t_{j}}+2^{t _{i}-t_{j}-1}-4\right\}\), or..., or \(k\in\left\{(l-1)\times 2^{t_{i}-t_{j}}+2^{t_{i}-t_{j}-1}\right\}\), 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._  
_4. Find out MCSG when \(l\
eq m=\left\lfloor\frac{k}{2^{t_{i}-t_{j}}}\right\rfloor\)._  
_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)\),_
Map the labels of \(F^{\text{mecg}}(t_{\min})\) onto labels of \(F(t_{\min})\) and divide all the vertices in \(F(t_{\min})\) into six sets as above: \(V^{x}_{\eta}(t_{\min}-1)\), \(V^{xy}_{\eta}(t_{\min}-1)\) and \(V^{y}_{\eta}(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}\).4, in the middle of \(t_{j}\).1 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}\).4, \(t_{p}\).4 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}\).41 and \(t_{p2}\).42 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}\).41, \(t_{p2}\).42 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}\).4 into \(LSSP_{m}(h)\) and \(h=h+1\), then insert \(t_{p1}\).41 and \(t_{p2}\).42 into \(LSSP_{m+1}(h)\), \(h=h+2\). Go back to step 1 with four pairs of labels: \(t_{i}\).k and \(t_{p}\).4, \(t_{p}\).4 and \(t_{j}\).l, \(t_{i}\).k and \(t_{p1}\).41, \(t_{p2}\).42 and \(t_{j}\).l. 6. Ascertain the shortest paths routing. 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.