An adaptive routing strategy in P2P-based Edge Cloud

P2P-based Edge Cloud (PEC) is widely used in Internet of Things (IoT). Inevitably, the sensor data routing technology has a significant impact on the performance of PEC. Due to its prevalence and complexity, the existing routing technologies in PEC need to be optimized. Specifically, key factors such as overall network traffic, user access latency, and resource utilization of edge nodes should be considered to adapt to the dynamic requirements of user request services and network topology. In order to address the challenges produced by these factors, an adaptive routing in P2P-based Edge Cloud is proposed, which is named ARPEC. In our approach, a target edge node selection scheme based on message activity and network topology is proposed, aiming to minimize the load on edge node and user access latency. Furthermore, to minimize system overhead, sensor data routing is mapped to minimum cost maximum flow (MCMF) graph. On this basis, a target edge node selection algorithm based on a grey linear regression combination prediction model is designed, and an incremental MCMF algorithm based on belief propagation (BP) is proposed. The evaluation results show that our approach can effectively improve PEC transmission performance and user experience.


Introduction
The vigorous development of IoT and mobile intelligent devices has brought about a trend of data sources shifting from centralized cloud data centers to distributed edge computing networks [1][2][3].In IoT application scenarios based on centralized cloud computing, the data generated by sensors needs to be transmitted to cloud platform and to be processed by using the cloud computing power.Unfortunately, the massive amount of data transmission will bring a huge burden to the core network, which not only affects the normal operation of the core network, but also brings huge transmission delays and reduces user experience [4][5][6].As a result, edge computing came into being, and Edge Cloud is one of the main research directions in the field.In Edge Cloud, multiple edge servers (referred to as edge nodes in the paper) are placed closer to users, and users can submits computing tasks to an edge server that is closer to them for computing.Compared with centralized cloud, Edge Cloud meets the requirements of low latency, low consumption and fast response.Therefore, the combination of Edge Cloud and IoT has become a general trend [7][8][9][10].
As is known, P2P architecture, where the neighbor nodes exchange parameters to obtain global information, is one of the mainstream architectures of Edge Cloud.Therefore, we adopt P2P architecture that has no fixed central node and can better and fully utilize the extensive distributed resources of edge nodes.Considering the important impact of sensor data routing technology on edge cloud service quality, such as reducing overall network traffic, reducing user access latency, and improving resource utilization of edge nodes, in the paper, we study an adaptive routing strategy in PEC.
Page 2 of 13 Dong and Chen Journal of Cloud Computing (2024) 13:13 Currently, the challenges in utilizing PEC to process sensor data routing can be mainly divided into two aspects.On the one hand, due to the following factors, such as the diversities of user needs, the temporal differences in service access, and the limited coverage of an individual edge node, if a certain sensor data is cached on an edge node, it often leads to an increase in service latency, and even network congestion and service interruption.On the other hand, due to differences in computing power and dynamic changes in load conditions among edge nodes, some edge nodes may have excessive load, which greatly damages the quality of service.In the paper, we focus on the topic of ARPEC, specifically studying how to reduce data traffic, how to shorten user access latency, and how to improve the utilization of edge nodes in PEC.The contributions of this paper can be summarized as follows.
• Modeling adaptive routing optimization: We analyze the key goals of solution to routing optimization, and propose a sensor data routing model to reasonably route sensor data to the target edge nodes which provide caching services for the sensor data.• Selection scheme for target edge node: We introduce a target edge node selection scheme to enhance user experience, which can adapt to the temporal dynamic characteristics of routing demands, and design a target edge node selection algorithm based on a grey linear regression combination prediction model.• Construction and solution of MCMF graph: To improve the overall performance of PEC, we map sensor data routing to MCMF graph from a resource perspective, at the same time, propose an incremental MCMF algorithm based on BP, which reduces computational costs and supports dynamic deployment.
The remainder of this paper is organized as follows.In Related work section, we review the related work on routing strategies.An adaptive routing model in PEC is established in Adaptive routing model Section.In Target edge node section, we propose a target edge node selection scheme based on the relevant characteristics of PEC and IoT, and design a request message processing algorithm.In MCMF graph section, by analyzing the impact of edge node load on service quality, we propose a sensor data routing scheme based on MCMF graph that supports global optimal solution for multiple routing tasks, and design an incremental MCMF algorithm based on BP.We compare the experimental performance and analyze the results in Simulation and performance analysis section.Conclusion section concludes the paper.

