Routing path acquisition method and device

By acquiring and determining multiple equivalent routing paths, the problem that the Dijkstra algorithm cannot calculate multiple optimal equivalent routing paths is solved, and the rapid data transmission is achieved in the event of routing path failure is achieved, and data transmission efficiency is improved.

CN119697097APending Publication Date: 2025-03-25STATE GRID INFORMATION & TELECOMM BRANCH
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202411821634.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-11
Publication Date
2025-03-25

AI Technical Summary

Technical Problem

The Dijkstra algorithm cannot directly calculate multiple optimal equivalent routing paths, which leads to the electronic device recalculating other available shortest routing paths when one routing path fails, and thus fails to complete the forwarding of data packets in time, reducing data transmission efficiency.

Method used

By obtaining the first routing path and determining the second routing path separately based on each node in the first node, and then determining the first equivalent routing path from at least one second routing path, ensuring that the overhead of the first equivalent routing path is the same as that of the first routing path.

Benefits of technology

It realizes that when one routing path fails, it can quickly use another routing path for data transmission, which improves the efficiency of data transmission between electronic devices.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119697097A_ABST
    Figure CN119697097A_ABST
Patent Text Reader

Abstract

The invention discloses a routing path acquisition method and device, and relates to the technical field of electric power operation and maintenance, the method is used for electronic equipment, and the method comprises the following steps: acquiring a first routing path, the first routing path being a minimum overhead routing path from a source node to a destination node through at least one first intermediate node; based on each node in the first nodes, a second routing path is determined, the second routing path is a routing path with the minimum overhead in routing paths from the first node to the destination node, and the first node is any one of the source node and the first intermediate node; and determining a first equivalent routing path from the at least one second routing path, the overhead of the first equivalent routing path being the same as the overhead of the first routing path.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of power operation and maintenance, and in particular to a method and device for obtaining a routing path. Background Art

[0002] In the field of network communications, electronic devices can transmit data packets through routing paths. The shorter the routing path, the more overhead the electronic device needs to save when transmitting data.

[0003] At present, routing path calculation technology mainly relies on Dijkstra algorithm to find the shortest routing path. Dijkstra algorithm is a classic single-source shortest routing path algorithm that determines the shortest routing path by calculating the edge weights between nodes.

[0004] However, the Dijkstra algorithm cannot directly calculate multiple optimal equivalent routing paths, but can only calculate one shortest routing path. This is because the Dijkstra algorithm is based on a greedy strategy, and each time it selects the node with the shortest current distance for expansion, so it cannot consider multiple paths at the same time.

[0005] In this way, when a shortest routing path calculated by the Dijkstra algorithm fails, the electronic device needs to recalculate other available shortest routing paths, so that the data packet forwarding process cannot be completed in time, thereby reducing the data transmission efficiency between electronic devices. Summary of the invention

[0006] The present application provides a method and device for obtaining a routing path, which are used to improve the efficiency of data transmission between electronic devices.

[0007] In order to achieve the above objectives, this application adopts the following technical solutions:

[0008] In a first aspect, a routing path acquisition method is provided, which is applied to an electronic device, and the method includes: acquiring a first routing path, the first routing path being a minimum cost routing path from a source node through at least one first intermediate node to a destination node; determining a second routing path based on each node in the first node, the second routing path being a routing path with the minimum cost among routing paths passing through the first node to the destination node, the first node being any one of the source node and the first intermediate node; and determining a first equivalent routing path from at least one second routing path, the cost of the first equivalent routing path being the same as the cost of the first routing path.

[0009] Based on the above-mentioned routing path acquisition method, the electronic device first obtains a first routing path, which is a minimum cost routing path from a source node through at least one first intermediate node to a destination node; then, based on each node in the first node, a second routing path is determined respectively, and the second routing path is a routing path with the minimum cost in the routing path from the first node to the destination node, and the first node is any node between the source node and the first intermediate node; then, from at least one second routing path, a first equivalent routing path is determined, and the cost of the first equivalent routing path is the same as the cost of the first routing path. In this solution, the electronic device can obtain multiple routing paths with the minimum cost by traversing each node except the destination node in the first routing path, and then filter out the routing path with the same cost as the first routing path, thereby determining multiple equivalent routing paths with the same cost as the first routing path, so that in the event of a failure in one of the routing paths, another routing path can be quickly used for data transmission to improve the efficiency of data transmission of the electronic device.

[0010] In a possible implementation, the determining of a second routing path based on each node in the first node includes:

[0011] Taking the first node as an offset point, the weight between the first node and the second node is set to a first value, the first value is greater than a first preset threshold value, and the path weight is proportional to the overhead of the routing path corresponding to the path weight; based on the first node, the weight of the routing path between the adjacent nodes except the second node is determined, wherein the second node is the next node of the first node.

[0012] In one possible implementation, the first equivalent routing path includes a source node and at least one second intermediate node; after determining the first equivalent routing path from the at least one second routing path, the electronic device determines a third routing path based on each node in the third nodes; determines a second equivalent routing path from the at least one third routing path, and the cost of the second equivalent routing path is the same as the cost of the first routing path; wherein the third routing path is the routing path with the smallest cost among the routing paths that pass through the third node to reach the destination node, and the third node is any one of the source node and each second intermediate node.

