Path search method, device, electronic device, storage medium and program product
By combining the road conditions information of each travel platform in the path search, the joint total length of the target path is determined and the target adjacent nodes are selected, which solves the problem of poor path search performance in the existing technology, and achieves more accurate and efficient path search.
Patent Information
- Application Number
- CN202411148041.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-20
- Publication Date
- 2025-04-01
- Estimated Expiration
- 2044-08-20
AI Technical Summary
In the prior art, since the road conditions information of each travel platform cannot be summarized during path search, the search paths may not be the shortest and the search performance is poor.
By receiving a path search request from the departure point to the destination point, the departure node and destination node in each network map are determined, and a target path containing only the departure node is generated. The steps are executed in a loop, and the combined total length of the target path is determined based on the edge weights of each network diagram, the target adjacent nodes are selected, and the target path is connected to the target path until the target path containing the target node is obtained.
Without exposing the road conditions information of each travel platform, the road conditions information of each platform is combined to determine the joint total length, explore the shortest path, reduce time costs, and improve search accuracy and performance.
Smart Images

Figure CN118836887B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of navigation technology, and in particular to a method, device, electronic device, storage medium and program product for path search. Background Art
[0002] In the field of transportation, the shortest path from the departure point to the destination point can usually be searched through a road network graph. The road network graph is a directed graph containing nodes, edges, and edge weights. Different nodes represent different locations, and edge weights represent the length of the edge (i.e., road section). Since different travel platforms usually have their own road condition information, the nodes and edges of the road network graphs of different travel platforms are the same, but the edge weights may be the same or different.
[0003] In the existing technology, in order not to expose the edge weights of each travel platform, the path search can usually only be performed through the road network graph of a single travel platform. However, in this way, the shortest path is usually searched, and the search performance is poor. Summary of the invention
[0004] The purpose of the embodiments of the present application is to provide a method, device, electronic device, storage medium and program product for path search, so as to improve the performance of path search when performing path search.
[0005] On the one hand, an embodiment of the present application provides a method for path searching, the method comprising:
[0006] When receiving a path search request from a departure point to a destination point, determining a departure node corresponding to the departure point in each road network graph, and a destination node corresponding to the destination point in each road network graph; each road network graph is a directed graph containing the same nodes and edges; each road network graph also contains edge weights of its own edges;
[0007] Generate a target path that only contains the starting node;
[0008] The following steps are executed in a loop until a target path including a destination node is obtained: according to the edge weight of each edge in each road network graph, the joint total length of the road network path formed after the target path passes through each adjacent node and connects with the destination node is determined; according to the joint total length of the road network paths corresponding to at least one adjacent node, the target adjacent nodes are screened out; the target adjacent nodes are connected to the target path to obtain a new target path.
[0009] In one implementation, according to the edge weights of the edges in each road network graph, determining the combined total length of the road network paths formed by connecting the target path through each adjacent node and the destination node comprises:
[0010] For each adjacent node of the target path, perform the following steps:
[0011] Connect the target path with adjacent nodes to obtain the first partial path;
[0012] Determine the first partial path lengths corresponding to the first partial paths in each road network graph according to the edge weights of the edges in each road network graph;
[0013] Determine the second local path lengths corresponding to the connections between the adjacent nodes and the destination node in each road network graph according to the edge weights of each edge in each road network graph;
[0014] Determine the sum of the first local path length and the second local path length corresponding to each road network graph, and obtain the corresponding global path length;
[0015] The combined total length is obtained by averaging the lengths of the global paths.
[0016] In one implementation, determining the first partial path lengths corresponding to the first partial paths in each road network graph according to the edge weights of the edges in each road network graph includes:
[0017] For each network diagram, perform the following steps:
[0018] According to the road network graph, obtaining the edge weight corresponding to at least one edge included in the first partial path; determining the sum of the edge weights corresponding to at least one edge included in the first partial path, and obtaining the length of the first partial path;
[0019] Alternatively, the current path length of the target path in the road network graph and the edge weights of the edges between the target path and the adjacent nodes are obtained; the sum of the current path length and the edge weight is determined to obtain the first local path length.
[0020] In one implementation, determining the second local path lengths corresponding to the connections between the adjacent nodes and the destination node in each road network graph according to the edge weights of each edge in each road network graph includes:
[0021] For each network graph and each adjacent node, perform the following steps:
[0022] Obtain at least one second partial path between the adjacent node and the destination node;
[0023] According to the road network graph, respectively obtain the edge weight corresponding to at least one edge included in each second partial path;
[0024] Determine the sum of the edge weights corresponding to at least one edge included in each second partial path, and obtain the corresponding partial arrival length;
[0025] The minimum value of each local arrival length is determined as the second local path length corresponding to the adjacent nodes in the road network graph.
[0026] In one embodiment, the method further comprises:
[0027] When it is determined that a shortcut adding request is received, a start-end node pair including a first node and a second node is obtained according to the shortcut adding request; an edge connecting the first node and the second node is not included in the road network graph;
[0028] According to each road network graph, obtaining at least one start-end node path from the first node to the second node;
[0029] Filter out the target start-end node path of the start-end node pair from at least one start-end node path;
[0030] Add an edge connecting the first node and the second node in each network graph;
[0031] The corresponding path lengths of the target start-end node paths in each road network graph are used as the edge weights of the edges connecting the first node and the second node in the road network graph of the corresponding participant to obtain new road network graphs of each participant.
[0032] In one implementation, selecting a target start-end node path of a start-end node pair from at least one start-end node path includes:
[0033] For each start-end node path in each road network graph, the following steps are performed: determine the sum of the edge weights corresponding to each edge included in the start-end node path in the road network graph, and obtain the local start-end path length;
[0034] For each start-end node path, perform the following steps: determine the average of the local start-end path lengths of the start-end node path in each road network graph to obtain the corresponding joint path length;
[0035] The start-end node paths corresponding to the minimum values of the joint path lengths are used to obtain the target start-end node paths.
[0036] On the one hand, an embodiment of the present application provides a path search device, including:
[0037] A determination unit, configured to determine, upon receiving a path search request from a departure point to a destination point, a departure node corresponding to the departure point in each road network graph, and a destination node corresponding to the destination point in each road network graph; each road network graph is a directed graph including the same nodes and edges; each road network graph also includes edge weights of its own edges;
[0038] A generation unit, used to generate a target path containing only the starting node;
[0039] The obtaining unit is used to cyclically execute the following steps until a target path including a destination node is obtained: according to the edge weight of each edge in each road network graph, determine the joint total length of the road network path formed after the target path passes through each adjacent node and connects with the destination node; according to the joint total length of the road network path corresponding to at least one adjacent node, filter out the target adjacent node; connect the target adjacent node with the target path to obtain a new target path.
[0040] In one embodiment, the obtaining unit is used to:
[0041] For each adjacent node of the target path, perform the following steps:
[0042] Connect the target path with adjacent nodes to obtain the first partial path;
[0043] Determine the first partial path lengths corresponding to the first partial paths in each road network graph according to the edge weights of the edges in each road network graph;
[0044] Determine the second local path lengths corresponding to the connections between the adjacent nodes and the destination node in each road network graph according to the edge weights of each edge in each road network graph;
[0045] Determine the sum of the first local path length and the second local path length corresponding to each road network graph, and obtain the corresponding global path length;
[0046] The combined total length is obtained by averaging the lengths of the global paths.
[0047] In one embodiment, the obtaining unit is used to:
[0048] For each network diagram, perform the following steps:
[0049] According to the road network graph, obtaining the edge weight corresponding to at least one edge included in the first partial path; determining the sum of the edge weights corresponding to at least one edge included in the first partial path, and obtaining the length of the first partial path;
[0050] Alternatively, the current path length of the target path in the road network graph and the edge weights of the edges between the target path and the adjacent nodes are obtained; the sum of the current path length and the edge weight is determined to obtain the first local path length.
[0051] In one embodiment, the obtaining unit is used to:
[0052] For each network graph and each adjacent node, perform the following steps:
[0053] Obtain at least one second partial path between the adjacent node and the destination node;
[0054] According to the road network graph, respectively obtain the edge weight corresponding to at least one edge included in each second partial path;
[0055] Determine the sum of the edge weights corresponding to at least one edge included in each second partial path, and obtain the corresponding partial arrival length;
[0056] The minimum value of each local arrival length is determined as the second local path length corresponding to the adjacent nodes in the road network graph.
[0057] In one implementation, the obtaining unit is further configured to:
[0058] When it is determined that a shortcut adding request is received, a start-end node pair including a first node and a second node is obtained according to the shortcut adding request; an edge connecting the first node and the second node is not included in the road network graph;
[0059] According to each road network graph, obtaining at least one start-end node path from the first node to the second node;
[0060] Filter out the target start-end node path of the start-end node pair from at least one start-end node path;
[0061] Add an edge connecting the first node and the second node in each network graph;
[0062] The corresponding path lengths of the target start-end node paths in each road network graph are used as the edge weights of the edges connecting the first node and the second node in the road network graph of the corresponding participant to obtain new road network graphs of each participant.
[0063] In one implementation, the obtaining unit is further configured to:
[0064] For each start-end node path in each road network graph, the following steps are performed: determine the sum of the edge weights corresponding to each edge included in the start-end node path in the road network graph, and obtain the local start-end path length;
[0065] For each start-end node path, perform the following steps: determine the average of the local start-end path lengths of the start-end node path in each road network graph to obtain the corresponding joint path length;
[0066] The start-end node paths corresponding to the minimum values of the joint path lengths are used to obtain the target start-end node paths.
[0067] On the one hand, an embodiment of the present application provides an electronic device, including:
[0068] Processor; and
[0069] A memory stores computer instructions, wherein the computer instructions are used to enable a processor to execute the steps of the method provided in any of the various optional implementations of the path search described above.
[0070] On the one hand, an embodiment of the present application provides a computer-readable storage medium storing computer instructions, which are used to enable a computer to execute the steps of the method provided in any of the various optional implementations of the path search described above.
[0071] On the one hand, a computer program product is provided in an embodiment of the present application, including a computer-readable code, or a non-volatile computer-readable storage medium carrying the computer-readable code. When the computer-readable code runs in a processor of an electronic device, the processor in the electronic device executes the steps of the method provided in any of the various optional implementations of the path search described above.
[0072] The path search method in the embodiment of the present application includes generating a target path that only includes the starting node; looping through the following steps until the target path that includes the destination node is obtained: according to the edge weights of each edge in each road network graph, determining the joint total length of the road network path formed by connecting the target path through each adjacent node and the destination node; screening out the target adjacent nodes according to the joint total length of the road network path corresponding to at least one adjacent node; connecting the target adjacent nodes to the target path to obtain a new target path. In this way, while taking into account the data security of each travel platform, the road condition information of each travel platform is combined to determine the joint total length, and then the next path is explored in sequence to obtain the shortest target path, reducing the time cost, making the search results more accurate, and improving the search performance. BRIEF DESCRIPTION OF THE DRAWINGS
[0073] In order to more clearly illustrate the specific implementation methods of the present application or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0074] Figure 1 It is a flow chart of a path search method in an embodiment of the present application.
[0075] Figure 2 It is an example diagram of a road network diagram in an embodiment of the present application.
[0076] Figure 3 It is a flow chart of a method for updating a road network diagram in an embodiment of the present application.
[0077] Figure 4 It is a structural block diagram of a path search device in an embodiment of the present application.
[0078] Figure 5It is a structural schematic diagram of an electronic device in an embodiment of the present application. DETAILED DESCRIPTION
[0079] The technical solution of the present application will be clearly and completely described below in conjunction with the accompanying drawings. Obviously, the described implementation methods are part of the implementation methods of the present application, rather than all of the implementation methods. Based on the implementation methods in the present application, all other implementation methods obtained by ordinary technicians in the field without making creative work are within the scope of protection of the present application. In addition, the technical features involved in the different implementation methods of the present application described below can be combined with each other as long as they do not conflict with each other.
[0080] In traditional technology, in order not to expose the traffic information of each travel platform, that is, the edge weight, the path search is usually performed only through the road network diagram of a single travel platform. However, since the traffic information of each travel platform cannot be summarized, the searched path is usually not the shortest and the efficiency is low. Based on the defects of the above-mentioned related technologies, a method, device, electronic device, storage medium and program product for path search are provided in the embodiments of the present application, aiming to improve the performance of path search when performing path search.
[0081] A path search method is provided in an embodiment of the present application. The method can be applied to electronic devices. The present application does not limit the type of electronic device. It can be any type of device suitable for implementation, such as a terminal device and a server, etc. The present application will not go into details about this.
[0082] See also Figure 1 As shown, it is a flow chart of a method for path searching in an embodiment of the present application. Figure 1 The method is described below. The specific implementation process of the method is as follows:
[0083] Step 101: upon receiving a path search request from a departure point to a destination point, determining a departure node corresponding to the departure point in each road network graph, and a destination node corresponding to the destination point in each road network graph.
[0084] The road network refers to the road system of a city, which can be represented in the form of a directed graph (e.g., a topological graph), and can also be called a road network graph. The road segments of the road network are represented as the edges of the directed graph, the intersections between the road segments are represented as the nodes of the directed graph, and the edge weight of each edge represents the length of the road segment.
[0085] In the embodiment of the present application, each participant (such as a travel platform) has its own corresponding road network graph. Since the location and the road are fixed, each road network graph is a directed graph containing the same nodes and edges, and the nodes corresponding to the departure location and the destination point in each road network graph are the same. Since each travel platform usually has different road condition information for different roads, each road network graph also contains the edge weights of its own edges. However, the edge weights of the edges in different road network graphs may be the same or different. Optionally, each participant can be a different travel platform, such as Baidu Maps and Amap.
[0086] For example, see Figure 2 As shown in Figure 1, it is an example of a road network diagram. Figure 2 In the figure, there are a road network graph G1 and a road network graph G2. V represents a node, E represents an edge, W1 represents the edge weight of the edge in the road network graph G1, and W2 represents the edge weight of the edge in the road network graph G2. The road network graph G1 and the road network graph G2 have the same nodes and edges, so the nodes and edges of both are represented by V and E. The departure node corresponding to the departure point in each road network graph is v7, and the destination node corresponding to the destination point in each road network graph is v3.
[0087] Furthermore, the road network graphs can be combined, that is, the weights of each edge in each road network graph are averaged to obtain a federal road network graph, such as Figure 2 In the example above, by combining the road network graph G1 and the road network graph G2, we can obtain the federal road network graph Among them, the road network diagram of It is the average value of the edge weights of the corresponding edges in the road network graph G1 and the road network graph G2.
[0088] In this way, the nodes corresponding to the departure point and the destination point in the road network graph can be obtained, so as to perform path search through the road network graph later.
[0089] Step 102: Generate a target path that only includes the starting node.
[0090] For example, if the starting node is v7, the initial target path only contains v7, no other nodes or edges, and the path length is currently 0.
[0091] In the embodiment of the present application, a path refers to a sequence of directed edges in which at least one edge in a road network graph is connected head to tail.
[0092] Step 103: Loop through the following steps until a target path including a destination node is obtained: determine the combined total length of a road network path formed by connecting the target path through each adjacent node and the destination node according to the edge weight of each edge in each road network graph; select target adjacent nodes according to the combined total length of the road network paths corresponding to at least one adjacent node; connect the target adjacent nodes to the target path to obtain a new target path.
[0093] In one implementation, the following steps are executed in a loop until a target path including the destination node is obtained:
[0094] S1031: According to the edge weight of each edge in each road network graph, determine the combined total length of the road network path formed after the target path passes through each adjacent node and connects with the destination node.
[0095] Among them, the adjacent nodes are the nodes directly connected to the end nodes of the target path.
[0096] For example, Figure 2 In the figure, the departure point in each road network graph corresponds to the departure node v7, and the destination point in each road network graph corresponds to the destination node v3. Then the adjacent nodes of v7 include v1, v8 and v6, and the road network paths are the paths including (v7, v1, v3), (v7, v8, v3) and (v7, v6, v3).
[0097] In one implementation, when S1031 is executed, the following steps may be performed for each adjacent node of the target path:
[0098] S1031-1: Connect the target path with adjacent nodes to obtain a first partial path.
[0099] In one implementation, each adjacent edge of the target path is connected to the end node of the target path to obtain a corresponding first partial path.
[0100] For example, Figure 2 In the example, if the target path is v7, the first partial paths may be: v7v1, v7v8, and v7v6.
[0101] S1031-2: Determine the first partial path lengths corresponding to the first partial paths in the road network graphs according to the edge weights of the edges in the road network graphs.
[0102] In one implementation, for each network diagram, any of the following methods is used:
[0103] Method 1: According to the road network graph, obtain the edge weight corresponding to at least one edge included in the first partial path; determine the sum of the edge weights corresponding to at least one edge included in the first partial path, and obtain the length of the first partial path.
[0104] Method 2: Obtain the current path length of the target path in the road network graph, and the edge weights of the edges between adjacent nodes; determine the sum of the current path length and the edge weights to obtain the first local path length.
[0105] For example, Figure 2 , the first local paths are v7v1, v7v8 and v7v6, each containing only one edge. Their corresponding edge weights in the road network graph G1 are 5, 3, 5, and their corresponding first local path lengths are 5, 3, 5, respectively. Similarly, their corresponding edge weights in the road network graph G2 are 5, 7, 1, and their corresponding first local path lengths are 5, 7, 1, respectively.
[0106] In this way, the path lengths of the current target paths in each network graph can be determined.
[0107] S1031-3: Determine the second local path lengths corresponding to the connections between the adjacent nodes and the destination node in each road network graph according to the edge weights of each edge in each road network graph.
[0108] In one implementation, for each road network graph and each adjacent node, the following steps are performed:
[0109] Obtain at least one second partial path between an adjacent node and a destination node; obtain the edge weights corresponding to at least one edge included in each second partial path according to the road network graph; determine the sum of the edge weights corresponding to at least one edge included in each second partial path to obtain a corresponding local arrival length; determine the minimum value of each local arrival length as the second partial path length corresponding to the adjacent node in the road network graph.
[0110] Optionally, the second local path length can be determined by lower bound pruning, where lower bound pruning means that in Dijkstra search, instead of comparing the existing length of the path, an arrival length (i.e., the local arrival length) is estimated and compared with the sum of the arrival length and the existing length (i.e., the first local path length), thereby pruning the search space and searching for the arrival point faster. Therefore, the minimum value of each local arrival length can be used as a very tight joint lower bound, so that the sum of the second local path length and the first local path length in each road network graph can be calculated in subsequent steps, and then they can be jointly averaged to achieve pruning.
[0111] For example, Figure 2 In the road network graph G1, there are multiple second local paths between adjacent nodes v1 and v3. The local arrival length of each second local path can be determined separately, and the minimum value of each local arrival length is determined as the second local path length = 9.
[0112] Furthermore, the Dijkstra algorithm may be used to determine the second local path length, which will not be described in detail herein.
[0113] In this way, the second local path lengths corresponding to the connections between the adjacent nodes and the destination node in each road network graph can be determined.
[0114] S1031-4: Determine the sum of the first local path length and the second local path length corresponding to each road network graph, and obtain the corresponding global path length.
[0115] In one embodiment, for any road network graph, the following steps are performed: determine the sum of the first local path length and the second local path length of a certain adjacent node in a certain road network graph, and obtain the global path length corresponding to the adjacent node, that is, the global path length of the road network path including the adjacent node.
[0116] For example, Figure 2 In the road network graph G1, the length of the first local path corresponding to v7v1 is 5, and the length of the second local path between v1 and v3 is 9. The sum of the two, that is, the global path length, is 14.
[0117] S1031-5: Obtain the combined total length based on the average value of each global path length.
[0118] In this way, the total joint length can be determined by combining the network diagrams of each route.
[0119] S1032: Filter out target adjacent nodes according to the combined total length of the road network paths corresponding to at least one adjacent node.
[0120] In one implementation, the minimum value of each joint total length is determined, and the adjacent node corresponding to the minimum value is determined as the target adjacent node.
[0121] S1033: Connect the target adjacent nodes to the target path to obtain a new target path.
[0122] Furthermore, each first partial path and its corresponding joint total length can be added to a priority queue, and the first partial path corresponding to the smallest joint total length can be selected from the priority queue as a new target path, and the adjacent nodes it contains can be determined as target adjacent nodes.
[0123] Among them, the priority queue index is generally implemented through a minimum heap. This structure achieves extremely low data handling and computing overhead, and achieves lower overhead.
[0124] Further, if the target adjacent node is the destination node, it is determined that the path search is completed and the search is stopped, otherwise, S1031 is executed.
[0125] In the embodiment of the present application, the path exploration is performed starting from the starting point, and the existing length of the path is no longer compared. Instead, each exploration determines the global path length based on the first local path length between the adjacent node and the starting node, and the second local path length between the adjacent node and the destination node. A priority queue is used to quickly select the target adjacent node with the shortest global path length until the destination node is found. That is, the search space pruning method is used to search for the arrival point more quickly, thereby improving efficiency and reducing costs.
[0126] Combine the following Figure 2 , the above embodiment is described by way of example. Assume that the departure point in each road network graph corresponds to the departure node v7, and the destination point in each road network graph corresponds to the destination node v3.
[0127] In the first cycle, the target path containing only v7 is obtained, and the path length of the target path is currently 0. The adjacent nodes of v7 include v1, v8 and v6, and the first partial paths can be: v7v1, v7v8 and v7v6 in sequence.
[0128] The corresponding edge weights of v1, v8 and v6 in the road network graph G1 are 5, 3, 5, and the corresponding first local path lengths are 5, 3, 5. Similarly, the corresponding edge weights in the road network graph G2 are 5, 7, 1, and the corresponding first local path lengths are 5, 7, 1. In addition, the second local path lengths of v3 reached by v1, v8 and v6 are 9, 2, 8 in the road network graph G1, and 8, 1, 4 in the road network graph G2.
[0129] Therefore, the global path lengths of v1, v8 and v6 in the road network graph G1 are 14, 5, 13, and the global path lengths of v1, v8 and v6 in the road network graph G2 are 13, 8 and 5. According to the average value of each global path length, the joint total lengths of v1, v8 and v6 are 13.5, 6.5 and 9. Obviously, the minimum value of each joint total length is 6.5 corresponding to v8, so v8 is connected to the target path to obtain a new target path.
[0130] Since v8 is not v3, the second cycle is executed. The adjacent nodes of the new target path are updated to v2, v3 and v4, and the corresponding first partial paths can be: v7v8v2, v7v8v3 and v7v8v4.
[0131] The first partial path lengths corresponding to each first partial path in the road network graph G1 are 4, 6, 4, respectively. Similarly, the first partial path lengths corresponding to each first partial path in the road network graph G2 are 8, 8, 14, respectively. Also, the second partial path lengths of v3 reached by v2, v3, and v4 are 3, 0, 1, respectively, in the road network graph G1, and 2, 0, 1, respectively, in the road network graph G2.
[0132] Therefore, the global path lengths corresponding to v2, v3 and v4 in the road network graph G1 are 7, 6, and 5, respectively, and the global path lengths corresponding to v2, v3 and v4 in the road network graph G2 are 10, 8, and 15, respectively. According to the average value of each global path length, the joint total lengths corresponding to v2, v3 and v4 are 8.5, 7 and 10, respectively. Obviously, the minimum value of each joint total length is 7 corresponding to v3, so v3 is connected to the target path and updated again to obtain a new target path. Since v3 is the destination node, the search is determined to be successful and the search is stopped.
[0133] In an embodiment of the present application, path search can be performed in combination with the edge weights of each participant without exposing the edge weights of each road network graph, so that the shortest path can be searched more accurately, taking into account both information security and search performance, and adopting a node exploration method to determine the next node of the path in turn, which can reduce the number of comparisons, reduce overhead, and improve search efficiency.
[0134] Furthermore, a shortcut may be added to the road network graph, that is, an edge connecting two nodes in the road network graph is added to obtain a new road network graph, so as to improve the efficiency of the path search. For example, each road network graph may be updated before the above path search.
[0135] Combine the following Figure 3 , which explains how to add shortcuts to a road network diagram. Figure 3 FIG. 1 is a flow chart of a method for updating a road network graph, wherein the flow of the method includes:
[0136] Step 301: When it is determined that a shortcut adding request is received, a start-end node pair including a first node and a second node is obtained according to the shortcut adding request; the road network graph does not include an edge connecting the first node and the second node.
[0137] The start and end node pair may be input by the user, or may be two nodes selected from the road network diagram that meet the shortcut adding rule, and there is no restriction here.
[0138] Step 302: According to each road network graph, at least one start-end node path from the first node to the second node is obtained.
[0139] In one implementation, each start-end node path from the first node to the second node is traversed from the road network graph.
[0140] Step 303: Filter out the target start-end node path of the start-end node pair from at least one start-end node path.
[0141] In one implementation, when executing step 303, the following steps are performed:
[0142] S3031: For each start-end node path in each road network graph, perform the following steps: determine the sum of the edge weights corresponding to each edge contained in the start-end node path in the road network graph, and obtain the local start-end path length.
[0143] S3032: For each start-end node path, perform the following steps: determine the average value of the local start-end path lengths of the start-end node path in each road network graph, and obtain the corresponding joint path length.
[0144] S3033: Obtain the target start-end node path by taking the start-end node path corresponding to the minimum value of each joint path length.
[0145] In this way, the size relationship of each path can be compared by combining the path lengths, thus avoiding data exposure and improving data security.
[0146] Step 304: Add an edge connecting the first node and the second node in each network graph.
[0147] Step 305: Use the corresponding path lengths of the target start-end node paths in each road network graph as the edge weight of the edge connecting the first node and the second node in the road network graph of the corresponding participant to obtain a new road network graph of each participant.
[0148] In the embodiment of the present application, new shortcuts can be added to the road network map at any time, which improves the convenience and efficiency of subsequent path searches.
[0149] Based on the same inventive concept, a path search device is also provided in the embodiment of the present application. Since the principle of solving the problem by the above-mentioned device and equipment is similar to that of a path search method, the implementation of the above-mentioned device can refer to the implementation of the method, and the repeated parts will not be repeated. The device can be applied to electronic devices. The present application does not limit the type of electronic devices. It can be any type of device suitable for implementation, such as terminal devices and servers, etc., and the present application will not repeat them.
[0150] See also Figure 4 , which is a structural block diagram of a path search device in an embodiment of the present application. In some implementations, the path search device in the present application example includes:
[0151] The determining unit 401 is used to determine the departure node corresponding to the departure point in each road network graph and the destination node corresponding to the destination point in each road network graph when receiving a path search request for the departure point to the destination point; each road network graph is a directed graph containing the same nodes and edges; each road network graph also contains the edge weights of its own edges;
[0152] A generating unit 402, configured to generate a target path including only a starting node;
[0153] The obtaining unit 403 is used to loop through the following steps until a target path including a destination node is obtained: determining the joint total length of a road network path formed after the target path passes through each adjacent node and is connected to the destination node according to the edge weight of each edge in each road network graph; filtering out target adjacent nodes according to the joint total length of the road network paths corresponding to at least one adjacent node; and connecting the target adjacent nodes to the target path to obtain a new target path.
[0154] In one implementation, the obtaining unit 403 is used to:
[0155] For each adjacent node of the target path, perform the following steps:
[0156] Connect the target path with adjacent nodes to obtain the first partial path;
[0157] Determine the first partial path lengths corresponding to the first partial paths in each road network graph according to the edge weights of the edges in each road network graph;
[0158] Determine the second local path lengths corresponding to the connections between the adjacent nodes and the destination node in each road network graph according to the edge weights of each edge in each road network graph;
[0159] Determine the sum of the first local path length and the second local path length corresponding to each road network graph, and obtain the corresponding global path length;
[0160] The combined total length is obtained by averaging the lengths of the global paths.
[0161] In one implementation, the obtaining unit 403 is used to:
[0162] For each network diagram, perform the following steps:
[0163] According to the road network graph, obtaining the edge weight corresponding to at least one edge included in the first partial path; determining the sum of the edge weights corresponding to at least one edge included in the first partial path, and obtaining the length of the first partial path;
[0164] Alternatively, the current path length of the target path in the road network graph and the edge weights of the edges between the target path and the adjacent nodes are obtained; the sum of the current path length and the edge weight is determined to obtain the first local path length.
[0165] In one implementation, the obtaining unit 403 is used to:
[0166] For each network graph and each adjacent node, perform the following steps:
[0167] Obtain at least one second partial path between the adjacent node and the destination node;
[0168] According to the road network graph, respectively obtain the edge weight corresponding to at least one edge included in each second partial path;
[0169] Determine the sum of the edge weights corresponding to at least one edge included in each second partial path, and obtain the corresponding partial arrival length;
[0170] The minimum value of each local arrival length is determined as the second local path length corresponding to the adjacent nodes in the road network graph.
[0171] In one implementation, the obtaining unit 403 is further configured to:
[0172] When it is determined that a shortcut adding request is received, a start-end node pair including a first node and a second node is obtained according to the shortcut adding request; an edge connecting the first node and the second node is not included in the road network graph;
[0173] According to each road network graph, obtaining at least one start-end node path from the first node to the second node;
[0174] Filter out the target start-end node path of the start-end node pair from at least one start-end node path;
[0175] Add an edge connecting the first node and the second node in each network graph;
[0176] The corresponding path lengths of the target start-end node paths in each road network graph are used as the edge weights of the edges connecting the first node and the second node in the road network graph of the corresponding participant to obtain new road network graphs of each participant.
[0177] In one implementation, the obtaining unit 403 is further configured to:
[0178] For each start-end node path in each road network graph, the following steps are performed: determine the sum of the edge weights corresponding to each edge included in the start-end node path in the road network graph, and obtain the local start-end path length;
[0179] For each start-end node path, perform the following steps: determine the average of the local start-end path lengths of the start-end node path in each road network graph to obtain the corresponding joint path length;
[0180] The start-end node paths corresponding to the minimum values of the joint path lengths are used to obtain the target start-end node paths.
[0181] The path search method in the embodiment of the present application includes generating a target path that only includes the starting node; looping through the following steps until the target path that includes the destination node is obtained: according to the edge weights of each edge in each road network graph, determining the joint total length of the road network path formed by connecting the target path through each adjacent node and the destination node; screening out the target adjacent nodes according to the joint total length of the road network path corresponding to at least one adjacent node; connecting the target adjacent nodes to the target path to obtain a new target path. In this way, while taking into account the data security of each travel platform, the road condition information of each travel platform is combined to determine the joint total length, and then the next path is explored in sequence to obtain the shortest target path, reducing the time cost, making the search results more accurate, and improving the search performance.
[0182] In an embodiment of the present application, an electronic device is provided, including:
[0183] Processor; and
[0184] The memory stores computer instructions, where the computer instructions are used to enable the processor to execute the method of any of the above embodiments.
[0185] In an embodiment of the present application, a computer-readable storage medium is provided, which stores computer instructions, and the computer instructions are used to enable a computer to execute a method in any of the above-mentioned embodiments.
[0186] An embodiment of the present application also provides a computer program product, including a computer-readable code, or a non-volatile computer-readable storage medium carrying the computer-readable code. When the computer-readable code runs in a processor of an electronic device, the processor in the electronic device implements any of the above-mentioned methods.
[0187] Figure 5 FIG. 5 shows a schematic diagram of the structure of an electronic device 5000. Figure 5 As shown, the electronic device 5000 includes: a processor 5010 and a memory 5020 , and optionally, may also include a power supply 5030 , a display unit 5040 , and an input unit 5050 .
[0188] The processor 5010 is the control center of the electronic device 5000. It connects various components using various interfaces and lines, and performs various functions of the electronic device 5000 by running or executing software programs and / or data stored in the memory 5020, thereby monitoring the electronic device 5000 as a whole.
[0189] In the embodiment of the present application, the processor 5010 executes the various steps in the above embodiment when calling the computer program stored in the memory 5020.
[0190] Optionally, the processor 5010 may include one or more processing units; preferably, the processor 5010 may integrate an application processor and a modem processor, wherein the application processor mainly processes an operating system, a user interface, and applications, and the modem processor mainly processes wireless communications. It is understandable that the modem processor may not be integrated into the processor 5010. In some embodiments, the processor and the memory may be implemented on a single chip, and in some embodiments, they may also be implemented separately on separate chips.
[0191] The memory 5020 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, various applications, etc.; the data storage area may store data created according to the use of the electronic device 5000, etc. In addition, the memory 5020 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage devices, etc.
[0192] The electronic device 5000 also includes a power source 5030 (such as a battery) for supplying power to various components. The power source can be logically connected to the processor 5010 through a power management system, so that the power management system can manage functions such as charging, discharging, and power consumption.
[0193] The display unit 5040 may be used to display information input by the user or information provided to the user and various menus of the electronic device 5000, and in the embodiment of the present application, is mainly used to display the display interface of each application in the electronic device 5000 and objects such as text and pictures displayed in the display interface. The display unit 5040 may include a display panel 5041. The display panel 5041 may be configured in the form of a liquid crystal display (LCD), an organic light-emitting diode (OLED), etc.
[0194] The input unit 5050 may be used to receive information such as numbers or characters input by the user. The input unit 5050 may include a touch panel 5051 and other input devices 5052. The touch panel 5051, also known as a touch screen, may collect touch operations of the user on or near it (such as operations of the user using a finger, a stylus, or any other suitable object or accessory on or near the touch panel 5051).
[0195] Specifically, the touch panel 5051 can detect the user's touch operation, detect the signal brought by the touch operation, convert these signals into touch point coordinates, send them to the processor 5010, and receive and execute the command sent by the processor 5010. In addition, the touch panel 5051 can be implemented in various types such as resistive, capacitive, infrared, and surface acoustic wave. Other input devices 5052 can include but are not limited to one or more of a physical keyboard, function keys (such as volume control keys, power on / off keys, etc.), a trackball, a mouse, a joystick, etc.
[0196] Of course, the touch panel 5051 can cover the display panel 5041. When the touch panel 5051 detects a touch operation on or near it, it is transmitted to the processor 5010 to determine the type of touch event. Then the processor 5010 provides corresponding visual output on the display panel 5041 according to the type of touch event. Figure 5 In the embodiment, the touch panel 5051 and the display panel 5041 are used as two independent components to realize the input and output functions of the electronic device 5000, but in some embodiments, the touch panel 5051 and the display panel 5041 can be integrated to realize the input and output functions of the electronic device 5000.
[0197] The electronic device 5000 may also include one or more sensors, such as a pressure sensor, a gravity acceleration sensor, a proximity light sensor, etc. Of course, according to the needs of specific applications, the electronic device 5000 may also include other components such as a camera. Since these components are not the key components used in the embodiments of the present application, Figure 5 It is not shown and will not be described in detail.
[0198] Those skilled in the art will understand that Figure 5 The electronic device is merely an example and does not limit the electronic device, and may include more or less components than those shown in the figure, or may combine certain components, or may include different components.
[0199] For the convenience of description, the above parts are divided into modules (or units) according to their functions and described separately. Of course, when implementing this application, the functions of each module (or unit) can be implemented in the same or multiple software or hardware.
Claims
1. A path search method, characterized in that: The method comprises: When receiving a path search request from a departure point to a destination point, determining a departure node corresponding to the departure point in each road network graph, and a destination node corresponding to the destination point in each road network graph; each road network graph is a directed graph containing the same nodes and edges; each road network graph also contains edge weights of its own edges; Generate a target path that only includes the starting node; The following steps are executed in a loop until the target path including the destination node is obtained: according to the edge weight of each edge in each road network graph, the joint total length of the road network path formed after the target path passes through each adjacent node and is connected to the destination node; according to the joint total length of the road network path corresponding to at least one adjacent node, the target adjacent node is screened out; the target adjacent node is connected to the target path to obtain a new target path; Among them, the joint total length is: the average value of the corresponding lengths of the road network path in each road network graph; for each road network graph, the length of the road network path in the road network graph is determined according to the sum of the corresponding edge weights of each edge contained in the road network path in the road network graph.
2. The method according to claim 1, characterized in that The step of determining the combined total length of the road network paths formed by connecting the target path through each adjacent node and the destination node according to the edge weight of each edge in each road network graph comprises: For each adjacent node of the target path, perform the following steps: Connecting the target path with the adjacent nodes to obtain a first partial path; Determine, according to the edge weight of each edge in each road network graph, the first partial path length corresponding to each of the first partial paths in each road network graph; Determine, according to the edge weight of each edge in each road network graph, the second local path lengths corresponding to the connections between the adjacent nodes and the destination node in each road network graph; Determine the sum of the first local path length and the second local path length corresponding to each road network graph, and obtain the corresponding global path length; The combined total length is obtained according to the average value of the global path lengths.
3. The method according to claim 2, characterized in that The determining, according to the edge weight of each edge in each road network graph, the first local path lengths corresponding to each of the first local paths in each road network graph comprises: For each network diagram, perform the following steps: According to the road network graph, obtaining the edge weight corresponding to at least one edge included in the first partial path; determining the sum of the edge weights corresponding to at least one edge included in the first partial path, and obtaining the length of the first partial path; Alternatively, the current path length of the target path in the road network graph and the edge weights of the edges between the target path and the adjacent nodes are obtained; the sum of the current path length and the edge weights is determined to obtain the first local path length.
4. The method according to claim 2, characterized in that: The determining, according to the edge weight of each edge in each road network graph, the second local path lengths corresponding to the connections between the adjacent nodes and the destination node in each road network graph, respectively, comprises: For each network graph and each adjacent node, perform the following steps: Obtain at least one second partial path between the adjacent node and the destination node; According to the road network graph, respectively obtaining edge weights corresponding to at least one edge included in each second partial path; Determine the sum of the edge weights corresponding to at least one edge included in each second partial path, and obtain the corresponding partial arrival length; The minimum value of each local arrival length is determined as the second local path length corresponding to the adjacent node in the road network graph.
5. The method according to any one of claims 1 to 4, characterized in that: The method further comprises: When it is determined that a shortcut adding request is received, a start-end node pair including a first node and a second node is obtained according to the shortcut adding request; the road network graph does not include an edge connecting the first node and the second node; According to each road network graph, obtaining at least one start-end node path from the first node to the second node; Filtering out the target start-end node path of the start-end node pair from the at least one start-end node path; Adding an edge connecting the first node and the second node in each network graph; The path lengths corresponding to the target start-end node paths in each road network graph are used as the edge weights of the edges connecting the first node and the second node in the road network graph of the corresponding participant to obtain new road network graphs of each participant.
6. The method according to claim 5, characterized in that The step of selecting a target start-end node path of the start-end node pair from the at least one start-end node path comprises: For each start-end node path in each road network graph, the following steps are performed: determining the sum of the edge weights corresponding to each edge included in the start-end node path in the road network graph, and obtaining the local start-end path length; For each start-end node path, the following steps are performed: determining the average value of the local start-end path lengths of the start-end node path in each road network graph to obtain the corresponding joint path length; The target start-end node path is obtained by taking the start-end node path corresponding to the minimum value of each joint path length.
7. A path search device, characterized in that: The device comprises: A determination unit, configured to, upon receiving a path search request from a departure point to a destination point, determine a departure node corresponding to the departure point in each road network graph, and a destination node corresponding to the destination point in each road network graph; each road network graph is a directed graph including the same nodes and edges; each road network graph also includes edge weights of its own edges; A generating unit, used for generating a target path including only the starting node; The obtaining unit is used to cyclically execute the following steps until the target path including the destination node is obtained: according to the edge weight of each edge in each road network graph, determine the joint total length of the road network path formed after the target path passes through each adjacent node and connects with the destination node; according to the joint total length of the road network path corresponding to at least one adjacent node, filter out the target adjacent node; connect the target adjacent node with the target path to obtain a new target path; Among them, the joint total length is: the average value of the corresponding lengths of the road network path in each road network graph; for each road network graph, the length of the road network path in the road network graph is determined according to the sum of the corresponding edge weights of each edge contained in the road network path in the road network graph.
8. An electronic device, characterized in that: include: processor; as well as A memory storing computer instructions, wherein the computer instructions are used to enable the processor to execute the method according to any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that: Computer instructions are stored, and the computer instructions are used to make a computer execute the method according to any one of claims 1 to 6.
10. A computer program product, characterized in that The invention comprises a computer-readable code, or a non-volatile computer-readable storage medium carrying the computer-readable code. When the computer-readable code is executed in a processor of an electronic device, the processor in the electronic device performs the method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Road network approximate shortest path calculation method on multi-core platform
CN104933248A
Multi-map information fusion path generation method and system
CN116067391A