Related work
The sensor data routing strategy of edge computing network in IoT is a hot research topic in academic research in recent years.According to the different metrics, it mainly involves two aspects: scheme for selecting target edge node and solution using MCMF model.

Scheme for selecting target edge node
In IoT, the edge nodes store a certain amount of sensor data.The quality of target edge node selection scheme will have a significant impact on system performance.The core of scheme is how to cache sensor data, that is, how to design caching scheme for sensor data.
LCE [11] is an intuitive caching decision scheme where data is cached by all nodes along the way back to the requester; however, it can easily lead to huge data redundancy.LCD [12] and MCD [13] are two approaches that improve the caching diversity.A new copy of the requested data will be cached only at the immediate node of the path in downward direction.The difference between them is that under MCD, the hit node will delete the requested data.However, both were proposed earlier for web caching to reduce cache redundancy.Prob [14] is a probabilistic caching version of LCE.However, the version is not flexible enough to determine whether to cache the arrived data based on a static probability.In short, the above strategies are mainly applied to Information Centric Networks and not specifically targeted at IoT.
Currently, there are some data caching solutions based on IoT.Y. Sellami et al. [15] proposed an architecture for a distributed fog caching solution for Content-Centric Networks.O. Serhane et al. [16] focused on an energy-aware caching placement scheme to maximize the energy-saving.G. Dhawan et al. [17] considered the trade-off between node energy, data freshness and cache occupancy, and proposed a candidate node selection for cache placement.N. Baltagiannis et al. [18] incorporated sensor faults and energy consumption in caching decisions.M. Amadeo et al. [19] designed a probabilistic Internet-scale caching design for IoT data.S. Tanted et al. [20] discuss the design, implementation and performance of a distributed caching & aggregation mechanism to handle the visualization of sensor data.However, the approaches are more focused on caching techniques for IoT-based compared to giving much attention to the placement and selection of caching nodes.
In summary, it can be seen that the caching schemes of Information Centric Networks have the problems of high pressure on data center transmission and computing, as well as high construction costs; the IoT-based caching schemes are good solutions for the systems that generate a large amount of sensor data flow.However, how to improve resource utilization and computational efficiency, as well as how to reduce user query latency, is still a topic that needs further research.This study extends the existing work by utilizing an adaptive routing optimization model with mechanisms for selecting target edge node to address the limitations of traditional routing models when applied to PEC.It also optimizes the selection scheme for target edge node, resulting in reduced load on edge node and user access latency.

Solution using MCMF model
In many scenarios, a large number of users access edge nodes at different times and locations [21].Therefore, routing strategy typically cannot be designed for each user, but relies on dynamic changes in user query patterns and spatiotemporal dimensions.In addition, routing service often incurs significant transmission costs, which may lead to service interruption and overall service delay.At present, there are some studies using MCMF model to solve sensor data routing problems.
To minimize average transmission delay or flow cost in data centers, Akbar Majidi et al. [22] formulated this optimization problem as a constrained Markov decision process.By creating multiple paths between the source and destination peers, MaxFlowTCP [23] utilized SDN with traditional TCP to deliver maximum flow throughput in data centers.Through a logically centralized control plane, the processing-while-transmitting pattern [24] jointly determined the transmission path and placed subtasks adaptive to dynamic topology, and data distributions.To minimize the sum of heterogeneous costs of relay nodes, Y. Sun et al. [25] formulated the NWPTSTP for minimum cost relay node placement.However, the approaches are more focused on providing traffic management in Software-Defined Networks environments or in Wireless Sensor Networks, and don't involve the reoptimization of flow in PEC.
In addition, some studies have concentrated on BPbased MCMF methods [26], which mainly concentrate on how to utilize the parallel transmission of information between nodes in solving combinatorial optimization problems.G. Dhawan et al. [27] applied BP to discover globally optimal routes by performing lowcomplexity computations and exchanging messages with their neighbors.N. Baltagiannis et al. [28] showed how BP can be used to compute the throughputs of different links in the network given their access intensities.Ghafoor et al. [29] applied BP algorithm to compute a final belief about existence of primary user.Kakkasageri et al. [30] proposed multi-agent routing scheme for vehicular Ad hoc networks.However, one common challenge is the high time-consuming of message updates, which often leads to a low sensor data routing efficiency.Thus, there is a need for further research to develop optimized BP algorithm that can effectively minimize system overhead in PEC.
Drawing inspiration from these above researches, we focus on the overall performance of PEC utilizing an adaptive routing optimization model, and demonstrate how leveraging an incremental MCMF algorithm based on BP can reduce computational costs, thereby enhancing efficiency in routing sensor data.