[0013] In a possible implementation, the determining of a third routing path based on each of the third nodes includes:

[0014] Taking the third node as an offset point, setting the weight between the third node and the fourth node to a first value, the first value being greater than a first preset threshold value, and the path weight being proportional to the cost of the routing path corresponding to the path weight;

[0015] Determine a third routing path based on weights of routing paths between the third node and adjacent nodes other than the fourth node;

[0016] Among them, the fourth node is the next node of the third node.

[0017] In one possible implementation, after determining the second equivalent routing path from at least one third routing path, the electronic device determines the first routing path, the first equivalent routing path and the second equivalent routing path as an equivalent routing path set; wherein the routing paths in the equivalent routing path set have the same overhead.

[0018] In a second aspect, a routing path acquisition device is provided, which is applied to an electronic device, and can also be a functional module in the electronic device for implementing the method described in the first aspect or any possible design of the first aspect. The routing path acquisition device can implement the functions performed by the electronic device in the above aspects or possible designs, and the functions can be implemented by hardware executing corresponding software. The hardware or software includes one or more modules corresponding to the above functions. For example, the routing path acquisition device includes an acquisition unit and a processing unit; the acquisition unit is used to acquire a first routing path, and the first routing path is a minimum cost routing path from a source node through at least one first intermediate node to a destination node; the processing unit is used to determine a second routing path based on each node in the first node, and the second routing path is a routing path with the minimum cost in the routing path from the first node to the destination node, and the first node is any node of the source node and the first intermediate node; the processing unit is also used to determine a first equivalent routing path from at least one second routing path, and the cost of the first equivalent routing path is the same as the cost of the first routing path.

[0019] Among them, the specific implementation method of the routing path acquisition device can refer to the behavior function of the electronic device in the routing path acquisition method provided by the first aspect or any possible design of the first aspect, and will not be repeated here. Therefore, the provided routing path acquisition device can achieve the same beneficial effects as the first aspect or any possible design of the first aspect.

[0020] In a possible implementation, the processing unit is specifically configured to:

[0021] Taking the first node as an offset point, setting the weight between the first node and the second node to a first value, the first value being greater than a first preset threshold value, and the path weight being proportional to the cost of the routing path corresponding to the path weight;

[0022] Determine a second routing path based on weights of routing paths between the first node and adjacent nodes other than the second node;

[0023] The second node is the next node of the first node.

[0024] In one possible implementation, the first equivalent routing path includes a source node and at least one second intermediate node; the processing unit is further used to determine a third routing path based on each node in the third node after determining the first equivalent routing path from the at least one second routing path; the processing unit is further used to determine a second equivalent routing path from the at least one third routing path, and the cost of the second equivalent routing path is the same as the cost of the first routing path; wherein the third routing path is the routing path with the smallest cost among the routing paths that pass through the third node to reach the destination node, and the third node is any one of the source node and each second intermediate node.

[0025] In a possible implementation, the processing unit is specifically configured to:

[0026] Taking the third node as an offset point, setting the weight between the third node and the fourth node to a first value, the first value being greater than a first preset threshold value, and the path weight being proportional to the cost of the routing path corresponding to the path weight;

[0027] Determine a third routing path based on weights of routing paths between the third node and adjacent nodes other than the fourth node;

[0028] Among them, the fourth node is the next node of the third node.

[0029] In one possible implementation, the processing unit is further used to, after determining the second equal-cost routing path from at least one third routing path, determine the first routing path, the first equal-cost routing path, and the second equal-cost routing path as an equal-cost routing path set; wherein the routing paths in the equal-cost routing path set have the same overhead.

[0030] In a third aspect, a routing path acquisition device is provided, which may be an electronic device or a chip or system on chip in the electronic device. The routing path acquisition device may implement the functions performed by the electronic device in the above aspects or possible designs, and the functions may be implemented by hardware, such as: in one possible design, the routing path acquisition device may include: a processor and a communication interface, and the processor may be used to support the routing path acquisition device to implement the functions involved in the above first aspect or any possible design of the first aspect.

[0031] In another possible design, the routing path acquisition device may further include a memory for storing computer-executable instructions and data necessary for the routing path acquisition device. When the routing path acquisition device is running, the processor executes the computer-executable instructions stored in the memory so that the routing path acquisition device performs the routing path acquisition method of the first aspect or any possible design of the first aspect.

[0032] In a fourth aspect, a routing path acquisition device is provided, which may be a routing path acquisition device or a chip or system on chip in the routing path acquisition device. The routing path acquisition device may implement the functions performed by the routing path acquisition device in the above aspects or possible designs, and the functions may be implemented by hardware, such as: in one possible design, the routing path acquisition device may include: a processor and a communication interface, and the processor may be used to support the routing path acquisition device to implement the functions involved in the above first aspect or any possible design of the first aspect.

[0033] In another possible design, the routing path acquisition device may further include a memory for storing computer-executable instructions and data necessary for the routing path acquisition device. When the routing path acquisition device is running, the processor executes the computer-executable instructions stored in the memory so that the routing path acquisition device performs the routing path acquisition method of the first aspect or any possible design of the first aspect.

