# Exploring a New Adaptive Routing Based on the Dijkstra Algorithm in Optical Networks-on-Chip
## 3 Adaptive Power Control of ONoCs Based on the Dijkstra Algorithm
### Network Architecture
Alleviating this intractable problem, most of the existing active ONoCs depend on the optical circuit switching (OCS) mechanism [1], as shown in Figure 5.  
Figure 4: (a) The \(5\times 5\) mesh model based ONoCs ; (b) The internal structure of the router. ```
Input: Source node \(s\), Destination node \(d\), the number of nodes \(n\) Output: The routing path from the source node to the destination node
1\(D[i]\) represents the array which stored transmission loss from the current node to the source node in a network, and \(D[0]\)=0 represents the distance from the source node to itself is 0; \(w[i][j]\) represents the transmission loss between node i to node j, \(v[i]\) mark whether a node is used or not, and \(v[s]\)=0 means that the node is not used, \(v[s]\)=1 means that the node is used. \(p\) is the node which has smallest transmission loss from the previous node. 2 forint\(i=1\)to\(i<n\)do
3\(D[i]\)=INF;
4 end for
5\(D[0]\)=0;
6\(v[s]\)=0;
7 forint\(i=0\)to\(i<n\)do
8 int\(p\)=\(-1\)
9 forint\(j=0\)to\(j<n\)do
10 if(!\(v[i]\)&&(\(p\)==\(-1\mid D[j]<D[p]\)))then
11\(p\)=\(j\);
12
13 end if
14
15 end for
16
17 end for
18\(v[p]\)=1;
19 forint\(i=0\)to\(i<n\)do
20 if(!\(v[i]\)&&(\(d[i]>(d[p]\)+\(w[p][i])\)))then
21\(d[i]\)=\(d[p]+w[p][i]\);
22
23 end if
24
25 end for
```  
**Algorithm 1**Routing algorithm based on the Dijkstra algorithm  
``` Input: Source node \(s\), Destination node \(d\), the number of nodes \(n\) Output: The routing path from the source node to the destination node
1\(D[i]\) represents the array which stored transmission loss from the current node to the source node in a network, and \(D[0]\)=0 represents the distance from the source node to itself is 0; \(w[i][j]\) represents the transmission loss between node i to node j, \(v[i]\) mark whether a node is used or not, and \(v[s]\)=0 means that



## 4 Evaluation and Discussion

On the premise of not sacrificing the network's performance, optimized power control based on the Dijkstra algorithm in ONoCs has obvious advantages in saving power over adaptive power control in previous studies. Section 4.1 indicates the reduction of the transmission loss in the optimized mesh-based ONoCs is larger than that in the traditional mesh-based ONoCs. The average output power of the transmitter of optimized power control by using the Dijkstra Algorithm is better than that in the adaptive power control and traditional power control. Section 4.2 shows the comparison of network performance between an optimized network based on the Dijkstra algorithm and a traditional network based on the dimensional routing algorithm under different network sizes. ### Transmission Loss and Average Output Power of Transmitter

In mesh-based ONoCs, transmission loss based on the Dijkstra algorithm is compared with that based on traditional dimensional routing with the aid of MATLAB software. The average transmission loss \(\overline{L}_{(s,d)}\) of all links from the source node to the other nodes is considered as the transmission loss evaluation value of network; the formula is shown in (25). Source node, destination node, and total number of nodes in the network are respectively represented by \(s\), \(d\), and \(n\). \(L_{(s,d)}\) represents the link transmission loss from source node \(s\) to destination node \(d\). Here we select node (1,1) as the source node for analysis. \[\overline{L}_{(s,d)}=\frac{\sum_{s=1}^{n}\sum_{d=1}^{n}L_{(s,d)}}{n} \tag{25}\]

Under the condition that the network size is \(8\times 8\), the transmission losses of the optimized link and traditional link from the source node (1,1) to other nodes are shown in Figure 6. It is clearly visible that the optimized link has less link transmission loss than the traditional link. As shown in Figure 7, when network sizes are \(5\times 5\), \(6\times 6\), \(7\times 7\), and \(8\times 8\), the optimized average link transmission losses are 0.193, 0.194, 0.183, and 0.161 dB, respectively--lower than the traditional average link transmission loss. Figure 6: The transmission loss in \(M\times N\) mesh-based ONoCs.