# WFO: Cloud-Edge Cooperative Data Offloading Strategy Akin to Water Flow
## 4 WFO Design
### Calculate Priority  
The priority calculation occurs after the grouping nodes. The purpose of computing the priority is to further reduce the data delay. In this section, we use \(T_{\mathcal{L}_{k}}\), \(a_{ij}\), \(x_{i}\) to represent the maximum data delay, the priority between nodes \(i\) and \(j\), the priority of the \(i\)th node in the data forwarding link \(\mathcal{L}_{k}\), respectively. Figure 4 shows the results of the calculated priority. Computing priorities are time-consuming processes that consume considerable computing and storage resources. Despite the FCFS principles, we can still serve more users without counting their priorities. However, we still choose to do this because it dramat  
Figure 4: Data forwarding link priority calculation. Different data forwarding links lead to different delays of the last node. This may cause a considerable impact on data offloading performance. Priority is used to calculate the link with the shortest delay. ically reduces the data delay and dispersion of data delay between nodes. The different forwarding order has a different data delay because of the difference in transmission rates between nodes. For example, there are three nodes, A, B, and C, with a bandwidth of 5 MB/s for AB, 10 MB/s for BC, and 2 MB/s for AC. For data sent by node A for 50 MB data, in the order of A to B to C, the time delay for B and C to receive all data is 5 s and 25 s, respectively. There is an average time delay of 15 s. For the order of A to C to B, the time delay for B and C is 25 s and 25 s, respectively. There is an average time delay of 15 s. For node B, the first path is preferable. Consider a data forwarding link \(\mathcal{L}_{2}\triangleq\{N_{2},N_{7},N_{8},N_{9}\}\) in Figure 4 as an example. The link status and data delay of the last node are shown on the right-hand side. The data delay consists of a transmission delay and a forward delay. Different forwarding sequences have a different data delay, \(T_{\mathcal{L}_{2}}\). The delay calculated by the original queue with no priority is 23 ms, which is clearly suboptimal. Link \(\{N_{2},N_{9},N_{7},N_{8}\}\) has a delay of 18 ms, which is the best forwarding link. The data are then forwarded in this path. The priorities of the nodes were \(\{P_{2}>P_{9}>P_{7}>P_{8}\}\). The relationship between data delay and priority can be formulated as:  
\[T_{\mathcal{L}_{k}}(\alpha_{i,j})=\frac{S}{B_{k,C}+\sum\limits_{i\in\mathcal{ L}_{k}}\sum\limits_{j\in\mathcal{L}_{k}}\alpha_{i,j}B_{i,j}} \tag{6}\]  
where \(\alpha_{i,j}\) is the priority parameters between the \(i\)th node and \(j\)th node. Variable \(\alpha_{i,j}\) only contributes to Equation (6) when it is equal to 1, which means that the priority of \(i\) is greater than that of \(j\). The priority parameters \(\alpha_{i,j}\) can be represented as in Table 3. The horizontal and vertical axes in the table represent the same nodes in data forwarding link \(\mathcal{L}_{2}\). The nodes in the vertical axis represent \(i\) in \(\alpha_{i,j}\). The nodes in the horizontal axis represent \(j\) in \(\alpha_{i,j}\). According to Equation (6), if the priority of \(i\) is greater than that of \(j\), then \(\alpha_{i,j}=1\); otherwise, \(\alpha_{i,j}=0\). For example, Node 2 has a higher priority than Node 7. The intersection of row 2 and column 3 in the table is 1, which means \(\alpha_{2,7}=1\). Therefore, there exists a set of \(\alpha_{i,j}\) that minimizes \(T_{\mathcal{L}_{k}}\). The priority calculation problem is then stated as follows: _Given a data forwarding link \(\mathcal{L}_{k}\), bandwidth \(B_{i,j}\), and data volume \(S\), we determine the priority of the nodes so that the maximum data delay \(T_{\mathcal{L}_{k}}\) is minimized_:  
\[\alpha_{i,j}^{opt}=\operatorname*{arg\,min}_{\alpha_{i,j}}(\sum\limits_{k=1} ^{\gamma}T_{\mathcal{L}_{k}}(\alpha_{i,j})) \tag{7}\]  
\(\alpha_{i,j}\) can only reflect the priority between two nodes. However, this does not represent the priority of a node within \(T_{\mathcal{L}_{k}}\).