[0034] In a fifth aspect, a computer-readable storage medium is provided, which may be a readable non-volatile storage medium, and which stores computer instructions or programs. When the computer-readable storage medium is run on a computer, the computer can execute the routing path acquisition method of the first aspect or any possible design of the above aspects.

[0035] In a sixth aspect, a computer program product comprising instructions is provided, which, when executed on a computer, enables the computer to execute the routing path acquisition method of the first aspect or any possible design of the above aspects.

[0036] In a seventh aspect, a routing path acquisition device is provided, which may be a routing path acquisition device or a chip or system on chip in the routing path acquisition device, and the routing path acquisition device includes one or more processors and one or more memories. The one or more memories are coupled to the one or more processors, and the one or more memories are used to store computer program codes, and the computer program codes include computer instructions. When the one or more processors execute the computer instructions, the routing path acquisition device executes the routing path acquisition method as described in the first aspect or any possible design of the first aspect.

[0037] In an eighth aspect, a chip system is provided, the chip system including a processor and a communication interface, the chip system can be used to implement the functions performed by the routing path acquisition device in the first aspect or any possible design of the first aspect. In one possible design, the chip system also includes a memory, the memory is used to store program instructions and / or data. The chip system can be composed of a chip, or it can include a chip and other discrete devices, without limitation.

[0038] Among them, the technical effects brought about by any design method from the second aspect to the eighth aspect can refer to the technical effects brought about by the above-mentioned first aspect, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0039] Figure 1 A schematic diagram of a flow chart of a method for obtaining a routing path provided in an embodiment of the present application;

[0040] Figure 2 A schematic diagram of a topological network structure provided in an embodiment of the present application;

[0041] Figure 3 A schematic diagram of a flow chart of a method for obtaining a routing path provided in an embodiment of the present application;

[0042] Figure 4 A schematic diagram of a flow chart of a method for obtaining a routing path provided in an embodiment of the present application;

[0043] Figure 5 A schematic diagram of the structure of a routing path acquisition device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0044] In order to enable ordinary persons in the art to better understand the technical solutions of the present disclosure, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the accompanying drawings.

[0045] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present disclosure described herein can be implemented in an order other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the embodiments of the present application as detailed in the attached claims.

[0046] It should also be understood that the term “comprising” indicates the presence of described features, integers, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements and / or components.

[0047] In the field of network communications, when electronic devices support equivalent routing paths, there are multiple routing paths with the same cost to reach the same destination address. When one of the routing paths fails, the electronic device can use other routing paths to complete the forwarding processing of data packets, thereby realizing the routing redundancy backup function.

[0048] At present, electronic devices can determine the shortest routing path by calculating the edge weights between nodes through the Dijkstra algorithm. However, since the Dijkstra algorithm is based on a greedy strategy, it selects the node with the shortest current distance for expansion each time. Therefore, it is impossible to directly calculate multiple optimal equivalent routing paths, and can only calculate one shortest routing path. In this way, when a routing path fails, the electronic device needs to recalculate other available shortest routing paths, so that the forwarding processing of the data packet cannot be completed in time, which makes the data transmission efficiency between electronic devices low.

[0049] To this end, the electronic device can recursively expand to other neighboring nodes layer by layer through the Depth First Search (DFS) and Breadth First Search (BFS) algorithms, calculate the possibility of all routing paths in the topology, and then find multiple optimal equivalent multi-paths with the same cost and the lowest cost from all routing paths.

[0050] Specifically, the DFS algorithm will go deeper along a path until it can no longer be expanded, and then backtrack to the previous node to search for other routing paths. The BFS algorithm searches in hierarchical order, first expanding all neighbor nodes of the current node, and then expanding the neighbor nodes of the neighbor nodes. Because both the DFS and BFS algorithms need to traverse all routing path possibilities in the topology. In the case that the topological network of the electronic device is too large, if the above method is used to determine the optimal equivalent multi-path, all paths in the topological network need to be calculated, which leads to excessive resource overhead and too much time.

[0051] In view of this, an embodiment of the present application provides a method for obtaining a routing path, which is used to quickly determine multiple optimal equivalent routing paths and improve the efficiency of data transmission between electronic devices. The method includes: the electronic device first obtains a first routing path, and the first routing path is a minimum cost routing path from a source node through at least one first intermediate node to a destination node; then, based on each node in the first node, a second routing path is determined respectively, and the second routing path is a routing path with the minimum cost in the routing path from the first node to the destination node, and the first node is any node of the source node and the first intermediate node; then, from at least one second routing path, a first equivalent routing path is determined, and the cost of the first equivalent routing path is the same as the cost of the first routing path.

[0052] Based on the above scheme, the electronic device can obtain multiple routing paths with minimum costs by traversing each node except the destination node in the first routing path, and then screen out routing paths with the same cost as the first routing path, thereby determining multiple equivalent routing paths with the same cost as the first routing path, so that when one of the routing paths fails, another routing path can be quickly used for data transmission, thereby improving the efficiency of data transmission of the electronic device.