System model
A typical PEC scenario is shown in Fig. 1.
PEC consists of sensors, edge nodes, and users.Without affecting routing analysis, the system model omits gateways between sensors and edge nodes, as well as between users and edge nodes.There are two types of messages in PEC: user request and sensor data.Thus, it can be inferred that the overall network traffic arises from the superposition of these two types of messages.Assume that sensor data carries the corresponding information such as sensor identification and timestamp.A sensor transmits data to a directly connected edge node, which stores sensor data in the same size blocks.We refer to the data blocks in edge node as content.If an edge node caches a certain sensor data, then the edge node is referred to as the target edge node related to the sensor.Edge nodes can transmit user requests and sensor data between each other.A user obtains the contents of a target edge node by sending request messages.In Fig. 1, S = {s 1 , s 2 , s 3 } , EV = {ev 1 , ev 2 , . . ., ev 6 } and U = {u 1 , u 2 } denote the sets of sensors, edge nodes and users, respectively.The set of target edge nodes related to s 1 for the users u 1 and u 2 is denoted by TE(s 1 , U ) = {ev 2 , ev 5 } .A label Data  → on an edge indicates the routing of sensor data.Meanwhile, a label → Request expresses the routing of user request messages.
With the expansion of the scale of PEC scenarios, this system model exhibits highly dynamic characteristics.First, with the dramatic increase of sensors, the user request services are highly dynamic in temporal.Thus the temporal dynamic of user request services should be considered for routing optimization.Second, it is demonstrated that with the deepening of PEC computing, an unchanged topology in a PEC scenario can no longer meet complex application requirements.So, supporting dynamic deployment of nodes is another factor that cannot be ignored in routing optimization.

