Dynamic routing method and device applied to grid network, equipment and storage medium
By taking the row where the source node is located as the starting point in the grid network and performing multiple rounds of path optimization and update processing row by row, and utilizing the topological structure characteristics of the grid network, the problem of low computational efficiency of traditional algorithms in regular grid networks is solved, and the communication efficiency and real-time performance are improved.
Patent Information
- Application Number
- CN202510801797.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-16
- Publication Date
- 2025-09-05
AI Technical Summary
Traditional shortest path algorithms have low computational efficiency in regular grid networks and are unable to meet the real-time path update requirements of satellite communication networks, affecting the real-time and overall performance of the communication system.
By taking the row where the source node is located as the starting point in the grid network, performing multiple rounds of path optimization and updating processing row by row, and utilizing the topological structure characteristics of the grid network, the shortest path from the source node to each target node is calculated.
It improves the efficiency of shortest path calculation, reduces update delays when network topology changes, improves the real-time performance and reliability of network operation, and improves communication efficiency.
Smart Images

Figure CN120602397A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of network topology, and in particular to a dynamic routing method, apparatus, device, and storage medium applied to a grid network. Background Art
[0002] In graph theory, the shortest path problem is a classic optimization problem. Its goal is to find a path from a source node to all nodes such that the path distance from the source node to all other nodes is the shortest. Traditional shortest path algorithms, such as the Dijkstra algorithm, gradually select the currently undetermined nodes closest to the source node, ultimately generating a shortest path tree from the source node to all nodes. The Dijkstra algorithm is versatile and applicable to path generation in any scenario, but it may suffer from computational inefficiency in certain specific scenarios.
[0003] For example, in a regular grid network, each node is connected to its adjacent nodes above, below, and to the left and right via weighted edges, forming a spatially regular grid structure. However, when using the Dijkstra algorithm in grid networks, it only selects local optimal paths and fails to fully utilize the topological characteristics of the specific network structure for optimization, resulting in low efficiency in generating the shortest path.
[0004] In specific scenarios, such as satellite communication networks, the network topology exhibits a regular grid structure, with each satellite node connected to adjacent satellite nodes via weighted edges, forming a regular but dynamically changing topology. Because link weights in satellite communication networks are affected by factors such as transmission latency, bandwidth, and congestion, the network topology frequently changes, requiring frequent path updates. Existing shortest path algorithms face a heavy computational burden in such structured and dynamically changing networks, making it difficult to meet the demands of real-time path updates. Therefore, in grid-structured satellite communication networks, traditional shortest path algorithms have limitations in computational efficiency, which can impact the real-time nature and overall performance of the communication system. Summary of the Invention
[0005] Based on the above problems, the embodiments of the present application provide a dynamic routing method, apparatus, device and storage medium applied to a grid network, with the aim of making full use of the topological characteristics of the grid network, improving the efficiency of shortest path calculation, and reducing the update delay when the network topology changes, thereby improving the real-time performance and reliability of network operation and achieving improved communication efficiency of the satellite communication network.
[0006] In a first aspect, embodiments of the present application provide a dynamic routing method applied to a grid network, including:
[0007] Obtaining network topology information of the grid network at the current moment; the network topology information includes path distances between nodes; the nodes include source nodes and target nodes; the target nodes refer to the remaining nodes in the grid network except the source node;
[0008] For the rsth row where the source node is located, determine the path and distance from the source node to each target node in the rsth row according to the network topology information;
[0009] Starting from the rs-1th row and the rs+1th row adjacent to the rsth row, multiple rounds of path optimization and update processing are performed row by row in the direction from the rs-1th row to the first row and from the rs+1th row to the last row, respectively, to determine the path and distance from the source node to each target node in the current row, until the path optimization and update processing of the first row and the last row are completed;
[0010] For the current row, the multiple rounds of path optimization and update processing specifically include:
[0011] Repeatedly change the candidate parent node of each target node in the current row to a neighboring node of each target node, calculate the current path distance from the source node through the candidate parent node of each target node to each target node, and if the calculated path distance from the source node to the target node is less than the original path distance from the source node to the target node, update the parent node of the target node to the current candidate parent node, and update the path distance from the source node to the target node;
[0012] Set the candidate parent node of each vertically adjacent node of the target node in the current row as the target node, calculate the current path distance from the source node through the candidate parent node to the vertically adjacent node, and if the calculated path distance from the source node to the vertically adjacent node is less than the original path distance from the source node to the vertically adjacent node, update the parent node of the vertically adjacent node to the target node and update the path distance from the source node to the vertically adjacent node, and insert the vertically adjacent node into the processing queue;
[0013] The head node is taken from the processing queue, and the following update tracking operation is performed on each adjacent node adjacent to the head node and having undergone path optimization update processing:
[0014] Set the candidate parent node of the adjacent node of the team head node as the team head node, and calculate the current path distance from the source node through the team head node to the adjacent node;
[0015] If the calculated path distance from the source node to the adjacent node is less than the original path distance from the source node to the adjacent node, then updating the parent node of the adjacent node to the current head node of the queue and updating the path distance from the source node to the adjacent node, and inserting the adjacent node into the processing queue;
[0016] The first node is continuously taken out from the processing queue, and the update tracking operation is performed on each adjacent node of the first node that has undergone path optimization update processing until the processing queue is empty.
[0017] In one embodiment, determining, for the rsth row where the source node is located, the path and distance from the source node to each target node in the rsth row according to the network topology information includes:
[0018] For each target node on the left side of the source node in the rsth row where the source node is located, set the parent node of the target node to the right node of the target node, and update the path distance from the source node to each target node;
[0019] For each target node located to the right of the source node in the rsth row where the source node is located, the parent node of the target node is set to the left node of the target node, and the path distance from the source node to each target node is updated.
[0020] In one embodiment, starting from row rs-1 and in a direction from row rs-1 to row 1, the process of repeatedly changing the candidate parent node of each target node in the current row to a neighboring node of each target node, calculating the current path distance from the source node through the candidate parent node of each target node to each target node, and if the calculated path distance from the source node to the target node is less than the original path distance from the source node to the target node, updating the parent node of the target node to the current candidate parent node and updating the path distance from the source node to the target node specifically includes:
[0021] For each target node in the current row, set the parent node of the target node to the child node of the target node, and update the path distance from the source node to the target node;
[0022] For each target node in the current row except the leftmost target node, set the candidate parent node of the target node to the left node of the target node in order from left to right, and calculate the path distance from the source node through the candidate parent node to the target node;
[0023] If the calculated path distance from the source node to the target node is less than the original path distance from the source node to the target node, then the parent node of the target node is updated to be the left node of the target node, and the path distance from the source node to the target node is updated;
[0024] For each target node in the current row except the rightmost target node, set the candidate parent node of the target node as the right node of the target node in order from right to left, and calculate the path distance from the source node through the candidate parent node to the target node;
[0025] If the calculated path distance from the source node to the target node is less than the original path distance from the source node to the target node, the parent node of the target node is updated to the right node of the target node, and the path distance from the source node to the target node is updated.
[0026] In one embodiment, starting from the rs+1th row and in the direction from the rs+1th row to the last row, the candidate parent node of each target node in the current row is changed to a neighboring node of each target node for multiple rounds, and the current path distance from the source node through the candidate parent node of each target node to each target node is calculated. If the calculated path distance from the source node to the target node is less than the original path distance from the source node to the target node, the parent node of the target node is updated to the current candidate parent node, and the path distance from the source node to the target node is updated, specifically including:
[0027] For each target node in the current row, set the parent node of the target node as the parent node of the target node, and update the path distance from the source node to the target node;
[0028] For each target node in the current row except the leftmost target node, set the candidate parent node of the target node to the left node of the target node in order from left to right, and calculate the path distance from the source node through the candidate parent node to the target node;
[0029] If the calculated path distance from the source node to the target node is less than the original path distance from the source node to the target node, then the parent node of the target node is updated to be the left node of the target node, and the path distance from the source node to the target node is updated;
[0030] For each target node in the current row except the rightmost target node, set the candidate parent node of the target node as the right node of the target node in order from right to left, and calculate the path distance from the source node through the candidate parent node to the target node;
[0031] If the calculated path distance from the source node to the target node is less than the original path distance from the source node to the target node, the parent node of the target node is updated to the right node of the target node, and the path distance from the source node to the target node is updated.
[0032] In one embodiment, if the target node is located in any row from row rs-1 to row 1, the vertical adjacent node of the target node is the next node of the target node;
[0033] If the target node is located in any row from the rs+1th row to the last row, the vertical adjacent node of the target node is the upper node of the target node.
[0034] In a second aspect, an embodiment of the present application further provides a dynamic routing device applied to a grid network, comprising:
[0035] The first module obtains the network topology information of the grid network at the current moment; the network topology information includes the path distance between each node; the nodes include source nodes and target nodes; the target nodes refer to the remaining nodes in the grid network except the source node;
[0036] The second module is configured to determine, for the rsth row where the source node is located, a path and a distance from the source node to each target node in the rsth row according to the network topology information;
[0037] A third module is configured to perform multiple rounds of path optimization and update processing on each row, starting from the rs-1th row and the rs+1th row adjacent to the rsth row, in a direction from the rs-1th row to the first row and from the rs+1th row to the last row, respectively, to determine the path and distance from the source node to each target node in the current row, until the path optimization and update processing for the first and last rows is completed;
[0038] For the current row, the multiple rounds of path optimization and update processing specifically include:
[0039] Repeatedly change the candidate parent node of each target node in the current row to a neighboring node of each target node, calculate the current path distance from the source node through the candidate parent node of each target node to each target node, and if the calculated path distance from the source node to the target node is less than the original path distance from the source node to the target node, update the parent node of the target node to the current candidate parent node, and update the path distance from the source node to the target node;
[0040] Set the candidate parent node of each vertically adjacent node of the target node in the current row as the target node, calculate the current path distance from the source node through the candidate parent node to the vertically adjacent node, and if the calculated path distance from the source node to the vertically adjacent node is less than the original path distance from the source node to the vertically adjacent node, update the parent node of the vertically adjacent node to the target node and update the path distance from the source node to the vertically adjacent node, and insert the vertically adjacent node into the processing queue;
[0041] The head node is taken from the processing queue, and the following update tracking operation is performed on each adjacent node adjacent to the head node and having undergone path optimization update processing:
[0042] Set the candidate parent node of the adjacent node of the team head node as the team head node, and calculate the current path distance from the source node through the team head node to the adjacent node;
[0043] If the calculated path distance from the source node to the adjacent node is less than the original path distance from the source node to the adjacent node, then updating the parent node of the adjacent node to the current head node of the queue and updating the path distance from the source node to the adjacent node, and inserting the adjacent node into the processing queue;
[0044] The first node is continuously taken out from the processing queue, and the update tracking operation is performed on each adjacent node of the first node that has undergone path optimization update processing until the processing queue is empty.
[0045] In a third aspect, an embodiment of the present application further provides a computer device, including:
[0046] CPU, memory, input and output interfaces;
[0047] The memory is a transient storage memory or a persistent storage memory;
[0048] The central processing unit is configured to communicate with the memory and execute instruction operations in the memory to perform the dynamic routing method applied to the grid network described in the first aspect of the embodiment of the present application or any specific implementation of the first aspect.
[0049] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, it executes the dynamic routing method applied to a grid network described in the first aspect of the embodiment of the present application or any specific implementation method of the first aspect.
[0050] It can be seen from the above technical solutions that the embodiments of the present application have the following advantages:
[0051] The present embodiment of the present invention first determines the path from the source node to each target node in the source node's row, starting from the source node's row in the grid network. Subsequently, multiple rounds of path optimization and update processing are performed row by row, both above and below the source node's row. This fully utilizes the topological structure of the grid network structure to calculate the shortest path from the source node to each target node in a shorter time, improving the efficiency of shortest path calculation and ultimately expected to improve communication efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0052] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are merely embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying any creative work.
[0053] Figure 1 A schematic diagram of a grid network structure provided in an embodiment of the present application;
[0054] Figure 2 A schematic flow chart of a dynamic routing method applied to a grid network provided in an embodiment of the present application;
[0055] Figure 3 The processing provided in the embodiment of this application is completed Figure 1 Schematic diagram of the result after the row where the source node is located;
[0056] Figure 4 A schematic diagram of a Try_to_Improve operation process provided in an embodiment of the present application;
[0057] Figure 5 A schematic diagram showing a comparison before and after a Try_to_Improve operation provided in an embodiment of the present application;
[0058] Figure 6 A schematic diagram of a Trace_Change operation process provided in an embodiment of the present application;
[0059] Figure 7 A schematic diagram showing a comparison before and after a Trace_Change operation provided in an embodiment of the present application;
[0060] Figure 8 A method for Figure 1 Schematic diagram of the process steps for performing multiple rounds of path optimization and update on the row below the source node;
[0061] Figure 9 A method corresponding to the embodiment of the present application is provided Figure 1 The shortest path diagram;
[0062] Figure 10 A schematic diagram of the structure of a dynamic routing device applied to a grid network provided in an embodiment of the present application;
[0063] Figure 11 A schematic diagram of the computer device structure provided in an embodiment of the present application. DETAILED DESCRIPTION
[0064] The following will be combined with the drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.
[0065] In graph theory, the shortest path problem is a classic optimization problem. Its goal is to find a path from a source node to all nodes such that the total path weight is minimized. Traditional shortest path algorithms, such as the Dijkstra algorithm, gradually select the currently undetermined nodes closest to the source node, ultimately generating a shortest path tree from the source node to all nodes. The Dijkstra algorithm is versatile and applicable to path generation in any scenario. However, its design does not fully consider the structural characteristics of specific networks, and may suffer from computational inefficiencies in certain scenarios.
[0066] For example, in a regular grid network, each node is connected to its adjacent nodes above, below, and to the left and right via weighted edges, forming a spatially regular grid structure. However, the Dijkstra algorithm only selects local optima during calculation, failing to fully utilize the topological characteristics of a specific network structure for optimization. This results in low efficiency in generating the shortest path in some scenarios.
[0067] Based on this, in each embodiment of the present application, by fully utilizing the structural characteristics of the grid network, the shortest path from the source node to each target node can be calculated more quickly.
[0068] A grid network is a network consisting of nodes arranged in a grid pattern, where each node may be directly connected to its neighboring nodes. Figure 1 , Figure 1 A schematic diagram of a grid network. Figure 1 In the diagram, each circle represents a node, and the number in the circle represents the node number. The line segment between two nodes represents the link between the two nodes, and the number in the line segment represents the length of the link.
[0069] The grid network has only one source node. Figure 1 In the figure, the source node is node 6. In addition, the links in the first and last rows of the grid network, as well as the links in the first and last columns, are disconnected. Nodes within a grid network usually have four neighboring nodes, namely, the upper, lower, left, and right nodes. For example, node 7 has four neighboring nodes: upper node 3, lower node 11, left node 6, and right node 8. For nodes at the edge (nodes 1-5, 8, 9, 12-16 in the figure above), due to the disconnection of the links, their neighboring nodes are reduced accordingly from the original four neighboring nodes. For example Figure 1 Node 16 in is only connected to the upper node 12 and the left node 15, and has no links to nodes 4 and 13. In a grid network, the link length (the distance between adjacent nodes) can be any positive value.
[0070] Grid networks have a simple structure, are easy to implement, and maintain, and therefore have broad applications in various fields. For example, in satellite communications, the distribution of satellites in space can be simplified as a grid network model. Typically, each satellite communicates with its four neighbors, which is consistent with the structural characteristics of a grid network. Therefore, grid networks have important application value in satellite communications.
[0071] In a grid network, its shape is usually a rectangle. In order to more clearly illustrate the embodiments of this application, the following concepts are defined:
[0072] (1) height: indicates the number of rows in the grid network, such as Figure 1 In the example, height=4.
[0073] (2)width: indicates the number of columns in the grid network, such as Figure 1 In the middle, width=4.
[0074] (3) The rsth row: indicates the row where the source node is located, such as Figure 1, rs = 2. Here, rs can be understood as the row index of the source vertex, that is, it indicates the row where the source node is located.
[0075] (4) Column cs: indicates the column where the source node is located, such as Figure 1 In the example, cs = 2. Here, cs can be understood as the column index of source vertex, that is, the column where the source node is located.
[0076] (5) Node (x, y): represents the node at row x and column y, as in Figure 1 In the example, node (3, 2) is node 10; the source node can be represented as node (rs, cs), such as node (2, 2) is source node 6.
[0077] (6) Parent node: For a node P(x, y), its parent node refers to the node immediately before the node P in the path from the source node to the node P. For example, refer to Figure 9 , assuming the path from the source node to node 9 is: 6→
[0078] 10→9, then in this path, the previous node before node 9 is node 10, so the parent node of node 9 is node 10.
[0079] (7) Parent(x, y) or Parent(node P): represents the parent node of node P(x, y). For example, refer to Figure 9 , assuming that the path from the source node to node 9 is: 6→10→9, then in this path, the parent node of node 9 is node 10, node 9 can be represented as node (3, 1), and node 10 can be represented as node (3, 2), then Parent (3, 1) = node (3, 2).
[0080] (8) W(node P1, node P2): represents the link length between node P1 and node P2, as shown in Figure 1 In the example, W(node 6, node 10)=2.
[0081] (9) D(x, y) or D(node P): represents the currently calculated path distance value from the source node to the node P(x, y).
[0082] The following is a further detailed description of the various embodiments of the present application in conjunction with the accompanying drawings.
[0083] The present application embodiment provides a dynamic routing method applied to a grid network, such as Figure 2 As shown, the method includes steps S201-S203.
[0084] S201: Obtain network topology information of the grid network at the current moment.
[0085] In many real-world applications (such as the Internet of Vehicles, the Internet of Things, and wireless networks), network topology changes over time, for example, due to changes in communication connections. To optimize network performance in real time and adapt to dynamically changing network conditions, the latest network status can be reflected by obtaining network topology information at the current moment. Network topology information not only includes the connection relationships between nodes (such as which nodes are directly connected), but also the path distances between nodes. Path distances can be determined based on physical distance (such as spatial location), communication overhead (such as latency, bandwidth), or other weighted values.
[0086] In a grid network, these nodes include source nodes and target nodes. Here, target nodes refer to all nodes in the grid network except the source node. A source node is the starting point for initiating operations or data transfers in network topology operations, while a target node is the node that needs to interact with the source node.
[0087] S202: For the rsth row where the source node is located, determine the path and distance from the source node to each target node in the rsth row according to the network topology information.
[0088] Finished Figure 1 The results after the source node can be referred to Figure 3 .exist Figure 3 In the example, the red node "6" is the source node, and the rsth row where the source node is located consists of nodes 5 to 8. Nodes 5, 7, and 8 are the target nodes in the rsth row.
[0089] The network topology information (i.e. Figure 1 Based on the connection relationship between each node and its path distance in the row, step S202 of the embodiment of the present application takes node 6 as the starting point and calculates the path and distance from the source node to each target node in the same row.
[0090] The path from the source node to each target node in the rsth row obtained after step S202 is as follows:
[0091] Source node 6 → node 5: the path is [6 → 5], and the path distance is 7;
[0092] Source node 6 → node 7: the path is [6 → 7], and the path distance is 10;
[0093] Source node 6 → node 8: The path is [6 → 7 → 8], and the path distance is 10 + 1 = 11.
[0094] It should be noted that, for ease of understanding Figure 3The diagram shows the path calculation process. Arrows with directional indicators are used in the diagram. However, in actual applications, the connections between nodes in a grid network are undirected edges and have no directionality. The arrows in the diagram are only used for auxiliary illustration and do not affect the essential logic of path calculation. Figure 5 、 Figure 7 、 Figure 8 and Figure 9 Similarly, I will not go into details later.
[0095] S203: Starting from the rs-1th row and the rs+1th row adjacent to the rsth row, multiple rounds of path optimization and update processing are performed row by row in the direction from the rs-1th row to the first row and from the rs+1th row to the last row, respectively, to determine the path and distance from the source node to each target node in the current row, until the path optimization and update processing of the first row and the last row are completed;
[0096] It should be noted that the path optimization of each row in step S203 is not completed in one go, but is continuously optimized through multiple rounds of update iterations. The multiple rounds of path optimization update processing are specifically described in the first and second parts as follows:
[0097] Part 1: Repeatedly change the candidate parent node of each target node in the current row to the neighboring node of each target node, calculate the current path distance from the source node through the candidate parent node of each target node to each target node, and if the calculated path distance from the source node to the target node is less than the original path distance from the source node to the target node, update the parent node of the target node to the current candidate parent node, and update the path distance from the source node to the target node.
[0098] Part 2: Set the candidate parent node of each vertically adjacent node of the target node in the current row as the target node, calculate the current path distance from the source node through the candidate parent node to the vertically adjacent node, and if the calculated path distance from the source node to the vertically adjacent node is less than the original path distance from the source node to the vertically adjacent node, update the parent node of the vertically adjacent node to the target node and update the path distance from the source node to the vertically adjacent node, and insert the vertically adjacent node into the processing queue;
[0099] The head node is taken from the processing queue, and the following update tracking operation is performed on each adjacent node adjacent to the head node and having undergone path optimization update processing:
[0100] Set the candidate parent node of the adjacent node of the team head node as the team head node, and calculate the current path distance from the source node through the team head node to the adjacent node;
[0101] If the calculated path distance from the source node to the adjacent node is less than the original path distance from the source node to the adjacent node, then updating the parent node of the adjacent node to the current head node of the queue and updating the path distance from the source node to the adjacent node, and inserting the adjacent node into the processing queue;
[0102] The first node is continuously taken out from the processing queue, and the update tracking operation is performed on each adjacent node of the first node that has undergone path optimization update processing until the processing queue is empty.
[0103] For example, Figure 3 For example, assume that in the previous step S202, the paths and distances from source node 6 to all target nodes (i.e., nodes 5, 7, and 8) in the same row (i.e., row rs) have been calculated. In step S203, taking the direction from row rs-1 to row 1 as an example, path optimization starts from row rs-1, which is adjacent to row rs (including target nodes 1 to 4). Relying on the existing path information in row rs, the path from the source node to the target nodes in row rs-1 is optimized and updated.
[0104] Specifically, for any target node A in row rs-1, the candidate parent node of target node A is changed to a neighboring node of target node A. When a new path is generated from the source node to target node A via the candidate parent node of target node A, the distance of this new path is compared with the distance of the currently recorded path to target node A. If the new path is shorter, the parent node of target node A is updated to be the candidate parent node of target node A, and the new path distance is also updated. This process iteratively generates new paths and compares path distances over multiple rounds, using the neighboring nodes of different target nodes as candidate parent nodes of the target node. Each round may find a shorter path, thus continuously approaching the optimal solution.
[0105] After determining the path and distance to each target node in row rs-1, continue to optimize the path of each target node's vertically adjacent nodes in row rs-1 (such as each target node in row rs). Specifically, each target node in row rs-1 is used as a candidate parent node for its vertically adjacent node to see if a shorter path can be formed. If the constructed new path from the source node through the current target node to the vertically adjacent node is shorter, then the parent node of the vertically adjacent node is updated to the current target node (at this time, the path to the vertically adjacent node has also been updated accordingly based on the setting of the parent node of the vertically adjacent node), the path distance from the source node to the vertically adjacent node is updated, and the vertically adjacent node is added to the processing queue.
[0106] It can be understood that once there is a shorter new path from the source node to a target node B, the new path may further affect the path of the adjacent node of the target node B. Therefore, the target node B can be added to the processing queue to track whether the path to the adjacent node of the target node B is affected by the new path and a shorter path exists.
[0107] Next, the first node is removed from the processing queue, and the candidate parent node of each adjacent node (including at least one of the left, right, upper, and lower nodes of the first node) that is adjacent to the first node and has undergone path optimization and update processing is set as the first node. If the calculated path distance from the source node through the first node to one of the adjacent nodes C of the first node is shorter than the currently recorded path distance to the adjacent node C, the parent node of the adjacent node C is updated to the current first node, and the path distance from the source node to the adjacent node C is updated. Accordingly, the adjacent node C also needs to be added to the processing queue. As the paths to more target nodes are optimized, the processing queue may continue to add new nodes to be processed; when the processing queue is empty, the multi-round path optimization processing of the rs-1 row is completed.
[0108] After completing the path optimization and update process for row rs-1, continue processing the previous row, row rs-2 (if any), and repeat the above path optimization and update process. This process continues row by row until the first row is processed. Finally, the path and distance from the source node to each target node in the range from row rs-1 to the first row are obtained.
[0109] In an embodiment of the present application, the operation of "changing the candidate parent node of the current row target node to a neighboring node of the target node, calculating the current path distance from the source node through the candidate parent node of the target node to the target node, and if the calculated path distance to the target node is less than the original path distance from the source node to the target node, then updating the parent node of the target node to the candidate parent node of the current target node, and updating the path distance from the source node to the target node" can also be expressed as a Try_to_Improve operation, specifically:
[0110] Try_to_Improve(source_point, des_point, candidate_parent_point)
[0111] The goal of the try_to_improve operation is to try to improve the path distance from the source node source_point to the target node des_point. The three inputs in try_to_improve are all nodes, where source_point represents the source node, des_point represents the target node, and candidate_parant_point represents the candidate parent node.
[0112] Please refer to Figure 4 , Figure 4 This is a schematic diagram of the Try_to_Improve operation flow. The specific execution logic of Try_to_Improve(source_point, des_point, candidate_parant_point) includes: when the parent node of the target node des_point is set as the candidate parent node candidate_parant_point, determine whether the path distance from the source node source_point to the target node des_point can be reduced. If the path distance is shorter, set the currently set candidate parent node candidate_parant_point as the parent node of the target node des_point, and update the distance from the source node source_point to the target node des_point to the path distance from the source node source_point through the currently selected candidate parent node candidate_parant_point to the target node des_point. If the path from the source node source_point to the target node des_point does not become shorter (that is, the path distance through the candidate parent node candidate_parant_point to the target node des_point is not less than the previously recorded path distance to the target node des_point), the parent node of the target node des_point remains unchanged (that is, the currently set candidate parent node candidate_parant_point will not be set as the parent node of the target node des_point), and the path distance from the source node to the target node also remains unchanged.
[0113] For example, please refer to Figure 5 Subgraph (b) of Figure 5 Figure (a) shows the result after executing the Try_to_Improve operation. Figure 5For example, let's execute the Try_to_Improve(source node, node 2, node 3) operation. The logic is as follows: Set node 2's candidate parent to node 3. The path distance from the source node through node 3 to node 2 is 3 + 5 = 8, which is less than the original distance from the source node through node 1 to node 2: 5 + 4 = 9. Therefore, node 2's parent is updated to the currently selected candidate parent node, node 3, and the path distance from the source node to node 2 is updated to 8.
[0114] In an embodiment of the present application, "the head node is taken out from the processing queue, and the following update tracking operation is performed for each adjacent node adjacent to the head node and that has undergone path optimization and update processing: the candidate parent node of the adjacent node of the head node is set to the head node, and the current path distance from the source node through the head node to the adjacent node is calculated; if the calculated path distance from the source node to the adjacent node is less than the original path distance from the source node to the adjacent node, the parent node of the adjacent node is updated to the current head node and the path distance from the source node to the adjacent node is updated, and the adjacent node is inserted into the processing queue; the head node is taken out from the processing queue continuously, and the update tracking operation is performed for each adjacent node of the head node that has undergone path optimization and update processing until the processing queue is empty." This process can be called a Trace_Change operation. Figure 6 As shown, Figure 6 This is a flowchart of the Trace_Change operation.
[0115] The core function of the Trace_Change operation is to track the changes caused by the reduction of the path distance from the source node to a certain target node. Among them, the input source_point of Trace_Change (source_point, queue) is the source node, and queue is a processing queue that stores the nodes to be processed. When performing the Trace_Change operation, first take out the head node P from the processing queue, and then perform the operation Try_to_Improve (source_point, the neighboring node of the head node, the head node) on each adjacent node adjacent to the head node P and that has undergone path optimization and update processing. If the path distance from the source node to a neighboring node of the head node is reduced, the neighboring node is inserted into the processing queue. If the processing queue is not empty, repeat the previous operation until the processing queue is empty; otherwise, the Trace_Change operation ends.
[0116] For example, please refer to Figure 7 , Figure 7 This is a comparison diagram before and after the Trace_Change operation. Figure 7 A simple grid network of the neutron graph (a), where the source node is node 1.
[0117] from Figure 7 From subgraph (a), we can see that the initial path and path distance are as follows:
[0118] Parent node: Parent(node2) = node1;
[0119] Parent(node3) = node1;
[0120] Parent(node4)=node3.
[0121] Path distance: D(node 1) = 0;
[0122] D(node 2) = 5;
[0123] D(node 3) = 1;
[0124] D(node 4)=2.
[0125] Link weight: W(node 1, node 2) = 5;
[0126] W(node1, node3) = 1;
[0127] W(node3, node4) = 1;
[0128] W(node4, node2)=2.
[0129] Assume that node 4 is currently in queue queue (i.e., queue = {node 4}), execute the operation Trace_Change (node 1, queue), and take out the first node (node 4). At this time, queue = {} (the queue is empty).
[0130] When judging the neighboring nodes adjacent to the first node P and having undergone path optimization update processing, Figure 7 As shown in subgraph (a), node 4's neighbors include nodes 2 and 3. Next, determine which of these two adjacent nodes have completed path optimization updates. As can be seen in the figure, both nodes 2 and 3 have arrows pointing to them, indicating that they have been assigned a parent node and the path distance from the source node to each has been calculated, meaning they have undergone path optimization updates. Therefore, both nodes 2 and 3 meet the "adjacent to the head node and have undergone path optimization updates" condition and can be used as neighboring nodes adjacent to the head node P and have undergone path optimization updates in the current Trace_Change operation.
[0131] Then, the operations Try_to_Improve(node1, node2, node4) and Try_to_Improve(node1, node3, node4) are executed on node2 and node3 respectively.
[0132] The following results are obtained:
[0133] ①Try_to_Improve(node1, node2, node4):
[0134] D(node 2) = D(node 4) + W(node 4, node 2) = 2 + 2 = 4, which is less than the original path distance D(node 2) = 5. Therefore, Parent(node 2) is updated to node 4, and D(node 2) = 4. Node 2 is inserted into queue, and queue = {node 2}.
[0135] ②Try_to_Improve(node 1, node 3, node 4):
[0136] According to subgraph (a), the initial path from source node 1 to target node 4 is 1→3→4, and the total path distance D(node 4)=2.
[0137] When executing the Try_to_Improve operation, the operator is actually determining whether a shorter path distance can be achieved via the path "node 1 → node 3 → node 4 → node 3" after setting node 3's candidate parent node to node 4. The calculation result is: D(node 3) = D(node 4) + W(node 4, node 3) = 2 + 1 = 3, which is not less than the path distance D(node 3) = 1 in the previously recorded initial path. Therefore, node 3's parent node remains node 1, and D(node 3) remains 1. In other words, the path and distance from the source node to node 3 remain unchanged.
[0138] In addition, it should be pointed out that in a grid network, since the link distances between nodes are all positive, the loop path (such as node 1 → node 3 → node 4 → node 3) is usually not shorter than the direct path (such as node 1 → node 3).
[0139] After completing the above two Try_to_Improve operations, it is detected that the processing queue queue is not empty, so the first node of the queue is taken out to obtain node 2. At this time, queue = {} (the queue is empty).
[0140] Similarly, the neighboring nodes adjacent to node 2 that have undergone path optimization and update processing include node 1 and node 4. The Try_to_Improve operation is performed on node 1 and node 4 respectively:
[0141] ①Try_to_Improve(node1, node1, node2):
[0142] In fact, in Figure 7 The source node source_point is node 1, and its path distance is usually fixed to 0, and generally no parent node is set, or it is set to null (invalid). The path of the source node should not be covered by other nodes. Using the source node as the successor node of a target node may lead to the construction of a loop path (such as: node 1 → node 2 → node 1). This type of loop path is not only invalid, but also may cause an infinite loop or redundant calculation in the implementation without necessary code judgment. When the link length of the grid network is an arbitrary positive value, the path distance of this type of loop path is obviously impossible to be better than the original path distance value of the source node (i.e., 0); therefore, in the actual Try_to_Improve operation, it is not necessary to calculate and process this type of loop path.
[0143] ②Try_to_Improve(node1, node4, node2):
[0144] D(node 4) = D(node 2) + W(node 2, node 4) = 5 + 2 = 7, which is not less than the path distance D(node 4) = 2 of the originally recorded initial path. Therefore, the parent node of node 4 is still node 3, without change, and the path and distance from the source node to node 4 remain the same.
[0145] After completing the above Try_to_Improve, if the queue is empty, the Trace_Change operation ends and the final result is Figure 7 The result of subgraph (b).
[0146] based on Figure 2 In some specific examples, step S202 further includes step S2021 and step S2022.
[0147] For example, please refer to Figure 3 , Figure 3 Can be understood as targeting Figure 1 After executing the following steps S2021 and S2022 on the row where the source node is located, a result diagram of each target node in the range from the source node to the rsth row is obtained. Steps S2021 and S2022 are as follows:
[0148] S2021: For each target node located to the left of the source node in the rsth row where the source node is located, set the parent node of the target node to the right node of the target node, and update the path distance from the source node to each target node;
[0149] Specifically, for each target node located to the left of the source node in the rsth row where the source node is located, the following operations are performed in sequence from node (rs, cs-1) to node (rs, 1): set the parent node of the current target node to the right node of the target node (at this time, the path to the target node has also been updated accordingly according to the parent node setting of the current target node), and calculate the path distance from the source node through the right node of the target node to the target node, which is D (the target node).
[0150] S2022: For each target node located to the right of the source node in the rsth row where the source node is located, set the parent node of the target node to the left node of the target node, and update the path distance from the source node to each target node.
[0151] Specifically, for each target node located to the right of the source node in the rsth row where the source node is located, the following operations are performed in sequence from node (rs, cs+1) to node (rs, width): the parent node of the target node is set to the left node of the target node (at this time, the path to the target node has also been updated accordingly according to the parent node setting of the current target node), and the path distance from the source node through the right node of the target node to the target node is calculated, which is D (the target node).
[0152] In fact, Figure 3 For the rsth row where the source node is located, the parent node of the nodes to the left of the source node (such as node 5) is set to their right node (such as the parent node of node 5 is set to node 6); the parent node of the nodes to the right of the source node (such as node 7 and node 8) is set to their left node (such as the parent node of node 7 is set to node 6, and the parent node of node 8 is set to node 7).
[0153] After the above steps S2021 and S2022, the following can be obtained: Figure 3 The execution results are shown. For example, the path from the source node to node 8 is source node 6 → node 7 → node 8, and the path distance is 10 + 1 = 11. Result 1 below shows the parent node information of each target node after steps S2021 and S2022, as well as the path distance from the source node to each target node.
[0154] Result 1:
[0155] Parent(node 5)=node 6 D(node 5)=7
[0156] Parent(node 7) = node 6 D(node 7) = 10
[0157] Parent(node 8) = node 7 D(node 8) = 11
[0158] It should be pointed out that the parent node update operation of the target node on the left side of the row where the source node is located and the parent node update operation of the target node on the right side can be performed simultaneously or independently. They can be adjusted according to specific business needs, and the embodiments of the present application do not limit this.
[0159] It should be noted that, in practical applications, after completing step S202 (including steps S2021 and S2022), the embodiment of the present application can flexibly select the processing order of path optimization update.
[0160] One way is: start from the rs+1th row, and perform multiple rounds of path optimization update processing row by row from the rs+1th row to the last row; then start from the rs-1th row, and perform multiple rounds of path optimization update processing row by row from the rs-1th row to the first row.
[0161] The other way is the opposite: start from the rs-1th row, and perform multiple rounds of path optimization update processing row by row from the rs-1th row to the first row, and then start from the rs+1th row, and perform multiple rounds of path optimization update processing row by row from the rs+1th row to the last row.
[0162] It should be noted that although both processing orders described above can achieve path optimization and update processing, in actual applications, if the path optimization and update processing is performed simultaneously in two directions (i.e., the direction from row rs-1 to the first row and the direction from row rs+1 to the last row), conflicts and errors in path updates may occur. For example, Trace_Change operations in two directions may process the same node D at the same time, which may cause path information such as "the path and distance to node D" to be written into a conflict or be incorrectly overwritten, affecting the accuracy and generation efficiency of the final shortest path. Therefore, the two directions (i.e., the direction from row rs-1 to the first row and the direction from row rs+1 to the last row) should be executed serially in the processing order to ensure the correctness and controllability of the path optimization and update processing.
[0163] To further illustrate the path optimization and update process, the following will use the order of "first executing the direction from row rs+1 to the last row" as an example to specifically describe the execution process of step S203. In this example, it is assumed that the multi-round path optimization and update process is currently being executed starting from row rs+1 and running from row rs+1 to the last row, and the multi-round path optimization and update process from row rs-1 to the first row has not yet begun.
[0164] based on Figure 2In some specific examples, step S203 executed in the direction from the rs+1th row to the last row further includes steps S2031 to S2033 (corresponding to the first part of multiple rounds of path optimization update processing), step S301 (used to perform path optimization update processing on the vertically adjacent nodes of the target node), and steps S302 to S304 (used to perform an update tracking operation Trace_Change on step S301).
[0165] To more intuitively demonstrate the path optimization effect, please refer to Figure 8 , Figure 8 Shows the Figure 1 Schematic diagram of the steps for performing multiple rounds of path optimization and update processing on the target node in row rs+1. Taking the current row as row rs+1 as an example, steps S2031, S2032, S2033, S301, and S302-S304 are as follows:
[0166] S2031: For each target node in the current row, set the parent node of the target node as the parent node of the target node, and update the path distance from the source node to the target node;
[0167] Specifically, the parent node of node 9 is set to node 5, the parent node of node 10 is set to node 6, the parent node of node 11 is set to node 7, and the parent node of node 12 is set to node 8. In addition, the path distances from source node 6 to nodes 9, 10, 11, and 12 need to be updated.
[0168] Based on the above result 1, after step 2031, the following result 2 is obtained, that is, Figure 8 The result shown in sub-graph (b) is:
[0169] Parent(node 9) = node 5 D(node 9) = 11
[0170] Parent(node 10) = node 6 D(node 10) = 2
[0171] Parent(node11)=node7 D(node11)=20
[0172] Parent(node 12) = node 8 D(node 12) = 12
[0173] S2032: For each target node in the current row except the leftmost target node, set the candidate parent node of the target node as the left node of the target node in order from left to right, and calculate the path distance from the source node through the candidate parent node to the target node; if the calculated path distance from the source node to the target node is less than the original path distance from the source node to the target node, update the parent node of the target node to the left node of the target node, and update the path distance from the source node to the target node.
[0174] Specifically, based on the above result 2, the operation Try_to_Improve (source node, the target node, the left node of the target node) is performed on the target nodes (rs+1, 2), (rs+1, 3), ..., (rs+1, width) in sequence:
[0175] Try_to_Improve(node6, node10, node9);
[0176] Try_to_Improve(node6, node11, node10);
[0177] Try_to_Improve(node6, node12, node11);
[0178] After the above Try_to_Improve operation, we get the following result 3, which is Figure 8 The result shown in sub-graph (c) is:
[0179] Parent(node10)=node6D(node10)=2
[0180] Parent(node11)=node10D(node11)=3
[0181] Parent(node 12)=node 11D(node 12)=6
[0182] It should be noted that since node 9 does not have a left node, the candidate parent node setting operation cannot be performed, so the Try_to_Improve operation cannot be performed in this step.
[0183] S2033: For each target node in the current row except the rightmost target node, set the candidate parent node of the target node as the right node of the target node in order from right to left, and calculate the path distance from the source node through the candidate parent node to the target node; if the calculated path distance from the source node to the target node is less than the original path distance from the source node to the target node, update the parent node of the target node to the right node of the target node, and update the path distance from the source node to the target node.
[0184] Specifically, based on the above result 3, the operation Try_to_Improve (source node, the target node, the right node of the target node) is performed on the target nodes (rs+1, width-1), (rs+1, width-2), ..., (rs+1, 1) in sequence:
[0185] Try_to_Improve(node6, node11, node12)
[0186] Try_to_Improve(node6, node10, node11)
[0187] Try_to_Improve(node6, node9, node10)
[0188] After the above Try_to_Improve operation, the following result 4 is obtained, that is, Figure 8 The result shown in sub-graph (d) is:
[0189] Parent(node 9)=node 10 D(node 9)=5
[0190] Parent(node 10) = node 6 D(node 10) = 2
[0191] Parent(node11)=node10D(node11)=3
[0192] It should be noted that since node 12 does not have a right node, the candidate parent node setting operation cannot be performed, and therefore the Try_to_Improve operation cannot be performed in this step.
[0193] As can be seen from steps S2031 to S2033, this application uses multiple rounds of adjacent nodes of different target nodes as candidate parent nodes of the target node, and iteratively generates new paths and compares path distances. Each round may find a shorter path, thereby continuously approaching the optimal solution. Taking node 9 as an example, according to results 2 and 4, when the parent node of node 9 is node 10, the path distance from the source node to node 9 is 5, which is smaller than the path distance from the source node to node 9 of 11 when the parent node of node 9 is node 5 in step 2031. Therefore, the parent node of node 9 is set to node 10.
[0194] Step S301: Set the candidate parent node of the vertically adjacent node of each target node in the current row as the target node, calculate the current path distance from the source node through the candidate parent node to the vertically adjacent node, if the calculated path distance from the source node to the vertically adjacent node is less than the original path distance from the source node to the vertically adjacent node, then update the parent node of the vertically adjacent node to the target node and update the path distance from the source node to the vertically adjacent node, and insert the vertically adjacent node into the processing queue.
[0195] Specifically, the target node is located in any row from row rs+1 to row 1, and the vertically adjacent node of the target node is the parent node of the target node. Specifically, step S301 starts from the target node (rs+1, 1) and proceeds rightward to the target node (rs+1, width), executing the operation Try_to_Improve(source node, parent node of the target node, target node).
[0196] Taking nodes 9 to 12 in row rs+1 as an example, set the candidate parent node of node 9's vertical adjacent node (i.e., node 5) to node 9, the candidate parent node of node 10's vertical adjacent node (i.e., node 6) to node 10, the candidate parent node of node 11's vertical adjacent node (i.e., node 7) to node 11, and the candidate parent node of node 12's vertical adjacent node (i.e., node 8) to node 12, and perform the following operations respectively:
[0197] Try_to_Improve(node6, node5, node9)
[0198] Try_to_Improve(node6, node6, node10)
[0199] Try_to_Improve(node6, node7, node11)
[0200] Try_to_Improve(node6, node8, node12)
[0201] After the above Try_to_Improve operation, the following result 5 is obtained:
[0202] Parent(node 5)=node 6 D(node 5)=7
[0203] Parent(node 7) = node 6 D(node 7) = 10
[0204] Parent(node 8) = node 12 D(node 8) = 7
[0205] When the parent node of node 8 is set to node 12, the path distance to node 8 is 7, which is smaller than the previous path distance 11. Therefore, the parent node of node 8 is set to node 12, the path distance from the source node to node 8 is updated to 7, and node 8 is added to the processing queue.
[0206] In addition, it can be understood that the source node itself is the starting point of the path calculation, and it does not set the parent node, so the Parent (node 6) in the result of the operation Try_to_Improve (node 6, node 6, node 10) is empty or undefined, and D (node 6) is usually initialized to 0.
[0207] Step S302: Take the head node from the processing queue and perform the following update tracking operations on each adjacent node that is adjacent to the head node and has undergone path optimization and update processing:
[0208] Here, it is usually determined whether the processing queue is empty first. If not, the head node is taken out from the processing queue, and the following update tracking operation is performed on each adjacent node adjacent to the head node and has undergone path optimization update processing.
[0209] Step S303: setting the candidate parent node of the adjacent node of the team head node to the team head node, and calculating the current path distance from the source node through the team head node to the adjacent node; if the calculated path distance from the source node to the adjacent node is less than the original path distance from the source node to the adjacent node, updating the parent node of the adjacent node to the current team head node and updating the path distance from the source node to the adjacent node, and inserting the adjacent node into the processing queue;
[0210] Step S304: continuously extracting the head node from the processing queue and performing the update tracking operation on each adjacent node of the head node that has undergone path optimization and update processing until the processing queue is empty.
[0211] Taking nodes 9 to 12 in row rs+1 as an example, the result obtained in step S301 shows that the path distance from the source node to node 8 has changed. Therefore, node 8 is added to the processing queue queue. At this time, queue = {node 8}, and then the operation Trace_Change (node 6, queue queue) is executed, as follows:
[0212] First, take out the first node of the queue, that is, node 8. At this time, queue = {} (the queue is empty). All adjacent nodes of node 8 are nodes 4, 7, and 12. Since the current stage first performs path optimization update processing on the target nodes in the range from the rs+1th row to the last row, and has not yet processed the target nodes in the range from the rs-1th row to the first row, node 4 in the rs-1th row has not yet undergone path optimization update. Then, among all the adjacent nodes of node 8, only nodes 7 and 12 are adjacent nodes that have completed path optimization update and can be used as processing objects for this round of Trace_Change operation. Next, perform the operation Try_to_Improve (source node, adjacent node of the first node, first node) for nodes 7 and 12 respectively:
[0213] Try_to_Improve(node6, node7, node8)
[0214] Try_to_Improve(node6, node12, node8)
[0215] Executing the above Try_to_Improve operation yields the following result 6:
[0216] (1) After Try_to_Improve(node 6, node 7, node 8):
[0217] Parent(node 7)=node 8D(node 7)=8
[0218] It can be seen that the path distance D(node 7) = 8 from the source node to node 7 in the current result 6 has become shorter than D(node 7) = 10 in the original result 5. Therefore, the parent node of node 7 should be set to node 8 (at this time, the path from the source node to node 7 has also been updated accordingly according to the current parent node setting of node 7), and the path distance from the source node to node 7 is updated to 8, and node 7 is inserted into the processing queue queue, at this time queue = {node 7}.
[0219] (2) After Try_to_Improve(node 6, node 12, node 8):
[0220] Parent(node 12)=node 11D(node 12)=6
[0221] According to result 5, the parent node of node 8 has been set to node 12 instead of node 7. The path from source node 1 to target node 8 is node 6 → node 10 → node 11 → node 12 → node 8. The total path distance D(node 8) = 7.
[0222] When executing the Try_to_Improve operation, the operator is actually determining whether, after setting node 12's candidate parent node to node 8, a shorter path distance can be achieved via the path "node 6 → node 10 → node 11 → node 12 → node 8 → node 12." As explained in the description of the Trace_Change operation above, this loop path is not shorter than the direct path "node 6 → node 10 → node 11 → node 12." Therefore, node 12's parent node remains node 11, and D(node 12) remains 6. This means that the path and distance from the source node to node 12 remain unchanged.
[0223] After completing the Try_to_Improve operation, continue to determine whether the queue is empty. At this time, the queue is processed as {node 7}. If the queue is not empty, remove the first node (i.e., node 7). After removing node 7, the queue is processed as {} (the queue is empty).
[0224] The following Try_to_Improve operation is performed for each neighboring node (including node 6, node 8, and node 11) that is adjacent to node 7 and has undergone path optimization update processing:
[0225] Try_to_Improve(node6, node6, node7)
[0226] Try_to_Improve(node6, node8, node7)
[0227] Try_to_Improve(node 6, node 11, node 7)
[0228] Executing the above Try_to_Improve operation yields result 7:
[0229] Parent (node 8) = node 12D (node 8) = 7
[0230] Parent(node11)=node10D(node11)=3
[0231] In result 7, there is no path distance better than the previously calculated path distance from the source node to node 6 / node 8 / node 11, so the path information from the source node to these nodes remains unchanged, and the final result is Figure 8 The result of subgraph (e).
[0232] The contents of the above steps S2031 to S2033 and steps S301 to S304 introduce the path optimization and update processing process using the rs+1th row as an example. After completing the path optimization and update processing of the rs+1th row, the next row rs+2 (if any) will be used as the current row, and the path update optimization processing process of the above steps S2031 to S2033 and steps S301 to S304 will be repeated until the path optimization and update processing of the last row is completed.
[0233] based on Figure 2 In some specific examples, step S203 executed from row rs-1 to row 1 further includes steps S2034 to S2036 (corresponding to the first part of multiple rounds of path optimization and update processing), step S305 (for performing path optimization and update processing on vertically adjacent nodes of the target node), and steps S306 to S308 (for performing an update tracking operation Trace_Change on step S305):
[0234] S2034: For each target node in the current row, set the parent node of the target node as the child node of the target node, and update the path distance from the source node to the target node;
[0235] Taking row rs-1 as an example, step S2034 actually sets the parent node of each target node (nodes 1 to 4) in row rs-1 to the child node of the target node in that row (at this time, the path to the target node has also been updated accordingly based on the parent node setting of the current target node), and updates the path distance from the source node to the target node. The calculation formula for the path distance is:
[0236] D(the target node) = D(the target node's next node) + W(the target node's next node, the target node)
[0237] Specifically, the parent node of node 1 is set to node 5, the parent node of node 2 is set to node 6, the parent node of node 3 is set to node 7, and the parent node of node 4 is set to node 8. In addition, the path distance values from source node 6 to nodes 1, 2, 3, and 4 need to be updated.
[0238] Based on the above result 1, after step S2034, the following result 8 can be obtained:
[0239] Parent(node1)=node5 D(node1)=13
[0240] Parent(node 2) = node 6 D(node 2) = 4
[0241] Parent(node 3) = node 7 D(node 3) = 12
[0242] Parent(node 4) = node 8 D(node 4) = 15
[0243] S2035: For each target node in the current row except the leftmost target node, set the candidate parent node of the target node to the left node of the target node in order from left to right, and calculate the path distance from the source node through the candidate parent node to the target node; if the calculated path distance from the source node to the target node is less than the original path distance from the source node to the target node, update the parent node of the target node to the left node of the target node, and update the path distance from the source node to the target node;
[0244] Specifically, taking row rs-1 as an example, based on the above result 8, the operation Try_to_Improve (source node, the target node, the left node of the target node) is performed on the target nodes (rs-1, 2), (rs-1, 3), ..., (rs-1, width) in sequence:
[0245] Try_to_Improve(node6, node2, node1)
[0246] Try_to_Improve(node6, node3, node2)
[0247] Try_to_Improve(node6, node4, node3)
[0248] After the above Try_to_Improve operation, the following result 9 is obtained:
[0249] Parent(node 2) = node 6 D(node 2) = 4
[0250] Parent(node 3) = node 2 D(node 3) = 9
[0251] Parent(node 4) = node 8 D(node 4) = 15
[0252] It should be noted that since node 1 does not have a left node, the candidate parent node setting operation cannot be performed, so the Try_to_Improve operation cannot be performed in this step.
[0253] S2036: For each target node in the current row except the rightmost target node, set the candidate parent node of the target node as the right node of the target node in order from right to left, and calculate the path distance from the source node through the candidate parent node to the target node; if the calculated path distance from the source node to the target node is less than the original path distance from the source node to the target node, then update the parent node of the target node to the right node of the target node, and update the path distance from the source node to the target node.
[0254] Specifically, taking row rs-1 as an example, based on the above result 9, the operation Try_to_Improve (source node, the target node, the right node of the target node) is performed on the target nodes (rs-1, width-1), (rs-1, width-2), ..., (rs-1, 1) in sequence:
[0255] Try_to_Improve(node6, node1, node2)
[0256] Try_to_Improve(node6, node2, node3)
[0257] Try_to_Improve(node6, node3, node4)
[0258] After the above Try_to_Improve operation, the following result 10 is obtained:
[0259] Parent(node1)=node2 D(node1)=8
[0260] Parent(node 2) = node 6 D(node 2) = 4
[0261] Parent(node 3) = node 2 D(node 3) = 9
[0262] It should be noted that since node 4 does not have a right node, the candidate parent node setting operation cannot be performed, so the Try_to_Improve operation cannot be performed in this step.
[0263] Step S305: Set the candidate parent node of the vertically adjacent node of each target node in the current row as the target node, calculate the current path distance from the source node through the candidate parent node to the vertically adjacent node, if the calculated path distance from the source node to the vertically adjacent node is less than the original path distance from the source node to the vertically adjacent node, then update the parent node of the vertically adjacent node to the target node and update the path distance from the source node to the vertically adjacent node, and insert the vertically adjacent node into the processing queue.
[0264] It should be noted that the target node is located in any row from row rs-1 to row 1, and the vertical adjacent node of the target node is the next node of the target node.
[0265] And with Figure 3 For example, the rs-1 line in Figure 3 In fact, it is also the first row in the table. Assuming that the current row is row rs-1, then step S305 specifically starts from the target node (rs-1, 1) and goes right to the target node (rs-1, width), and performs the operation Try_to_Improve (source node, the next node of the target node, the target node). That is, the candidate parent node of the vertical adjacent node of node 1 (i.e., node 5) is set to node 1, the candidate parent node of the vertical adjacent node of node 2 (i.e., node 6) is set to node 2, the candidate parent node of the vertical adjacent node of node 3 (i.e., node 7) is set to node 3, and the candidate parent node of the vertical adjacent node of node 4 (i.e., node 8) is set to node 4, and the following operations are performed respectively:
[0266] Try_to_Improve(node6, node5, node1)
[0267] Try_to_Improve(node6, node6, node2)
[0268] Try_to_Improve(node6, node7, node3)
[0269] Try_to_Improve(node6, node8, node4)
[0270] After the above Try_to_Improve operation, the following result 11 is obtained:
[0271] Parent(node 5)=node 6 D(node 5)=7
[0272] Parent(node 7)=node 8 D(node 7)=8
[0273] Parent(node 8) = node 12 D(node 8) = 7
[0274] It can be seen that the path distance from the source node to each of the vertically adjacent nodes calculated by result 11 is not less than the original path distance from the source node to each of the vertically adjacent nodes, so the vertically adjacent nodes (i.e., node 5, node 7, node 8) will not be added to the processing queue. Then, when the subsequent step S306 determines whether the processing queue is empty, it will be determined that the current path optimization update processing for the rs-1th row, i.e., the 1st row, is completed because the processing queue is empty.
[0275] Step S306: Determine whether the processing queue is empty. If not, remove the head node from the processing queue and perform the following update tracking operations on each adjacent node that is adjacent to the head node and has undergone path optimization and update processing:
[0276] Step S307: setting the candidate parent node of the adjacent node of the head node to the head node, and calculating the current path distance from the source node through the head node to the adjacent node; if the calculated path distance from the source node to the adjacent node is less than the original path distance from the source node to the adjacent node, updating the parent node of the adjacent node to the current head node and updating the path distance from the source node to the adjacent node, and inserting the adjacent node into the processing queue;
[0277] Step S308: Continue to extract the head node from the processing queue and perform the update tracking operation on each adjacent node of the head node that has undergone path optimization and update processing until the processing queue is empty.
[0278] If the distance from the source node to a target node E changes during the Try_to_Improve (source node, the next node of the target node, the target node) operation in step S305, it is necessary to execute the update tracking operation Trace_Change of steps S306 to S308, insert the target node E into the processing queue queue, and execute the operation Trace_Change (source_point, queue). The processing process of steps S306-S308 can refer to the operations in steps S301-S304. The specific logic and examples have been described in the previous text, so the embodiment of this application will not be repeated here. Finally, the following can be obtained: Figure 9 The corresponding Figure 1 Schematic diagram of the shortest path between target nodes.
[0279] In summary, the present embodiment of the present invention first determines the path from the source node to each target node in the source node's row, starting with the source node's row in the grid network. Subsequently, multiple rounds of path optimization and update processing are performed row by row, both above and below the source node's row. This fully utilizes the topological characteristics of the grid network structure to calculate the shortest path from the source node to each target node in a shorter time, improving the efficiency of shortest path calculation and reducing the delay caused by shortest path updates due to changes in the network structure, ultimately expected to improve communication efficiency.
[0280] The dynamic routing method applied to a grid network provided in the embodiments of the present application is suitable for dynamic adjustment or path optimization in a large-scale grid network, especially in a grid network when the node or link status changes, and can quickly recalculate the shortest path.
[0281] In order to implement the dynamic routing method applied to the grid network of the embodiment of the present application, the embodiment of the present application also provides a dynamic routing device applied to the grid network, such as Figure 11 As shown, the device includes:
[0282] The first module 1001 is used to obtain network topology information of the grid network at the current moment; the network topology information includes the path distance between each node; the nodes include source nodes and target nodes; the target nodes refer to the remaining nodes in the grid network except the source node;
[0283] The second module 1002 is configured to determine, for the rsth row where the source node is located, a path and distance from the source node to each target node in the rsth row according to the network topology information;
[0284] The third module 1003 is configured to perform multiple rounds of path optimization and update processing on each row starting from the rs-1th row and the rs+1th row adjacent to the rsth row, respectively, in the direction from the rs-1th row to the first row and from the rs+1th row to the last row, to determine the path and distance from the source node to each target node in the current row, until the path optimization and update processing for the first row and the last row is completed;
[0285] For the current row, the multiple rounds of path optimization and update processing specifically include:
[0286] Repeatedly change the candidate parent node of each target node in the current row to a neighboring node of each target node, calculate the current path distance from the source node through the candidate parent node of each target node to each target node, and if the calculated path distance from the source node to the target node is less than the original path distance from the source node to the target node, update the parent node of the target node to the current candidate parent node, and update the path distance from the source node to the target node;
[0287] Set the candidate parent node of each vertically adjacent node of the target node in the current row as the target node, calculate the current path distance from the source node through the candidate parent node to the vertically adjacent node, and if the calculated path distance from the source node to the vertically adjacent node is less than the original path distance from the source node to the vertically adjacent node, update the parent node of the vertically adjacent node to the target node and update the path distance from the source node to the vertically adjacent node, and insert the vertically adjacent node into the processing queue;
[0288] The head node is taken from the processing queue, and the following update tracking operation is performed on each adjacent node adjacent to the head node and having undergone path optimization update processing:
[0289] Set the candidate parent node of the adjacent node of the team head node as the team head node, and calculate the current path distance from the source node through the team head node to the adjacent node;
[0290] If the calculated path distance from the source node to the adjacent node is less than the original path distance from the source node to the adjacent node, then updating the parent node of the adjacent node to the current head node of the queue and updating the path distance from the source node to the adjacent node, and inserting the adjacent node into the processing queue;
[0291] The first node is continuously taken out from the processing queue, and the update tracking operation is performed on each adjacent node of the first node that has undergone path optimization update processing until the processing queue is empty.
[0292] In one embodiment, the second module 1002 is specifically configured to:
[0293] For each target node on the left side of the source node in the rsth row where the source node is located, set the parent node of the target node to the right node of the target node, and update the path distance from the source node to each target node;
[0294] For each target node located to the right of the source node in the rsth row where the source node is located, the parent node of the target node is set to the left node of the target node, and the path distance from the source node to each target node is updated.
[0295] In one embodiment, the third module 1003 is specifically configured to:
[0296] For each target node in the current row, set the parent node of the target node to the child node of the target node, and update the path distance from the source node to the target node;
[0297] For each target node in the current row except the leftmost target node, set the candidate parent node of the target node to the left node of the target node in order from left to right, and calculate the path distance from the source node through the candidate parent node to the target node;
[0298] If the calculated path distance from the source node to the target node is less than the original path distance from the source node to the target node, then the parent node of the target node is updated to be the left node of the target node, and the path distance from the source node to the target node is updated;
[0299] For each target node in the current row except the rightmost target node, set the candidate parent node of the target node as the right node of the target node in order from right to left, and calculate the path distance from the source node through the candidate parent node to the target node;
[0300] If the calculated path distance from the source node to the target node is less than the original path distance from the source node to the target node, the parent node of the target node is updated to the right node of the target node, and the path distance from the source node to the target node is updated.
[0301] In one embodiment, the third module 1003 is specifically configured to:
[0302] For each target node in the current row, set the parent node of the target node as the parent node of the target node, and update the path distance from the source node to the target node;
[0303] For each target node in the current row except the leftmost target node, set the candidate parent node of the target node to the left node of the target node in order from left to right, and calculate the path distance from the source node through the candidate parent node to the target node;
[0304] If the calculated path distance from the source node to the target node is less than the original path distance from the source node to the target node, then the parent node of the target node is updated to be the left node of the target node, and the path distance from the source node to the target node is updated;
[0305] For each target node in the current row except the rightmost target node, set the candidate parent node of the target node as the right node of the target node in order from right to left, and calculate the path distance from the source node through the candidate parent node to the target node;
[0306] If the calculated path distance from the source node to the target node is less than the original path distance from the source node to the target node, the parent node of the target node is updated to the right node of the target node, and the path distance from the source node to the target node is updated.
[0307] In one embodiment, if the target node is located in any row from row rs-1 to row 1, the vertical adjacent node of the target node is the next node of the target node;
[0308] If the target node is located in any row from the rs+1th row to the last row, the vertical adjacent node of the target node is the upper node of the target node.
[0309] It should be noted that the above embodiments provide a dynamic routing device for use in a grid network, and only illustrate the division of the aforementioned program modules when performing path calculation. In actual applications, the aforementioned processing can be assigned to different program modules as needed, that is, the internal structure of the device can be divided into different program modules to complete all or part of the aforementioned processing. In addition, the dynamic routing device for use in a grid network provided in the above embodiments and the embodiment of the dynamic routing method for use in a grid network are based on the same concept. The specific implementation process is detailed in the method embodiment and will not be repeated here.
[0310] Based on the hardware implementation of the above program modules, and in order to implement a dynamic routing method applied to a grid network provided in an embodiment of the present application, an embodiment of the present application further provides a computer device, such as Figure 11 As shown, the computer device 1100 includes:
[0311] CPU 1101, memory 1102 and input / output interface 1103;
[0312] The memory 1102 is a temporary storage memory or a permanent storage memory;
[0313] The central processing unit 1101 is configured to communicate with the memory 1102 and execute instructions in the memory 1102 to perform any one of the above-mentioned dynamic routing methods applied to the grid network.
[0314] Of course, in actual application, the various components in the computer device 1100 are coupled together through the bus system 1104. It can be understood that the bus system 1104 is used to realize the connection and communication between these components. In addition to the data bus, the bus system 1104 also includes a power bus, a control bus, and a status signal bus. However, for the sake of clarity, Figure 11 Various buses are labeled as bus system 1104.
[0315] The memory 1102 in the embodiment of the present application is used to store various types of data to support the operation of the computer device 1100. Examples of such data include: any computer program used to operate on the computer device 1100.
[0316] It is understandable that when the processor in the computer device described above executes the computer program, it can also implement the functions of the various units in the corresponding device embodiments described above, which will not be repeated here. For example, the computer program can be divided into one or more modules / units, one or more modules / units are stored in the memory and executed by the processor to complete the various embodiments of the present application. One or more modules / units can be a series of computer program instruction segments that can perform specific functions, and the instruction segments are used to describe the execution process of the computer program in the computer device. For example, the computer program can be divided into the various units in the above-mentioned computer device, and each unit can implement the specific functions described in the above-mentioned corresponding computer device.
[0317] A computer device may be a desktop computer, laptop, PDA, cloud server, or other computing device. A computer device may include, but is not limited to, a processor and memory. Those skilled in the art will appreciate that processors and memory are merely examples of computer devices and do not constitute a limitation of computer devices. Computer devices may include more or fewer components, or combinations of certain components, or different components. For example, a computer device may also include input / output devices, network access devices, buses, and the like.
[0318] The processor can be a central processing unit (CPU), other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA), other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor can be a microprocessor or any conventional processor. The processor is the control center of the computer device and connects the various parts of the entire computer device using various interfaces and lines.
[0319] The memory can be used to store computer programs and / or modules. The processor implements various functions of the computer device by running or executing the computer programs and / or modules stored in the memory, and calling the data stored in the memory. The memory can mainly include a program storage area and a data storage area. The program storage area can store an operating system, at least one application required for a function, etc.; the data storage area can store data created based on the use of the terminal, etc. In addition, the memory can include high-speed random access memory and non-volatile memory, such as a hard disk, internal memory, a plug-in hard disk, a smart memory card (SMC, Smart Media Card), a secure digital (SD, Secure Digital) card, a flash card, at least one disk storage device, a flash memory device, or other volatile solid-state storage device.
[0320] An embodiment of the present application further provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, any one of the above-described dynamic routing methods applied to a grid network is executed.
[0321] An embodiment of the present application further provides a computer program product having a computer program / instruction stored thereon. When the computer program / instruction is executed by a processor, it is used to implement the dynamic routing method applied to a grid network as described in the first aspect of the embodiment of the present application or any specific implementation of the first aspect.
[0322] Those skilled in the art will clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0323] In the several embodiments provided in this application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are merely schematic. For example, the division of the units is merely a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.
[0324] The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of these units may be selected to achieve the purpose of this embodiment according to actual needs.
[0325] In addition, the functional units in the various embodiments of the present application may be integrated into a single processing unit, or each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.
[0326] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
Claims
1. A dynamic routing method applied to a grid network, characterized in that: include: Get the network topology information of the grid network at the current moment; The network topology information includes the path distance between each node; the nodes include source nodes and target nodes; the target nodes refer to the remaining nodes in the grid network except the source nodes; For the rsth row where the source node is located, determine the path and distance from the source node to each target node in the rsth row according to the network topology information; Starting from the rs-1th row and the rs+1th row adjacent to the rsth row, multiple rounds of path optimization and update processing are performed row by row in the direction from the rs-1th row to the first row and from the rs+1th row to the last row, respectively, to determine the path and distance from the source node to each target node in the current row, until the path optimization and update processing of the first row and the last row are completed; For the current row, the multiple rounds of path optimization and update processing specifically include: Repeatedly change the candidate parent node of each target node in the current row to a neighboring node of each target node, calculate the current path distance from the source node through the candidate parent node of each target node to each target node, and if the calculated path distance from the source node to the target node is less than the original path distance from the source node to the target node, update the parent node of the target node to the current candidate parent node, and update the path distance from the source node to the target node; Set the candidate parent node of each vertically adjacent node of the target node in the current row as the target node, calculate the current path distance from the source node through the candidate parent node to the vertically adjacent node, and if the calculated path distance from the source node to the vertically adjacent node is less than the original path distance from the source node to the vertically adjacent node, update the parent node of the vertically adjacent node to the target node and update the path distance from the source node to the vertically adjacent node, and insert the vertically adjacent node into the processing queue; The head node is taken from the processing queue, and the following update tracking operation is performed on each adjacent node adjacent to the head node and having undergone path optimization update processing: Setting the candidate parent node of the adjacent node of the team head node as the team head node, and calculating the current path distance from the source node through the team head node to the adjacent node; If the calculated path distance from the source node to the adjacent node is less than the original path distance from the source node to the adjacent node, then updating the parent node of the adjacent node to the current head node of the queue and updating the path distance from the source node to the adjacent node, and inserting the adjacent node into the processing queue; The first node is continuously taken out from the processing queue, and the update tracking operation is performed on each adjacent node of the first node that has undergone path optimization update processing until the processing queue is empty.
2. The dynamic routing method for a grid network according to claim 1, wherein for the rsth row where the source node is located, determining the path and distance from the source node to each target node in the rsth row based on the network topology information comprises: For each target node on the left side of the source node in the rsth row where the source node is located, set the parent node of the target node to the right node of the target node, and update the path distance from the source node to each target node; For each target node located to the right of the source node in the rsth row where the source node is located, the parent node of the target node is set to the left node of the target node, and the path distance from the source node to each target node is updated.
3. The dynamic routing method applied to a grid network according to claim 1, characterized in that: Starting from the rs-1th row and in the direction from the rs-1th row to the first row, the candidate parent node of each target node in the current row is changed to a neighboring node of each target node in multiple rounds, and the current path distance from the source node through the candidate parent node of each target node to each target node is calculated. If the calculated path distance from the source node to the target node is less than the original path distance from the source node to the target node, the parent node of the target node is updated to the current candidate parent node, and the path distance from the source node to the target node is updated, specifically including: For each target node in the current row, set the parent node of the target node to the child node of the target node, and update the path distance from the source node to the target node; For each target node in the current row except the leftmost target node, set the candidate parent node of the target node to the left node of the target node in order from left to right, and calculate the path distance from the source node through the candidate parent node to the target node; If the calculated path distance from the source node to the target node is less than the original path distance from the source node to the target node, then the parent node of the target node is updated to be the left node of the target node, and the path distance from the source node to the target node is updated; For each target node in the current row except the rightmost target node, set the candidate parent node of the target node as the right node of the target node in order from right to left, and calculate the path distance from the source node through the candidate parent node to the target node; If the calculated path distance from the source node to the target node is less than the original path distance from the source node to the target node, the parent node of the target node is updated to the right node of the target node, and the path distance from the source node to the target node is updated.
4. The dynamic routing method applied to a grid network according to claim 1, characterized in that: Starting from the rs+1th row and in the direction from the rs+1th row to the last row, the candidate parent node of each target node in the current row is changed to a neighboring node of each target node for multiple rounds, and the current path distance from the source node through the candidate parent node of each target node to each target node is calculated. If the calculated path distance from the source node to the target node is less than the original path distance from the source node to the target node, the parent node of the target node is updated to the current candidate parent node, and the path distance from the source node to the target node is updated, specifically including: For each target node in the current row, set the parent node of the target node as the parent node of the target node, and update the path distance from the source node to the target node; For each target node in the current row except the leftmost target node, set the candidate parent node of the target node to the left node of the target node in order from left to right, and calculate the path distance from the source node through the candidate parent node to the target node; If the calculated path distance from the source node to the target node is less than the original path distance from the source node to the target node, then the parent node of the target node is updated to be the left node of the target node, and the path distance from the source node to the target node is updated; For each target node in the current row except the rightmost target node, set the candidate parent node of the target node as the right node of the target node in order from right to left, and calculate the path distance from the source node through the candidate parent node to the target node; If the calculated path distance from the source node to the target node is less than the original path distance from the source node to the target node, the parent node of the target node is updated to the right node of the target node, and the path distance from the source node to the target node is updated.
5. The dynamic routing method applied to a grid network according to claim 1, characterized in that: If the target node is located in any row from row rs-1 to row 1, the vertical adjacent node of the target node is the next node of the target node; If the target node is located in any row from the rs+1th row to the last row, the vertical adjacent node of the target node is the upper node of the target node.
6. A dynamic routing device applied to a grid network, characterized in that: include: The first module is used to obtain the network topology information of the grid network at the current moment; The network topology information includes the path distance between each node; the nodes include source nodes and target nodes; the target nodes refer to the remaining nodes in the grid network except the source nodes; The second module is configured to determine, for the rsth row where the source node is located, a path and a distance from the source node to each target node in the rsth row according to the network topology information; A third module is configured to perform multiple rounds of path optimization and update processing on each row, starting from the rs-1th row and the rs+1th row adjacent to the rsth row, in a direction from the rs-1th row to the first row and from the rs+1th row to the last row, respectively, to determine the path and distance from the source node to each target node in the current row, until the path optimization and update processing for the first row and the last row is completed; For the current row, the multiple rounds of path optimization and update processing specifically include: Repeatedly change the candidate parent node of each target node in the current row to a neighboring node of each target node, calculate the current path distance from the source node through the candidate parent node of each target node to each target node, and if the calculated path distance from the source node to the target node is less than the original path distance from the source node to the target node, update the parent node of the target node to the current candidate parent node, and update the path distance from the source node to the target node; Set the candidate parent node of each vertically adjacent node of the target node in the current row as the target node, calculate the current path distance from the source node through the candidate parent node to the vertically adjacent node, and if the calculated path distance from the source node to the vertically adjacent node is less than the original path distance from the source node to the vertically adjacent node, update the parent node of the vertically adjacent node to the target node and update the path distance from the source node to the vertically adjacent node, and insert the vertically adjacent node into the processing queue; The head node is taken from the processing queue, and the following update tracking operation is performed on each adjacent node adjacent to the head node and having undergone path optimization update processing: Setting the candidate parent node of the adjacent node of the team head node as the team head node, and calculating the current path distance from the source node through the team head node to the adjacent node; If the calculated path distance from the source node to the adjacent node is less than the original path distance from the source node to the adjacent node, then updating the parent node of the adjacent node to the current head node of the queue and updating the path distance from the source node to the adjacent node, and inserting the adjacent node into the processing queue; The first node is continuously taken out from the processing queue, and the update tracking operation is performed on each adjacent node of the first node that has undergone path optimization update processing until the processing queue is empty.
7. A computer device, characterized in that: include: CPU, memory and input / output interfaces; The memory is a transient storage memory or a persistent storage memory; The central processing unit is configured to communicate with the memory and execute instructions in the memory to perform the method according to any one of claims 1 to 5.
8. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 5 is performed.