[0053] The method provided in the embodiment of the present application is described in detail below with reference to the accompanying drawings.

[0054] The present application embodiment provides a method for obtaining a routing path. Figure 1 As shown, the method may include steps S101 to S103.

[0055] S101: The electronic device obtains a first routing path.

[0056] In a possible implementation, the first routing path is a minimum cost routing path from a source node through at least one first intermediate node to a destination node.

[0057] In a possible implementation, the source node, destination node, and intermediate node may be electronic devices in a communication data transmission topology network.

[0058] In one example, the source node may be an electronic device that sends the data during a data transmission process, the destination node may be an electronic device that finally receives the data during a data transmission process, and the intermediate node may be an electronic device that the data passes through during a data transmission process.

[0059] In a possible implementation, the path overhead may be understood as the path distance traversed by data transmission, or the amount of resources consumed.

[0060] In a possible implementation, the minimum cost routing path is a routing path with the smallest total routing path weight value.

[0061] It can be understood that the path weight is proportional to the cost of the routing path corresponding to the path weight. The smaller the path weight is, the smaller the cost of the routing path corresponding to the routing weight is.

[0062] In a possible implementation, the path weight is preset for the electronic device, or is calculated based on the transmission distance between the electronic devices.

[0063] In one example, when the path weight is a weight of a delay value, the path weight is calculated based on a transmission distance between electronic devices.

[0064] In another example, when the path weight is the weight of other optical cable indicators, such as remaining bandwidth, remaining channels, or bandwidth utilization, the path weight is preset.

[0065] In a possible implementation, the electronic device may calculate a routing path with the least cost in the electronic device topology network by using a Dijkstra algorithm.

[0066] Example 1, such as Figure 2 As shown in the topological network diagram Figure 2 Taking nodes a to f in as an example, each node has a different path weight. If node a is the source node and node f is the destination node, the routing path with the minimum total path weight is calculated through the Dijkstra algorithm, that is, node a-node b-node e-node f, with a total cost of 5.

[0067] Step S102: The electronic device determines a second routing path based on each node in the first nodes.

[0068] In a possible implementation, the second routing path is a routing path with the smallest cost among routing paths passing through the first node to the destination node.

[0069] In a possible implementation manner, the first node is any one of a source node and a first intermediate node.

[0070] In one example, in combination with Example 1, the first node is any one of node a, node b, and node e.

[0071] In a possible implementation manner, the electronic device determines at least one second routing path by tracing back to the first nodes one by one.

[0072] In one example, the electronic device may first determine multiple paths between the first node and the destination node except the first routing path, and then determine the second routing path from the multiple paths.

[0073] In another example, the electronic device uses the Dijkstra algorithm to calculate a routing path with the smallest cost and the shortest distance between the first node and the destination node except the first routing path, and determines it as the second routing path.

[0074] In some embodiments, the above step S102 can be specifically implemented by the following steps S102a and S102b.

[0075] Step S102a: The electronic device uses the first node as an offset point and sets the weight between the first node and the second node to a first value.

[0076] In a possible implementation, the first value is greater than a first preset threshold value.

[0077] In one example, the first value may be an infinite value.

[0078] In a possible implementation, the first preset threshold value may be a default setting of the electronic device or a user-defined setting.

[0079] In a possible implementation, the second node is a next node of the first node.

[0080] Example 2, combined with Example 1, assuming that the first node is node e, the second node is node f, that is, the electronic device sets the path weight of the routing path between node e and node f to a first value, such as an infinite value, to avoid repeated calculation of the first routing path when calculating the optimal routing path.

[0081] Step S102b: The electronic device determines a second routing path based on the weights of routing paths between the first node and adjacent nodes other than the second node.

[0082] In a possible implementation, the electronic device uses the first node as an offset point, calculates a routing path with the minimum cost according to path weights of routing paths of a source node, the first node, and adjacent nodes adjacent to the first node, and determines the routing path as the second routing path.

[0083] Example 3, combined with Example 1 and Example 2, first, node e is used as an offset point, that is, node e is the above-mentioned first node, and the path weight between node e and node f is set to an infinite value. After calculation, no routing path other than the first routing path is obtained. Next, node b is used as an offset point, and the path weight between node b and node e is set to an infinite value, and a new routing path is calculated: node a-node b-node d-node f. This routing path is from node a, through node b to node f, except for the first routing path, the routing path with the smallest path weight. The electronic device determines this routing path as the second routing path. Next, node a is used as an offset point, and the path weight between node a and node b is set to an infinite value. A new routing path is calculated: node a-node c-node d-node f. This routing path is from node a to node f, except for the first routing path, the routing path with the smallest path weight. The electronic device also determines this routing path as the second routing path.

[0084] It should be noted that the electronic device can traverse each first node according to the process of Example 3 to determine multiple second routing paths until all first nodes are traversed.

[0085] In this way, the electronic device sets the path weight between the first node and the second node to an infinite value to avoid repeatedly determining the first routing path when traversing the nodes to determine the second routing path, thereby accurately determining multiple second routing paths.

[0086] Step S103: The electronic device determines a first equivalent routing path from at least one second routing path.