Optimization goals
Considering the dynamic requirements of user request services and network topology, the adaptive routing in the paper is defined as how to reasonably route sensor data to the edge nodes for caching in heterogeneous edge node scenarios at each time, that is, how to select the target edge node to achieve the optimal goal.
From the perspective of edge computing service providers and users, the main purpose of selecting target edge node is to reduce the traffic of entire network and the access delay of users, while improving the resource utilization of the edge node.To achieve this goal, the following measures can be taken.Firstly, In order to avoid the surge in the traffic of entire network caused by the propagation of sensor data in PEC, we reduce the number of visits to edge nodes directly connected to sensors.Secondly, we make the content as close to users as possible to reduce users' access delay.Thirdly, considering the performance differences of edge nodes, we deploy user request services to edge nodes that minimize the overall computational network scenario overhead as much as possible.Therefore, for selecting target edge node, three optimization goals are defined as follows.
(1) Goal 1: Minimize the load on edge nodes directly connected to sensors The goal 1 can be calculated as where T is the running time of the network, req(u,s,t) is the request messages sent by user u to s at time t, dl(s) represents the edge node directly adjacent to s, and sat(r,ev) is a Boolean function to determine whether ev (1) load(u, s) = t∈T sat(req(u, s, t), dl(s)), meets the request r.We define load(u,s) as the number of requests that edge node dl(s) satisfies u during time period T. The smaller the value of load(u,s) is, the lower the network traffic is.
(2) Goal 2: Minimize user access latency The goal 2 can be calculated by the following expression.
We define delay(u,s,ev) as the ratio of the delay of sensor data transmission between user u and the edge node ev that satisfies the user's request after sending a request message to sensor s during time period T, and the delay between user u and the edge node dl(s).The smaller the value of delay(u,s,ev), the closer the edge node that satisfies the user u's request is to u.Therefore, delay(u,s,ev) can be used to indirectly reflect goal 2.
(3) Goal 3: Minimize system overhead One of the factors affecting system overhead is the resource utilization of edge nodes.To describe the resource utilization of edge node, the weight value of edge node ev, denoted as w(ev), is designed in PEC.w(ev) is inversely proportional to the resource utilization of the edge node.Here, w(ev) is influenced by the factors such as the CPU and disk utilization of edge node, as well as the priority of content requested by user, that is, the higher the utilization of CPU and disk, as well as the priority of the requested content, the lower this value of w(ev) is.
The goal 3 can be formulated as follows. ( delay(u, s, ev) = d(u, s, ev) • t∈T sat(req(u, ev, t), dl(s)).where mW = (w(ev 1 )w(ev given n is the number of edge nodes in the network.mD = (delay(u, s, ev 1 ) Taking into account the processing capacity of the edge nodes, cost(u,s) is defined as a numerical value that represents the ratio of the product of the edge node load of the content provider in goal.1 and the delay between u in goal.2 and the edge node ev that satisfies u's request, to the delay between u and the content source provider.
As mentioned above, we construct the following adaptive routing optimization model.
Considering the different processing capabilities of each edge node in the scenario of heterogeneous edge nodes, the target of the model is to solve for the values of the req function and sat function at a certain time, so as to minimize the value of formula 4.

Problem analyses
(1) Selection of target edge node By observing the goal 1 and the goal 2, we find that req(u,s,t) and req(u,ev,t) are key parameters in the model, which can reduce the overall network traffic and user access latency.Thus, based on the value of the function sat, it can be determined whether the edge node has a message that meets the request.By summing the sat values, the activity of sensor messages at an edge node can be determined.Based on message activity, it is possible to better determine whether each edge node is a target edge node during the period.Therefore, the value of t∈T sat(r, ev) is a key factor.In addition, in order to minimize user access latency, it is necessary to keep t∈T sat(r, ev) as small as possible, that is, the number of hops between the target edge node and the user needs to be as small as possible.We proposes a target edge node selection scheme based on message activity and network topology, and implements a target edge node selection algorithm based on a grey linear regression combination prediction model.
(2) MCMF graph By observing the goal 3, we find that w(ev) is another key parameter in the model.Furthermore, w(ev) can be quantified as the capacity of the path in the network graph.At present, the MCMF problem has been applied to various network routing scenarios and is usually characterized by graph models.By limiting the capacity and cost of paths in the graph, the global optimal solution for multiple routing tasks is sought.We apply it to message routing modeling in multi user, multi sensor, and multi query scenarios.Specifically, the two problems of users' demand for resources and the supply of resources in edge computing networks are transformed into the construction and solution of MCMF graph.In particular, considering the throughput and response delay of user requests in edge computing networks, an incremental MCMF optimization algorithm is implemented.
A MCMF graph for sensor data routing is shown in Fig. 2. The nodes marked with dashed circles, such as ev 2 and ev 5 , are the target edge nodes of s 1 .The node tv s 1 is the terminal node associated with s 1 , which serves as the aggregation node for data from sensor s 1 .tv s 1 is connected to u 1 and u 2 by edges, indicating that u 1 and u 2 have sent request messages to s 1 .Sequence s 1 → ev 1 → ev 2 → u 1 and sequence s 1 → ev 1 → ev 3 → ev 5 → ev 4 → u 2 rep- resent the two data forwarding paths related to s 1 , respectively.Each edge is marked with a pair of cost/capacity values, where the cost indicates the cost of forwarding sensor messages through the edge, and the capacity means the ability of the edge to forward sensor messages.Considering that an edge node directly connected to a sensor should receive the sensor data as much as possible, the capacity of the edge is assigned infinity.Similarly, due to the fact that the terminal node directly connected to a user is uniformly added for the convenience of unified processing, the capacity of the edge is also assigned infinity.

Priority of edge node
In the following, based on the scheme of selecting target edge nodes, we first discuss three time-related metrics: message activity, user request probability, and query distance.And then, the priority is set for each edge node based on these measurements, and the edge node with the highest priority is selected as the target edge node to meet the dynamic changes in user service requests.
(1) Message activity Since the types and quantities of user requests received by edge node are different, we can determine the activity of message by calculating the number of user requests.Therefore, message activity is defined as the ratio of the number of requests for that message to the total number of requests for all messages.Let r s denote the messages generated by the sensor s.For the edge node ev, act(r s ,t,ev) denotes the activity of r s at time t.The activity of r s in the edge node ev can be denoted by act(r s ,ev).Thus, the following equation holds.
(2) User request probability Considering that a sensor generates new messages every once in a while, users are more inclined to request the latest information.Therefore, the novelty of messages can have an impact on the priority of the edge nodes.We use timestamps to distinguish messages generated by the same sensor at different times.So the larger the timestamp value is, the newer the message is.The probability of any user sending a request message to the edge node ev regarding the message r generated by sensor s at time t is denoted by prob(r s ,t,ev).
(3) Query distance In order to reduce latency, sensor messages should be cached as close to the edge node as possible to the user who sends the relevant request message.Therefore, we take the network topology into account when calculating the priorities of edge node.The query distance is denoted by ah(r s ,t,ev), which is defined as the average number of edge nodes on the relevant paths.Here, the relevant path refers to the path that the message r s generated at time t routes from the current edge node ev to the user node that send the corresponding request message.
(4) Selecting target edge node Message activity and user request probability are related to the usefulness of the cached sensor data, and query distance is a metric of user access latency.In summary, for the sensor message r s generated at time t, the priority of the edge node ev can be obtained by Similarly, for the sensor message r s , the priority of the edge node ev can be calculated as Among them, the coefficient α ev denotes an adjustment factor, and its value can be appropriately predicted according to the application scenario.In the paper, we let a = 1.Generally speaking, the higher the activity of message is, the higher probability of user's request is; and the smaller the query distance is, the higher priority of edge nodes.

Prediction of priority
In PEC, sensors constantly generate new data, and users frequently have new requests.Especially when edge nodes receive new requests, the three metric values calculated by using the method in the previous section will have a significant deviation from the subsequent stable values.This results in a significant difference in the priority of edge nodes between the early and the subsequent stable stages.In order to overcome the above impact, this section predicts the priority of edge nodes that receive new requests, so that the nodes can obtain more accurate priorities earlier.Due to the characteristics of grey system, such as no need for a large number of samples, and a good short-term prediction performance, a grey system prediction model for predicting priority is proposed.( 6) p(r s , t, ev) = act(r s , t, ev) • prob(r s , t, ev)/ah(r s , t, ev).Assume that a user has a request for a new message r s ′ from sensor s, where r s ′ is an earlier message than r s .For predicting the priority of ev regarding r s ′ , the pri- ority sequence of ev regarding r s can be quantified as mP (0) = (p(r s , t 1 , ev), p(r s , t 2 , ev), . . ., p(r s , t n , ev)) , and then, the grey system prediction model, which is donoted by p (1) (r s ,t k ,ev), is used to estimate the predicted value p(r s , t n+1 , ev) .The details of modeling can be found as follows.
Step 3. Calculate the estimated values of v , c 1 , c 2 , and c 3 according to the following formulae.
where aver is a function for calculating the average value, Step 4. Calculate the estimated value of p, (1) (r s t k ,ev) by using the following prediction model.
Step 5. Restore the results of step 4. (8) where p (0) r s , t k+1 , ev is the predicted priority of ev regarding r s ′.

Algorithm for processing request messages
The priority adjustment of edge node is accompanied by the processing of user request messages by the edge node.According to the discussions of priority predicting, the process of request message processing algorithm based on a grey system prediction model includes the following essential steps.When receiving a user request message, the edge node updates the values of these metrics: message activity, user request probability, and query distance.If the request is a new request, it is necessary to predict the priority of the edge node regarding this request.Finally, the edge node refreshes the user request message and recalculates the priority corresponding to each request.The details can be found in Algorithm 1. Lines 3-6 are the setting of measurements and the return of results to users when the edge node detect user request messages; lines 7-8 are the forwarding of request messages; lines 9-12 predict the priority of the edge node when dealing with new request messages; The 13th line recalculates the priority of the edge node after changes in these measurements.
Algorithm 1. Request message processing (13) p (0) r s , t k+1 , ev = p (1) r s , t k+1 , ev − p (1) In Algorithm 1, the edge node ev maintains operations on its content based on a content block statistics table, which consists of user request messages, sensor data messages, and three metrics related to optimization goals.The statistics table is an important data structure that supports the selection of target nodes.Assume the length of the statistical table is m, and the number of sensors related to the content is l.Let C req,s denote a set of all content blocks with the same sensor identifier s as that of req, where the timestamps in the set are earlier than req.Let |C req,s |= n.For the maintenance operation of the statistical table, the time complexity analysis is as follows.There are only two procedures, i.e., as GreyPre and priorityculating, involved in operating the statistical table.GreyPre includes the steps such as traversing C req,s , sorting C req,s in chronological order, and calculating according to formulas (8, 9, 10, 11, 12 and 13).The time complexity of GreyPre is O(nlog 2 n).Similarly, priorityculating the time

Construction of MCMF graph
We mainly consider the performance parameters such as reducing network traffic, shortening user access latency, and improving the utilization of edge nodes.This section discusses the question that how to characterize the above parameters from a resource perspective and how to convert them into the assignment problem of graph capacity and cost.
For a given graph G = (V, DE, CA, CO), among them, V is a node set that represents entities in PEC, including the sensor S, the edge node EV, the user U, and the terminal node TV; DE is a directed edge set, which indicates whether a data forwarding task can be mapped to a corresponding entity; CA denotes a set of capacities on edge, identifying the entity's supply capacity; CO is a cost set that represents the mapping effect between sensor data forwarding tasks and entities.

Definition 1
For G, ∃s ∈ S ∃v i , v j ∈ V (v i , v j ) ∈ DE , to analyze the flow in PEC, we let out(s, v i , v j ) denote the flow of the edge < v i ,v j > with respect to s, which can be calculated as follows.
Similarly, the flows of < v i ,v j > and G are expressed as out v i , v j = s∈S out(r s , v i , v j ) and out(G) = (v i ,v j )∈DE out(r s , v i , v j ) , respectively.

Definition 2
For G, ∃s ∈ S ∃v i , v j ∈ V (v i , v j ) ∈ DE , the cost of the edge < v i ,v j > with respect to s, i.e. co(s, v i , v j ) , can be calcu- lated as follows.ev) .The cost of forwarding data from v i to v j is related to p r s , t, v j and w(v j ) , in the paper, it is specifically expressed as w(v j ) In the same way, co v i , v j = s∈S co(r s , v i , v j ) and co(G) = (v i ,v j )∈DE co v i , v j are the costs of < v i ,v j > and G.

Definition 3
For G, ∃v i , v j ∈ V (v i , v j ) ∈ DE , then ca v i , v j rep- resents the capacity of the edge < v i ,v j > , which can be obtained by the following expressions.

Solution of MCMF graph (1) Formal description of problem solving
In this paper, one of our purposes is improving the overall performance of PEC.So we formulate the MCMF problem for graph G as follows.
As mentioned above, the node that satisfies the condition b(v j ) > 0, and b(v j ) < 0 is called a source node, and an aggregation node, respectively; the flow that satisfies (14) min

s.t.C1 :
v∈EV b(v) = 0 is called a feasible flow.Under the prem- ise of satisfying formulae (14, 15 and 16), we maintain the minimum cost, and iteratively search for the maximum flow until the optimization conditions are met.
In a PEC environment, there will be certain changes in PEC, such as the number of user requests, the access costs, the load capacity of edge nodes and the number of edge nodes.However, the structural changes in the graph associated with PEC are relatively small within every two adjacent time periods.Therefore, we propose an incremental MCMF algorithm based on BP.By caching and reusing the last solution, only local operations are required to obtain the global optimal solution of the graph.
(2) Algorithm for solving MCMF graph BP algorithm is message-transmission algorithm based on factor graph model.By updating the information of nodes, BP algorithm updates the state of an entire network until the network stabilizes.The efficiency of message transmission plays a crucial role in BP algorithm.This section discusses the incremental MCMF algorithm based on BP, which reduces the network and computational costs and supports dynamic deployment by only sending the changed messages.
In a factor graph, there are two types of nodes: variable node x i and constraint node f(a).Correspondingly, there are two types of messages on undirected edge (i,α) at time t, namely message m(i,a,x i ,t) sent by x i to f(a), and message g(a,i,x i ,t) sent by f(a) to x i .The message description based on increment is as follows.
where k ∈ N (i)\a denotes the set of constraint nodes connected to x i except for f(a), j ∈ N (a)\i denotes the set of variable nodes connected to f(a) except for x i , and let �m(i, a, x i , 0) = 0, �m(k, i, x i , 0) = m(k, i, x i , 0) ,g(a, i, x j , 0) = 0.
For graph G, f denotes its minimum cost flow, and graph G' = (V', DE', CA', CO') denotes the graph after its local changes.By further optimizing the minimum cost flow f, the incremental minimum cost flow algorithm obtains the minimum cost flow f 'of graph G' according to the factor graph increments and the (17) �m(i, a, x i , t) = k∈N (i)\a �m(k, i, x i , t − 1), (18) m(i, a, x i , t) = m(i, a, x i , t − 1) + �m(i, a, x i , t), (19) �g(a, i, x j , t) = j∈N (a)\i �m j, a, x j , t , (20) g(a, i, x j , t) = g(a, i, x j , t − 1) + �g(a, i, x j , t), message increments.The details can be found in Algorithm 2.
Lines 2-3 generate the factor graphs and the minimum cost flow for the initial graph G; lines 4-8 detect the state change events, update the graph structure when events occur, and solve the updated graph; lines 11-27 are the main body of the incremental minimum cost flow algorithm based on belief propagation, with the main idea of calculating the minimum cost eigenvalues while ensuring the maximum flow constraint; lines 30-35 are incremental iteration operations, which specifically include the calculation of the factor graph increments and the message increments.

Algorithm 2. Incremental MCMF based on BP
For BP algorithm, the schedule for updating messages is crucial to its convergence.In Algorithm 2, we address the question of how to schedule messages for asynchronous propagation to attempt to reach convergence.Procedure IncrementalMsgUpdating leverages a scheduling scheme that selects all incremental messages to update at a time.Additionally, an incremental update approach is introduced to accelerate the computation of message in Procedure BasicBPMCF.

Experimental settings
PeerSim [31] is an event simulator for large-scale distributed systems that supports P2P network architecture.To evaluate the performance of the proposed adaptive routing strategy, we conducted relevant simulation experiments on PeerSim.
The experiment use a cube-connected cycle graph [32] with 4*2 4 = 64 nodes as the network topology structure.Each node in the graph denotes an edge node.Given that each edge node is connected to 10 sensors and 10 users, there are a total of 640 different sensors and 640 different users in the network.Each edge node can provide data generated by the connected sensor nodes to users, and the farthest location for a request message to receive a response is at the edge node connected to the corresponding sensor node.
The experimental parameters are set as follows.The bandwidth and latency between adjacent edge nodes are 1 Mb/second and 1 ms, respectively.A sensor generates a new message with a size of 10 MB every 1 s.The probability of users requesting different sensor messages is the same.And the probability of users requesting messages generated by the same sensor at different times follows Zipf distribution, where let C = 1, 0.8 ≤ α ≤ 1.5 .Each user randomly requests 20 different sensor messages at the rate of 1 request/ second.Each edge node caches 2048 sensor messages and can accommodate 500 request messages.In each experiment, we take 5 samples with an interval of 60 s between each sampling.A total of 10 experiments were conducted, and the results were averaged.
According to the above settings, the total number of user request messages during the 5 sampling periods is tnr = 192000.

Performance metrics
By analyzing the formula (1, 2 and 3) involved in the optimization goals of the adaptive routing model, we can conclude that load(u,s) and delay(u,s,ev) are key factors that affect the performance of the system model.To evaluate the performance of different routing schemes, the following two performance evaluation metrics based on load(u,s) and delay(u,s,ev) are considered.
• Average access latency, adelay = 1 tnr • t∈T delay(u, s, ev) , which denotes the average delay spent from an user sending a request to receiving the corresponding sensor message.
• Average edge node load, aload = 1 tnr • t∈T load(u, s) , which denotes the average number of times that edge nodes directly connected to sensors provide services to users.
Based on these indicators, we can analyze both the efficiency of caching services provided by target edge nodes in ARPEC and the effectiveness of target edge nodes in alleviating service pressure on edge nodes directly connected to sensors.

Performance testing & analysis (1) Performance of request message processing algorithm
We adjust Zipf probability parameter α of request message to examine the performance trend of the request message processing algorithm.Because LCE, LCD, and Prob0.5 are three typical target node selection strategies that range from simple to complex, we compare the performance of ARPEC with that of LCE, LCD, and Prob0.5.The performance changes are shown in Fig. 3.
Figure 3a and b show that there are certain differences of the strategies and ARPEC outperforms these compared strategies in the two metrics.This is because user's requests for high-priority edge nodes become more frequent as the parameter α increases.Due to the lack of sensitivity of LCE, LCD, and Prob0.5 to changes in message activity and user's requests, performance improvement is limited.As message activity increases, sensor messages in edge nodes become more concentrated.By increasing the priority of the corresponding edge nodes, ARPEC can cache sensor messages on the reasonable edge nodes.
(2) Performance of incremental MCMF algorithm The experimental parameters are set as follows.First, by assigning a value greater than 1 to a, it indicates that users are more concerned about several sensors.On the contrary, the distribution of user requests is relatively uniform.So α reflects user's preference for sensor requests.Without loss of generality, let α = 1.Second, in each sampling period, the number of nodes with changes is less than 12; and the change pattern of nodes follows a uniform distribution.In Fig. 4, the trends of the incremental BP-based MCMF algorithm in terms of performance measurements are examined by adjusting the number of changing nodes, and the results are compared with the BasicBPMCF algorithm.
The average access latency difference between the two strategies shown in Fig. 4a is not significant, which indicates that the solution results of the two strategies are basically consistent.However, as shown in Fig. 4b, the efficiency of the incremental MCMF algorithm has been greatly improved, with an edge node load of approximately 50% of that of BasicBPMCF.This indicates that the incremental MCMF algorithm reduces network costs.This is because the incremental MCMF algorithm saves time in solving the maximum flow.Meanwhile, because the data in the network does not change much, the MCMF in the previous stage may already be very close to the optimal flow in this stage, and only a small amount of incremental information needs to be processed to achieve the optimal feasible flow.

Analysis of ARPEC application scenarios
ARPEC uses a grey model to predict the priority of edge nodes.For cases where priority data samples change rapidly, the sample quality may not be particularly good and the response speed may not meet user requirements.We can improve sample quality by adjusting the length of the priority sequence.However, due to the unpredictable statistical characteristics of the incoming user requests and sensor data, GreyPre may adjust the sample length multiple times and results in higher latency.Therefore, ARPEC is not suitable for applications with significant instantaneous changes in IoT and high requirements for realtime computing.
The requirements for updating node information in ARPEC should be met.Users can set the frequency of updating node information.If the frequency is higher, the number of adjustments to the minimum cost flow will increase.Due to the limited resources of edge nodes, in the worst case, the adjustment of the minimum cost flow still cannot meet the user's requirements for network traffic.So, it is considered that ARPEC cannot provide support for MCMF at the given frequency of updating node information.

Conclusion
In this paper, we propose an adaptive routing strategy in PEC, which can adapt to the temporal dynamic characteristics of routing demands and supports dynamic deployment.In order to improve the user experience and give full play to the overall performance of Edge Cloud, a routing optimization model is described from the perspectives of network traffic, user access delay, and edge node resource utilization.We implement two algorithms, the processing request messages algorithm based on grey prediction model, and the incremental MCMF algorithm based on BP algorithm.The evaluation results show that ARPEC can effectively improve PEC transmission performance and user experience.In the future, our research will focus on the following two aspects: the optimization technology of target node parameters based on machine learning, and the merging and filtering mechanisms to reduce the complexity of solving graph.

Fig. 1 A
Fig. 1 A typical PEC scenario

Fig. 2 A
Fig. 2 A MCMF graph for sensor data routing

Fig. 3 Fig. 4
Fig. 3 Performance changes with α under different strategies.a Average access latency.b Average edge node load