[0087] In a possible implementation manner, the cost of the first equal-cost routing path is the same as the cost of the first routing path.

[0088] In a possible implementation, after determining the plurality of second routing paths, the electronic device determines a routing path in the second routing paths having the same cost as the first routing path as a first equivalent routing path.

[0089] In one example, assuming that the total path weight of the first routing path is 5, the total path weight of the first second routing path is 6, the total path weight of the second second routing path is 5, and the total path weight of the third second routing path is 7, the electronic device determines the second second routing path as the first equivalent routing path.

[0090] based on Figure 1According to the technical solution, the electronic device can obtain multiple routing paths with minimum costs by traversing each node except the destination node in the first routing path, and then screen out routing paths with the same cost as the first routing path, thereby determining multiple equivalent routing paths with the same cost as the first routing path, so that when one of the routing paths fails, another routing path can be quickly used for data transmission, thereby improving the efficiency of data transmission of the electronic device.

[0091] In some embodiments, in order to determine more equal-cost routing paths, such as Figure 3 As shown, after the above step S103 "the electronic device determines a first equivalent routing path from at least one second routing path", the method provided in the embodiment of the present application may further include step S201 and step S202.

[0092] Step S201: The electronic device determines a third routing path based on each of the third nodes.

[0093] In a possible implementation manner, the first equal-cost routing path includes a source node and at least one second intermediate node.

[0094] In a possible implementation, the third routing path is a routing path with the smallest cost among routing paths that pass through the third node and reach the destination node.

[0095] In a possible implementation manner, the third node is a source node in the first equal-cost routing path, and any one of each second intermediate node.

[0096] Example 4, in combination with Example 3, assuming that the first equal-cost routing path is: node a-node b-node d-node f, then the third node is any one of node a, node b and node d.

[0097] In a possible implementation manner, the electronic device determines at least one third routing path by tracing back the second intermediate node and the source node one by one.

[0098] In some embodiments, the above step S201 can be specifically implemented by the following steps S201a and S201b.

[0099] Step S201a: The electronic device uses the third node as an offset point and sets the weight between the third node and the fourth node to a first value.

[0100] In a possible implementation, the first value is greater than a first preset threshold value.

[0101] In one example, the first value may be an infinite value.

[0102] In a possible implementation, the first preset threshold value may be a default setting of the electronic device or a user-defined setting.

[0103] In a possible implementation, the fourth node is a next node of the third node.

[0104] Example 5, in combination with Example 4, assuming that the third node is node d, the fourth node is node f, that is, the electronic device sets the path weight of the routing path between node d and node f to a first value, such as an infinite value.

[0105] Step S201b: The electronic device determines a third routing path based on the weights of the routing paths between the third node and adjacent nodes except the fourth node.

[0106] In a possible implementation, the electronic device uses the third node as an offset point, calculates a routing path with the minimum cost according to the path weights of the routing paths of the source node, the third node, and adjacent nodes adjacent to the third node, and determines it as the third routing path.

[0107] Example 6, combined with Example 3 and Example 4, firstly, node d is used as the offset point, that is, node d is the third node mentioned above, and the path weight between node d and node f is set to an infinite value. After calculation, no routing path other than the first routing path and the second routing path is obtained. Next, node b is used as the offset point, and the path weight between node b and node d is set to an infinite value, and a new routing path is calculated: node a-node b-node c-node d-node f. This routing path is the routing path from node a, through node b to node f, except for the first routing path and the second routing path, and the routing path has the smallest path weight. The electronic device determines this routing path as the third routing path.

[0108] It should be noted that, when the path weight between the third node and the fourth node is set to an infinite value in this step, the path weight between the first node and the second node remains unchanged at the infinite value set previously to avoid repeated calculation of the first routing path.

[0109] Step S202: The electronic device determines a second equivalent routing path from at least one third routing path.

[0110] In a possible implementation manner, the cost of the second equal-cost routing path is the same as the cost of the first routing path.

[0111] In a possible implementation, after determining the plurality of third routing paths, the electronic device determines a routing path among the third routing paths having the same cost as the first routing path as a second equivalent routing path.

[0112] In one example, assuming that the total path weight of the first routing path is 5, the total path weight of the first third routing path is 6, the total path weight of the second third routing path is 5, and the total path weight of the third third routing path is 7, the electronic device determines the second third routing path as the second equivalent routing path.

[0113] In this way, the electronic device can obtain more equal-cost routing paths by further traversing the nodes of the first equal-cost routing path, thereby ensuring that when any equal-cost routing path fails, other routing paths can be selected to transmit data, thereby ensuring the efficiency of data transmission of the electronic device.

[0114] It should be noted that the electronic device can use each routing path with the lowest cost as a benchmark, traverse all its nodes, and further find the routing path with the lowest cost corresponding to each node, so as to determine multiple equivalent routing paths from these routing paths. In this way, not only can multiple nodes be traversed to find multiple routing paths, but also because the Dijkstra algorithm is combined in this embodiment, the electronic device only needs to find a shortest routing path according to the node, and does not need to find the possibility of all routing paths, so that the electronic device does not need to consume more resources to calculate multiple equivalent routing paths.

[0115] In some embodiments, after the above step S202 "the electronic device determines a second equivalent routing path from at least one third routing path", the method provided by the embodiment of the present application may further include step S301.

[0116] Step S301: The electronic device determines a first routing path, a first equal-cost routing path, and a second equal-cost routing path as an equal-cost routing path set.

[0117] In a possible implementation, the routing paths in the equal-cost routing path set have the same cost.

[0118] In this way, when a routing path currently transmitting data fails, the electronic device can select a routing path from the set of equivalent routing paths to continue data transmission, thereby ensuring the efficiency of data transmission of the electronic device.

[0119] The following is a specific example to illustrate the method for obtaining a routing path provided in an embodiment of the present application.

[0120] Combination Figure 2 ,like Figure 4 As shown, the routing path acquisition method may include the following steps A1 to A12.

[0121] Step A1: The electronic device inputs the source end src, i.e. the node e, the sink end dst, i.e. the node f, and the topological network structure graph into the algorithm.

[0122] Step A2: The electronic device uses the Dijkstra algorithm to calculate the shortest routing path from src to dst in the topological network structure graph, that is, the routing path with the smallest total value of the path weight, and records it as P k , where k = [1, n], n is the total number of routing paths in set A, and is put into set A, that is, the above-mentioned equivalent routing path set.

[0123] Step A3: The electronic device uses DFS to traverse all P in set A. k .

[0124] Step A4: Electronic device puts P k The nodes on the dst (except dst) are regarded as deviation points, and each deviation point is recorded as V i , there are x deviation points in total, namely the first node mentioned above.

[0125] Step A5: Electronic device from V (i) Start traversing V i .

[0126] Step A6: The electronic device will k Upper V i The starting edge weight is set to infinity, that is, the path weight is set to the first value, and the Dijkstra algorithm is used to find V i The shortest routing path to dst, get P e , note P k From the starting point to V i The routing path is P s , P e +P s →P k+1 .

[0127] It is understandable that the calculation of V i The shortest routing path to the end point is denoted as P e (end), record from the starting point to V i The routing path is P s (start).

[0128] Step A7: The electronic device determines P k+1 With P k The edge weights of are the same, if not, execute step A8, if they are the same, execute step A9.

[0129] Step A8: The electronic device does not use the routing path as an equivalent routing path.

[0130] Step A9: If P k+1 The sum of the edge weights is equal to the optimal routing path P 1 , then the P k Put it into set A as one of the equal-cost routing paths.

[0131] Step A10: The electronic device adds 1 to the k value and continues to perform steps A3 to A10 until all P k The traversal is complete.

[0132] Step A11: DFS traversal ends.

[0133] Step A12: output the optimal equivalent-cost routing paths with equal weights in the set.

[0134] Thus, in an optimal equivalent multi-path calculation method provided in this embodiment, the characteristics of the Dijkstra algorithm and the DFS algorithm are combined, and the Dijkstra algorithm is used to ensure that the first routing path is the shortest routing path. DFS calculation is performed on the basis of this routing path, and multiple optimal routing paths can be efficiently calculated. The method has a wide range of applicability and can be used in various network communications and routing path calculations and load balancing strategies (Equal-cost multi-path, ECMP) fields, and can meet the mutually exclusive path calculations under different application requirements.

[0135] The various solutions in the above embodiments of the present application can be combined without contradiction.

[0136] The embodiment of the present application can divide the routing path acquisition device into functional modules or functional units according to the above method example. For example, each functional module or functional unit can be divided corresponding to each function, or two or more functions can be integrated into one processing module. The above integrated module can be implemented in the form of hardware or in the form of software functional modules or functional units. Among them, the division of modules or units in the embodiment of the present application is schematic, which is only a logical function division, and there may be other division methods in actual implementation.

[0137] In the case of dividing each functional module into corresponding functional modules, Figure 5 A schematic structural diagram of a routing path acquisition device 700 is shown. The routing path acquisition device 700 may be an electronic device or a chip applied to an electronic device. The routing path acquisition device 700 may be used to execute the functions of the electronic device involved in the above embodiments. Figure 5 The routing path acquisition device 700 shown may include: an acquisition unit 701 and a processing unit 702 .

[0138] Among them, the acquisition unit 701 is used to obtain a first routing path, and the first routing path is a minimum cost routing path from a source node through at least one first intermediate node to a destination node; the processing unit 702 is used to determine a second routing path based on each node in the first node, and the second routing path is a routing path with the minimum cost in the routing path from the first node to the destination node, and the first node is any node between the source node and the first intermediate node; the processing unit 702 is also used to determine a first equivalent routing path from at least one second routing path, and the cost of the first equivalent routing path is the same as the cost of the first routing path.

[0139] In a possible implementation, the processing unit 702 is specifically configured to:

[0140] Taking the first node as an offset point, setting the weight between the first node and the second node to a first value, the first value being greater than a first preset threshold value, and the path weight being proportional to the cost of the routing path corresponding to the path weight;

[0141] Determine a second routing path based on weights of routing paths between the first node and adjacent nodes other than the second node;

[0142] The second node is the next node of the first node.

[0143] In one possible implementation, the first equivalent routing path includes a source node and at least one second intermediate node; the processing unit 702 is further used to determine a third routing path based on each node in the third node after determining the first equivalent routing path from the at least one second routing path; the processing unit 702 is further used to determine a second equivalent routing path from the at least one third routing path, and the overhead of the second equivalent routing path is the same as the overhead of the first routing path; wherein the third routing path is the routing path with the smallest overhead among the routing paths that pass through the third node to reach the destination node, and the third node is any one of the source node and each second intermediate node.

[0144] In a possible implementation, the processing unit 702 is specifically configured to:

[0145] Taking the third node as an offset point, setting the weight between the third node and the fourth node to a first value, the first value being greater than a first preset threshold value, and the path weight being proportional to the cost of the routing path corresponding to the path weight;

[0146] Determine a third routing path based on weights of routing paths between the third node and adjacent nodes other than the fourth node;

[0147] Among them, the fourth node is the next node of the third node.

[0148] In one possible implementation, the processing unit 702 is further used to, after determining the second equal-cost routing path from at least one third routing path, determine the first routing path, the first equal-cost routing path, and the second equal-cost routing path as an equal-cost routing path set; wherein the routing paths in the equal-cost routing path set have the same overhead.

[0149] Based on the above-mentioned routing path acquisition device, the routing path acquisition device first acquires a first routing path, which is a routing path with the minimum cost from a source node through at least one first intermediate node to a destination node; then, based on each node in the first node, a second routing path is determined respectively, and the second routing path is a routing path with the minimum cost in the routing path from the first node to the destination node, and the first node is any node between the source node and the first intermediate node; then, a first equivalent routing path is determined from at least one second routing path, and the cost of the first equivalent routing path is the same as the cost of the first routing path. In this scheme, the routing path acquisition device can obtain multiple routing paths with the minimum cost by traversing each node except the destination node in the first routing path, and then screen out the routing paths with the same cost as the first routing path, thereby determining multiple equivalent routing paths with the same cost as the first routing path, so that in the event of a failure in one of the routing paths, another routing path can be used quickly for data transmission, so as to improve the efficiency of data transmission by the routing path acquisition device.

[0150] As another possible way to achieve this, Figure 5 The acquisition unit 701 and the processing unit 702 may be replaced by a processor, which may integrate the functions of the acquisition unit 701 and the processing unit 702.

[0151] The embodiment of the present application also provides a computer-readable storage medium. All or part of the processes in the above method embodiments can be completed by a computer program to instruct the relevant hardware, and the program can be stored in the above computer-readable storage medium. When the program is executed, it may include the processes of the above method embodiments. The computer-readable storage medium may be an internal storage unit of the routing path acquisition device of any of the above embodiments, such as a hard disk or memory of the routing path acquisition device. The above computer-readable storage medium may also be an external storage device of the above terminal device, such as a plug-in hard disk, a smart memory card (smart media card, SMC), a secure digital (secure digital, SD) card, a flash card (flash card), etc. equipped on the above terminal device. Further, the above computer-readable storage medium may also include both the internal storage unit of the above routing path acquisition device and an external storage device. The above computer-readable storage medium is used to store the above computer program and other programs and data required by the above routing path acquisition device. The above computer-readable storage medium can also be used to temporarily store data that has been output or is to be output.

[0152] It should be noted that the terms "first" and "second" in the specification, claims and drawings of the present application are used to distinguish different objects rather than to describe a specific order. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units that are not listed, or may optionally include other steps or units that are inherent to these processes, methods, products or devices.

[0153] It should be understood that in the present application, "at least one (item)" means one or more, "more than one" means two or more, "at least two (items)" means two or three and more than three, and "and / or" is used to describe the association relationship of associated objects, indicating that three relationships may exist. For example, "A and / or B" can mean: only A exists, only B exists, and A and B exist at the same time, where A and B can be singular or plural. The character " / " generally indicates that the previous and next associated objects are in an "or" relationship. "At least one of the following items" or similar expressions refers to any combination of these items, including any combination of single items or plural items. For example, at least one of a, b or c can mean: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, c can be single or multiple.

[0154] Through the description of the above implementation methods, technical personnel in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional modules is used as an example. In actual applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.

[0155] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic, for example, the division of modules or units is only a logical function division, and there may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another device, 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 through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0156] The units described as separate components may or may not be physically separated, and the components shown as units may be one physical unit or multiple physical units, that is, they may be located in one place or distributed in multiple different places. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.

[0157] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0158] 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 readable storage medium. Based on this understanding, the technical solution of the embodiment 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, which is stored in a storage medium and includes several instructions to enable a device (which can be a single-chip microcomputer, chip, etc.) or a processor (processor) to perform all or part of the steps of the various embodiments of the present application. The aforementioned storage medium includes: various media that can store program codes, such as USB flash drives, mobile hard drives, ROM, RAM, magnetic disks or optical disks.

[0159] The above are only specific implementations of the present application, but the protection scope of the present application is not limited thereto, and any changes or substitutions within the technical scope disclosed in the present application should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

Claims

1. A method for obtaining a routing path, characterized in that: Applied to electronic equipment, the method comprises: Acquire a first routing path, where the first routing path is a minimum cost routing path from a source node through at least one first intermediate node to a destination node; Based on each of the first nodes, a second routing path is determined respectively, where the second routing path is a routing path with the smallest cost among routing paths passing through the first node to the destination node, and the first node is any one of the source node and the first intermediate node; A first equal-cost routing path is determined from at least one of the second routing paths, wherein a cost of the first equal-cost routing path is the same as a cost of the first routing path.

2. The method according to claim 1, characterized in that The determining a second routing path based on each of the first nodes respectively includes: Taking the first node as an offset point, setting a weight between the first node and the second node to a first value, the first value being greater than a first preset threshold value, and the weight being proportional to an overhead of a routing path corresponding to the weight; Determine the second routing path based on the weight of the routing path between the first node and the adjacent nodes except the second node; The second node is the next node of the first node.

3. The method according to claim 1, characterized in that The first equal-cost routing path includes the source node and at least one second intermediate node; After determining a first equal-cost routing path from at least one of the second routing paths, the method further includes: Determine a third routing path based on each of the third nodes; Determine a second equal-cost routing path from at least one of the third routing paths, wherein a cost of the second equal-cost routing path is the same as a cost of the first routing path; The third routing path is a routing path with the smallest cost among routing paths that pass through the third node to reach the destination node, and the third node is any one of the source node and each second intermediate node.

4. The method according to claim 3, characterized in that The determining a third routing path based on each of the third nodes respectively includes: Taking the third node as an offset point, setting a weight between the third node and the fourth node to a first value, the first value being greater than a first preset threshold value, and the weight being proportional to an overhead of a routing path corresponding to the weight; Determine the third routing path based on the weight of the routing path between the third node and the adjacent nodes except the fourth node; The fourth node is the next node of the third node.

5. The method according to claim 3, characterized in that: After determining a second equal-cost routing path from at least one of the third routing paths, the method further includes: Determine the first routing path, the first equal-cost routing path, and the second equal-cost routing path as an equal-cost routing path set; The routing paths in the equal-cost routing path set have the same cost.

6. A routing path acquisition device, characterized in that: Applied to electronic equipment, the device comprises: an acquisition unit and a processing unit; The acquisition unit is used to acquire a first routing path, where the first routing path is a minimum cost routing path from a source node to a destination node through at least one first intermediate node; The processing unit is configured to determine a second routing path based on each of the first nodes, the second routing path being a routing path with the smallest cost among routing paths passing through the first node to the destination node, and the first node being any one of the source node and the first intermediate node; The processing unit is further configured to determine a first equal-cost routing path from at least one of the second routing paths, wherein a cost of the first equal-cost routing path is the same as a cost of the first routing path.

7. The device according to claim 6, characterized in that The processing unit is specifically used for: Taking the first node as an offset point, setting a weight between the first node and the second node to a first value, the first value being greater than a first preset threshold value, and the weight being proportional to an overhead of a routing path corresponding to the weight; Determine the second routing path based on the weight of the routing path between the first node and the adjacent nodes except the second node; The second node is the next node of the first node.

8. The device according to claim 6, characterized in that The first equal-cost routing path includes the source node and at least one second intermediate node; The processing unit is further configured to determine, after determining a first equivalent routing path from at least one of the second routing paths, a third routing path based on each of the third nodes; The processing unit is further configured to determine a second equal-cost routing path from at least one of the third routing paths, wherein a cost of the second equal-cost routing path is the same as a cost of the first routing path; The third routing path is a routing path with the smallest cost among routing paths that pass through the third node to reach the destination node, and the third node is any one of the source node and each second intermediate node.

9. The device according to claim 8, characterized in that The processing unit is specifically used for: Taking the third node as an offset point, setting a weight between the third node and the fourth node to a first value, the first value being greater than a first preset threshold value, and the weight being proportional to an overhead of a routing path corresponding to the weight; Determine the third routing path based on the weight of the routing path between the third node and the adjacent nodes except the fourth node; The fourth node is the next node of the third node.

10. The device according to claim 8, characterized in that The processing unit is further used to, after determining the second equal-cost routing path from at least one of the third routing paths, determine the first routing path, the first equal-cost routing path and the second equal-cost routing path as an equal-cost routing path set; wherein the routing paths in the equal-cost routing path set have the same overhead.

11. A computer-readable storage medium, characterized in that: The readable storage medium stores instructions, and when the instructions are executed, the method according to any one of claims 1 to 5 is implemented.

12. A routing path acquisition device, characterized in that: include: A processor, a memory and a communication interface; wherein the communication interface is used for communication with the routing path acquisition device; The memory is used to store one or more programs, and the one or more programs include computer-executable instructions. When the routing path acquisition device is running, the processor executes the computer-executable instructions stored in the memory to enable the routing path acquisition device to perform the method according to any one of claims 1 to 5.

Citation Information

Patent Citations

  • Routing method based on scheduling and link quality in wireless sensor network

    CN101854696A

  • Method and device for searching optical cable route

    CN114301827A

  • Network path determination method and device, computer equipment and storage medium

    CN117354229A