A method for obtaining the total shortest path of urban road network based on two-layer shared computation
By employing a classification strategy that uses a two-layer shared computation for urban road networks, the acquisition of the shortest path weight is optimized, thus solving the problems of computational redundancy and low efficiency in large-scale road networks and achieving efficient navigation path planning.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- HEFEI UNIV OF TECH
- Filing Date
- 2022-12-13
- Publication Date
- 2026-05-26
AI Technical Summary
Existing shortest path navigation systems involve enormous computational workloads in large-scale urban road networks, making it difficult to meet the demands for real-time and efficient navigation. Furthermore, traditional algorithms suffer from computational redundancy and low efficiency.
A method for obtaining the shortest path of the entire urban road network based on dual-layer shared computation is adopted. By classifying the source point intersections and using the shared computation of upper-layer and lower-layer strategies, the weight acquisition of the shortest path is optimized and redundant calculations are reduced.
It improves route planning efficiency, saves resources, reduces time consumption, adapts to the navigation needs of large-scale road networks, and realizes more efficient navigation applications.
Smart Images

Figure CN116362434B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of vehicle navigation route optimization, specifically a method for obtaining the shortest path of the entire urban road network based on dual-layer shared computation. Background Technology
[0002] As urban road networks continue to expand, the number of road nodes increases accordingly. Existing shortest path navigation systems primarily utilize single-source or full-source shortest path algorithms to address user travel needs, resulting in a massive computational workload that struggles to meet the demands for real-time efficiency in navigation software. The commonly used full-source shortest path algorithm, particularly in large-scale urban road networks with dense node density, involves a wide range of path planning, leading to increased time consumption and resource usage. This approach, trading resource quantity for efficiency and quality, is a prevalent solution.
[0003] In solving the core problem of shortest path in vehicle navigation, different scholars have designed different algorithms. When applying the single-source shortest path algorithm, each single-source shortest path algorithm is used individually, which will repeatedly calculate some already calculated weights, resulting in a lot of computational redundancy. In the full-source shortest path algorithm (all points to all points), unnecessary single-source point shortest path algorithms will be performed, which will also increase the amount of computation, making it unsuitable for the concept of real-time navigation.
[0004] Meanwhile, current algorithms all employ a single approach to finding the shortest path. The traditional Dijkstra's algorithm simply searches leaf nodes step by step to obtain the shortest path, resulting in low efficiency. Improvements made by other researchers based on this approach also remain limited, offering little efficiency enhancement and hindering parallel implementation. Summary of the Invention
[0005] This invention aims to address the shortcomings of existing technologies by proposing a method for obtaining the shortest path from all sources in urban road networks based on dual-layer shared computation. This method seeks to solve the vehicle navigation path optimization problem by classifying the source point intersections to obtain the weight of the shortest path, thereby effectively improving the efficiency of large-scale road network navigation planning and meeting the travel needs of multiple users at different travel points during the same period.
[0006] To achieve the above-mentioned objectives, the present invention adopts the following technical solution:
[0007] The present invention discloses a method for obtaining the total shortest path of an urban road network based on dual-layer shared computation, characterized by the following steps:
[0008] Step 1: Construct the city road network, define parameters and initialize it;
[0009] Obtain real-time road network data and obtain the urban road network G = (V, A, W), where V represents the set of intersections, and V = {v1, v2, v3, ..., v i ,…,v R}, v i Let represent the i-th intersection, i = 1, 2, 3, ..., R, where R is the total number of intersections in the urban road network G, and A represents the set of road segments between intersections, where A = {(v i ,v j )|i,j=1,2,3,…,R},(v i ,v j ) represents the i-th intersection v i to the j-th intersection v j Undirected road segments between, and (v i ,v j )=(v j ,v i W represents the set of weights for road segments between intersections, W = {ω} i,j |i,j=1,2,3,…,R},ω i,j For road segment (v i ,v j The weight of ) if the i-th intersection v i to the j-th intersection v j There are road segments (v) i ,v j If ), then it represents the i-th intersection v. i With the j-th intersection v j The intersections are adjacent to each other, and ω i,j ≥0; if the i-th intersection v i to the j-th intersection v j There is no road segment between them (v) i ,v j If ω i,j =+∞;
[0010] Step 2: Define and initialize node p and the set of intersections P:
[0011] Define the i-th intersection v in the set of intersections V. i to the j-th intersection v j The upper bound of the weight of the shortest path is T. i (v j ), and initialize T i (v j ) is +∞;
[0012] Define the i-th intersection v in the set of intersections V. i to the j-th intersection v j The weight of the shortest path is P. i(v j ), and initialize P i (v j ) is +∞;
[0013] Define S i Represents the set of intersections V, starting with the i-th intersection v. i Let the set of intersections be the weights of the shortest paths obtained from the source point, and initialize them.
[0014] If the i-th intersection v in the set of intersections V i Given the weights of the shortest paths to other intersections in the set of intersections V, we define the i-th intersection v. i Let p be the node, and let v be the i-th intersection. i Add it to the intersection set P;
[0015] initialization And all intersections are initialized to be non-p nodes;
[0016] Define VnP as the set of intersections in the intersection set V that are not in the intersection set P, and |VnP| as the degree of the set VnP. Initialize VnP = V.
[0017] Define ADJ i v represents the i-th intersection in the set of intersections V. i The set of adjacent intersections, |ADJ i | represents the set ADJ i The degree; definition For the i-th intersection v i Adjacent intersection set ADJ i The value in the middle represents the number of adjacent intersections of non-p nodes, i.e., the value of the i-th intersection v. i The number of non-p neighbors;
[0018] If the i-th intersection v in the set of intersections V i All adjacent intersections are nodes p, i.e. Then define the i-th intersection v i Define an internal source point; define and initialize the index t = 1 for the internal source point;
[0019] Define all intersections in the intersection set V that are not internal source points as non-internal source points; define and initialize the index k of the non-internal source points to 1;
[0020] Define the boundary source point e θ Let V represent the intersections in the set V where node p has a non-zero number of non-p neighbors;
[0021] Define a set H to store the non-p nodes in the adjacent intersections of all boundary source points;
[0022] Step 3: Upper-level source node classification strategy: Obtain the update order of non-internal source nodes with the shortest path weight;
[0023] Step 3.1: If set H is not empty, then select the intersection with the smallest number of non-p neighbor points in set H and denote it as... Otherwise, find the intersection with the smallest number of non-p neighbors in set VnP, denoted as...
[0024] Select intersection set of adjacent intersections Add all intersections that are not part of the intersection set P to the set. Then set The number of intersections is Number of non-p neighboring nodes
[0025] if This indicates an intersection. Let c be the t-th internal source point. t And let the t-th internal source point c t The index in the intersection set V is Proceed to step 5; otherwise, proceed to step 3.2.
[0026] Step 3.2: Select Set The index of the intersection corresponding to the minimum number of non-p neighbor points is assigned to the k-th non-internal source point b. k And let the k-th non-internal source point b k The index s in the intersection set V is k Proceed to step 4;
[0027] Step 4: Shared computation strategy for lower-level non-internal source points: Obtain the k-th non-internal source point b k The weight of the shortest path to each intersection in the set of intersections V;
[0028] Step 4.1: Initialize the weights from non-internal source points to each intersection:
[0029] Define the current internal iteration count as m, and initialize m = 1;
[0030] Initialize the k-th non-internal source point b in the m-th iteration. k up to the s k Intersection The upper bound of the weight of the shortest path is Then the k-th non-internal source point b k up to the s k Intersection The weight of the shortest path is and the sthk Intersection Add to the k-th non-internal source point b respectively k The set of intersections with the corresponding shortest path weight and the k-th non-internal source point b in the (m-1)-th iteration k The set of intersections with the corresponding shortest path weight
[0031] Define L k,i Let b represent the k-th non-internal source point. k To the i-th intersection v in the set of intersections V i Find the set of intersections with the shortest path and initialize them.
[0032] Step 4.2: For the (m-1)th iteration, take the kth non-internal source point b k The set of intersections with the weights of the shortest path obtained from the source point. Perform a forward search on all intersections and update the weights of the shortest paths:
[0033] Step 4.2.1: If the k-th non-internal source point b k The set of intersections S corresponding to the weight of the shortest path k If the set of intersections contains all intersections in V, then for the k-th non-internal source point b... k If the shortest path search ends, proceed to step 4.3; otherwise, execute step 4.2.2 sequentially.
[0034] Step 4.2.2: Initialize the k-th non-internal source point b in the m-th iteration. k The set of intersections with the corresponding shortest path weight
[0035] Let b be the k-th non-internal source point in the (m-1)-th iteration. k The set of intersections with the corresponding shortest path weight The number of intersections in the middle is N m-1 ; and extract the nth intersection from it, and let the index of the nth intersection in the intersection set V be .
[0036] Step 4.2.2.1: Initialize n = 1;
[0037] Step 4.2.2.2: If the set of intersections... If the nth intersection is an internal source point, then proceed to step 4.2.2.7; otherwise, traverse all adjacent intersections of the nth intersection. And select all those that do not belong to the intersection set. The intersections form the adjacency set of the nth intersection.
[0038] Step 4.2.2.3: Retrieve the adjacency set Let the q-th intersection in the array be an adjacency set. The index of the q-th intersection in the intersection set V is r. q ;
[0039] Step 4.2.2.4: Initialize q = 1;
[0040] Step 4.2.2.5: If Then Assign to Otherwise, proceed to step 4.2.2.6; where, Let b represent the k-th non-internal source point in the m-th iteration. k To Adjacency Set The upper bound of the weight of the shortest path at the q-th intersection. Let b represent the k-th non-internal source point. k Gather at the intersection The weight of the shortest path at the nth intersection. Represents the set of intersections The nth intersection to the adjacency set The weight of the q-th intersection; Describes the first intersection in the set V. One intersection; Represents the r-th intersection in the set V. q One intersection;
[0041] Step 4.2.2.6: If q≠Q, then assign q+1 to q and go to step 4.2.2.5; otherwise, go to step 4.2.2.7.
[0042] Step 4.2.2.7: Assign n+1 to n, and check if n > N. m-1 Check if the condition is met. If it is met, proceed to step 4.2.3; otherwise, proceed to step 4.2.2.2.
[0043] Step 4.2.3: In the m-th iteration, select the k-th non-internal source point b from the intersection set V. k The intersection with the smallest upper bound of the weight of the shortest path to each intersection in the set V of intersections. and Not belonging to the intersection set S k Let the k-th non-internal source point b k to the intersection The upper bound of the weight of the shortest path is Let b be the source point from the k-th non-internal point k to the intersection The weight of the shortest path is
[0044] if Then Assign to and the intersection Add the k-th non-internal source point b k To the Intersection Shortest path intersection set Thus, the k-th non-internal source point b is obtained. k to the intersection The set of shortest path intersections L k,min ,Right now and the intersection Add to the k-th non-internal source point b respectively k The set of intersections S corresponding to the weight of the shortest path k And the k-th non-internal source point b in the m-th iteration k The set of intersections with the corresponding shortest path weight At the same time, based on the symmetry of undirected graphs, the s-th intersection in the set V is... k Intersection Add them to the intersection respectively S is the set of intersections with weights of the shortest path obtained from the source point. min And the min-th intersection in the first iteration The set of intersections with the weights of the shortest path obtained from the source point.
[0045] Step 4.3: If the k-th non-internal source point b in the first m iterations k The set of intersections S corresponding to the weight of the shortest path k =V, which means that the k-th non-internal source point b is obtained. k Find the shortest path to any intersection in the set of intersections V, and assign the k-th non-internal source point b. k Add it to set P, and simultaneously remove the k-th non-internal source point b from set VnP. k If m+1 is assigned to m, then m is assigned to m and the process proceeds to step 4.4. Otherwise, m+1 is assigned to m and the process proceeds to step 4.2.
[0046] Step 4.4: Update the number of non-p neighbors of each intersection in the intersection set V:
[0047] Step 4.4.1: Obtain the k-th non-internal source point b k set of adjacent intersections The σth intersection;
[0048] Step 4.4.2: Initialize σ = 1;
[0049] Step 4.4.3: Count the non-p neighboring points of the σ-th intersection. After subtracting 1, if If the σ-th intersection belongs to node p, then the σ-th intersection is recorded as an internal source point, and t+1 is assigned to t before proceeding to step 4.4.4; otherwise, proceed directly to step 4.4.4.
[0050] Step 4.4.4: Assign σ+1 to σ, and go to step 4.4.3, until... Represents a set The degree;
[0051] Step 4.4.5: Assign k+1 to k, then proceed to step 6;
[0052] Step 5: Shared computation strategy for lower-level internal source points: the t-th internal source point c t Obtain the weight of the shortest path;
[0053] Step 5.1: Obtain the first [item] from set VnP. Intersection
[0054] Step 5.2: Initialization
[0055] Step 5.3: Obtain the t-th internal source point c in the t-th iteration. t set of adjacent intersections The γth intersection to the intersection Weight of the shortest path
[0056] Step 5.4: Initialize γ = 1;
[0057] Step 5.5: If Then Assign to and set Let I be the index of the γth intersection in the intersection set V. γ ,in, c represents the t-th internal source point. t To the set VnP, the first Intersection The weight of the shortest path, c represents the t-th internal source point. t Gather at adjacent intersections The weight of the γth intersection;
[0058] Step 5.6: Assign γ+1 to γ, then proceed to step 5.5, until... Thus, the t-th internal source point c is obtained. t To the set VnP, the first Intersection Weight of the shortest path and serial number I γ And the t-th internal source point c t Add the I-th intersection to the set V γ Intersection To the set VnP, the first Intersection The set of intersections with the shortest path Thus, the t-th internal source point c is obtained. t To the Intersection The set of intersections with the shortest path At the same time, the t-th internal source point c t Join the Intersection The set of weights of the corresponding shortest path Right now Proceed to step 5.7; Represents a set The degree; Describes the first intersection in the set V. One intersection;
[0059] Step 5.7: Update the t-th internal source point c t Number of non-p neighbors of adjacent intersections:
[0060] Step 5.7.1: Obtain the t-th internal source point c t set of adjacent intersections The σth intersection;
[0061] Step 5.7.2: Initialize σ = 1;
[0062] Step 5.7.3: Count the non-p neighboring points of the σ-th intersection. After subtracting 1, if Then, mark the σ-th intersection as the internal source point, assign t+1 to t, and proceed to step 5.7.4; otherwise, proceed directly to step 5.7.4.
[0063] Step 5.7.4: Assign σ+1 to σ, and go to step 5.7.3, until... Proceed to step 5.8;
[0064] Step 5.8: [The sentence is incomplete and requires more context to be translated accurately.] Assign to Then proceed to step 5.3 until φ = |VnP|, thus obtaining the t-th internal source point c. tThe weights of the shortest paths to all intersections in the set of intersections V, and the weights of the t-th internal source point c. t Add it to set P, and simultaneously remove the t-th internal source point c from set VnP. t After assigning t+1 to t, proceed to step 6; where |VnP| represents the degree of set VnP;
[0065] Step 6: If set If the search is successful, proceed to step 3. Otherwise, it means that all intersections in the intersection set V are p nodes, indicating that all intersections in the road network have obtained the shortest path to any intersection in the road network, and the search is complete.
[0066] The present invention provides an electronic device, including a memory and a processor, wherein the memory is used to store a program that supports the processor in executing the urban road network full-source shortest path acquisition method, and the processor is configured to execute the program stored in the memory.
[0067] The present invention discloses a computer-readable storage medium on which a computer program is stored, wherein the computer program, when executed by a processor, performs the steps of the method for obtaining the shortest path from all sources of the urban road network.
[0068] Compared with the prior art, the beneficial effects of the present invention are as follows:
[0069] 1. This invention proposes a two-layer computational structure for generating all-source shortest paths. It suggests that during the calculation of obtaining the all-source shortest path, the updated shortest path weights of each source point can be shared. It discovers that the algorithm for obtaining the shortest path for some source points can be optimized by directly updating the shortest path weights. Finally, the upper-layer method is used to classify the source points. Based on Dijkstra's algorithm, the shortest path weights are obtained through multiple approaches, such as shared computation, thereby further improving path planning efficiency and handling large-scale road network structures more efficiently. This saves resources while ensuring efficiency, and is tailored to the current needs of practical navigation applications. It avoids unnecessary time consumption and provides a clever optimization method for obtaining multi-source shortest paths to solve the problem of complex calculations in large road networks. This substantially improves the efficiency of practical navigation applications, alleviates the burden of navigation planning, and is more suitable for practical applications.
[0070] 2. In existing full-source shortest path algorithms, the method for obtaining the shortest path for each individual source point is consistent. Due to its inherent characteristics, this approach is computationally inefficient when dealing with complex, large road networks. It requires traversing and searching all intersection source points in the large road network graph, and there is often duplicate weight acquisition for many road segments, further reducing efficiency. The core of this invention lies in classifying the source point intersections using the upper-level strategy of this invention when obtaining the full-source shortest path. This seeks to eliminate the need for repeated acquisition of the single-source shortest path for internal source points, achieving the acquisition of the full-source shortest path for the road network without performing shortest path searches on all source points, thus performing a more efficient full-source shortest path search.
[0071] 3. This invention cleverly discovers that after all adjacent intersections of a given intersection have completed the search for the shortest path to all intersections in the road network, the direct shortest path of the paths from these adjacent intersections to other intersections in the road network can be directly compared. That is, the single-source shortest paths completed by these adjacent intersections can share the calculation of the shortest path of their common adjacent intersections. Based on this characteristic, this invention designs a method for obtaining the weight of the shortest path of internal source points in the lower-level strategy. Simultaneously, to fully utilize this shared calculation characteristic, this invention proposes an upper-level strategy to maximize the number of internal source point intersections in the road network that can utilize shared, omitted calculations. In a chessboard-like road network, based on this, the upper-level classification strategy of this invention can achieve up to 50% omission of calculations for intersections in the road network, substantially improving the planning efficiency of practical navigation applications.
[0072] 4. Based on the fact that this invention considers an undirected road network graph, when a source point obtains the shortest path to all intersections in the road network, all intersections in the road network also obtain their shortest paths to those intersections. Accordingly, the lower-level strategy of this invention, in obtaining the single-source shortest path to intersections of general source points, also makes full use of this characteristic to achieve shared computation on the basis of the traditional Dijkstra algorithm. It omits the acquisition of the shortest path from the general source point to the intersection where the shortest path has already been obtained, which further greatly reduces the workload and facilitates the search for the shortest path in large road network graphs.
[0073] 5. After each time the upper-level strategy discovers an internal source point that can be omitted from calculation, the invention can simultaneously perform the two methods for obtaining the shortest path at the intersection of the internal and non-internal source points. Based on this characteristic, the invention provides the possibility for parallel computation under multi-threaded conditions, lays the foundation for integrating parallel multi-source search in subsequent urban road network navigation planning, and is easy to cooperate with graph partitioning technology and parallel search to further accelerate multi-user path planning. Attached Figure Description
[0074] Figure 1 This is an overall flowchart of the present invention;
[0075] Figure 2 This is a diagram showing the relationships between various intersections according to the present invention;
[0076] Figure 3 This invention provides a simplified urban road network map, a weight table (including initial parameter values), and an initial table of non-p neighbor points.
[0077] Figure 4 The upper bound of the weights of the shortest paths from the first source point intersection b1 to each intersection, and the update table and path graph of the number of non-p neighboring points;
[0078] Figure 5 The upper bound of the weights of the shortest paths from the second source point intersection b2 to each intersection, and the update table and path graph of the number of non-p neighboring points;
[0079] Figure 6 A diagram showing the weight of the shortest path for the second internal source point c2, an update table of the upper bound of the weight of the shortest path from the fifth external source point b5 to each intersection, and the number of non-p neighboring points, and a path diagram.
[0080] Figure 7 This is the update table and path graph for the final number of non-p neighbor nodes. Detailed Implementation
[0081] In this embodiment, starting from the idea of solving a shared full-source shortest path that considers the calculation order of source point intersections, a method for obtaining multi-source shortest paths in urban road networks based on two-layer shared calculation is proposed. The specific process steps are as follows: Figure 1 As shown, the main conceptual framework is as follows: Figure 2 As shown, proceed as follows:
[0082] Step 1: Construct the city road network, define parameters and initialize it;
[0083] Obtain real-time road network data and obtain the urban road network G = (V, A, W). The following will use... Figure 3 Taking a simplified road network diagram as an example, V represents the set of intersections, and V = {v1, v2, v3, ..., v...} i ,…,v R}, v i Let represent the i-th intersection, i = 1, 2, 3, ..., R, where R is the total number of intersections in the urban road network G, and A represents the set of road segments between intersections, where A = {(v i ,v j )|i,j=1,2,3,…,R},(v i ,v j ) represents the i-th intersection v i to the j-th intersection vj Undirected road segments between, and (v i ,v j )=(v j ,v i W represents the set of weights for road segments between intersections, W = {ω} i,j |i,j=1,2,3,…,R},ω i,j For road segment (v i ,v j The weight of ) to Figure 3 Taking the matrix table on the right as an example, the weights can be the time length or path length of the road segment. If the i-th intersection v i to the j-th intersection v j There are road segments (v) i ,v j If the i-th intersection v is... i With the j-th intersection v j The intersections are adjacent to each other, and ω i,j ≥0; if the i-th intersection v i to the j-th intersection v j There is no road segment between them (v) i ,v j If ω i,j =+∞; Define the current iteration number as t;
[0084] Step 2: Define and initialize the set of intersections P for node p:
[0085] Define the i-th intersection v in the set of intersections V. i to the j-th intersection v j The upper bound of the weight of the shortest path is T. i (v j ), and initialize T i (v j ) is +∞;
[0086] Define the i-th intersection v in the set of intersections V. i to the j-th intersection v j The weight of the shortest path is P. i (v j ), and initialize P i (v j ) is +∞;
[0087] Define S i Represents the set of intersections V, starting with the i-th intersection v. i Let the set of intersections be the weights of the shortest paths obtained from the source point, and initialize them.
[0088] If the i-th intersection v in the set of intersections Vi Given the weights of the shortest paths to other intersections in the set of intersections V, we define the i-th intersection v. i Let p be the node, and let v be the i-th intersection. i Add it to the intersection set P;
[0089] initialization And all intersections are initialized to be non-p nodes;
[0090] Define VnP as the set of intersections in intersection set V that are not in intersection set P, and |VnP| as the degree of set VnP, which is the number of intersections in the intersection set. Initialize VnP = V.
[0091] Define ADJ i v represents the i-th intersection in the set of intersections V. i The set of adjacent intersections, |ADJ i | represents the set ADJ i The degree, i.e., the set ADJ i The number of intersections; definition For the i-th intersection v i Adjacent intersection set ADJ i The value in the middle represents the number of adjacent intersections of non-p nodes, i.e., the value of the i-th intersection v. i The number of non-p neighbors, in order to Figure 3 In For example, in a table, initially Equal to |ADJ i |;
[0092] If the i-th intersection v in the set of intersections V i All adjacent intersections are nodes p, i.e. Then define the i-th intersection v i Define an internal source point; define and initialize the index t of the internal source point to 1, such as... Figure 6 v3 in the example is an internal source point;
[0093] Define all intersections in the intersection set V that are not internal source points as non-internal source points; define and initialize the index k of the non-internal source points to 1;
[0094] Define the boundary source point e θ This represents an intersection in the set V where node p has a non-zero number of non-p neighbors, such as... Figure 2 As shown, the shaded area represents all the boundary source points, that is, the intersections of nodes p among the non-internal source points;
[0095] Define a set H to store the non-p nodes in the adjacent intersections of all boundary source points;
[0096] Step 3: Upper-level source node classification strategy: Obtain the update order of non-internal source nodes with the weights of the shortest path, in order to... Figure 1 As shown within the upper-middle dashed box:
[0097] Step 3.1: If set H is not empty, then select the intersection with the smallest number of non-p neighbor points in set H and denote it as... Otherwise, find the intersection with the smallest number of non-p neighbors in set VnP, denoted as...
[0098] Select intersection set of adjacent intersections Add all intersections that are not part of the intersection set P to the set. Then set The number of intersections is Number of non-p neighboring nodes
[0099] if Then the intersection Let c be the t-th internal source point. t And let the t-th internal source point c t The index in the intersection set V is like Figure 6 Selected And its set That is, in the table If intersection v3 is an internal source point, proceed to step 5; otherwise, proceed to step 3.2.
[0100] Step 3.2: Select Set The index of the intersection corresponding to the smallest number of non-p neighboring points is assigned to the k-th non-internal source point b. k And let the k-th non-internal source point b k The index s in the intersection set V is k Proceed to step 4. Figure 6 As shown, during the 5th update of the number of non-p neighbors, the first After identifying it as an internal source node, its shortest path weight is obtained, and it is added to set P. Then, step 3 is performed again to obtain a new source node. At this point, the intersection v8 with the smallest number of non-p neighboring points in set Lin6 is taken as the new source point intersection b5.
[0101] Step 4: Shared computation strategy for lower-level non-internal source points: Obtain the k-th non-internal source point b k The weight of the shortest path to each intersection in the set of intersections V, with Figure 1 As shown within the dashed box in the lower middle layer:
[0102] Step 4.1: Initialize the weights from non-internal source points to each intersection:
[0103] Define the current internal iteration count as m, and initialize m = 1;
[0104] Initialize the k-th non-internal source point b in the m-th iteration. k up to the s k Intersection The upper bound of the weight of the shortest path is Then, in the m-th iteration, the k-th non-internal source point b k up to the s k Intersection The weight of the shortest path is and the sth k Intersection Add to the k-th non-internal source node b k Obtain the set of intersections with the weights of the shortest path. and the k-th non-internal source point b in the (m-1)-th iteration k Obtain the set of intersections with the weight of the shortest path. As Figure 5 For example, when m=1, the non-internal source point v5 is added to the set of intersections where the weight of the shortest path is obtained and the set of upper bounds of the weight of the shortest path, that is, S5=S5∪{v5}={v5,v1}.
[0105] Define L k,i Let b represent the k-th non-internal source point. k To the i-th intersection v in the set of intersections V i Find the set of intersections with the shortest path and initialize them.
[0106] Step 4.2: For the (m-1)th iteration, take the kth non-internal source point b k The set of intersections with the weights of the shortest path from the source point. Find all intersections and perform a forward search, updating the weight of the shortest path:
[0107] Step 4.2.1: If the k-th non-internal source point b k Obtain the set S of intersections with the weights of the shortest path k If the set of intersections contains all intersections in V, then for the k-th non-internal source point b... k The shortest path search ends, and we proceed to step 4.3 to... Figure 4 Taking m=8 as an example, if S1=V, stop searching for the shortest path with the source intersection v1 as the source point; otherwise, proceed to step 4.2.2.
[0108] Step 4.2.2: Initialize the k-th non-internal source point b in the m-th iteration. k Obtain the set of intersections with the weight of the shortest path.
[0109] Let b be the k-th non-internal source point in the (m-1)-th iteration. k Obtain the set of intersections with the weight of the shortest path. The number of intersections in the middle is N m-1 ,by Figure 5 For example, when m=1, The number of intersections N 0 Let the value be 2; and take out the nth intersection from it, and let the index of the nth intersection in the intersection set V be .
[0110] Step 4.2.2.1: Initialize n = 1;
[0111] Step 4.2.2.2: If the set of intersections... If the nth intersection is an internal source point, proceed to step 4.2.2.7; otherwise, traverse all adjacent intersections of the nth intersection. And select all those that do not belong to the intersection set. After the intersection, add it to the adjacency set of the nth intersection.
[0112] Step 4.2.2.3: Retrieve the adjacency set Let the q-th intersection in the array be an adjacency set. The index of the q-th intersection in the intersection set V is r. q ;
[0113] Step 4.2.2.4: Initialize q = 1;
[0114] Step 4.2.2.5: If Then Assign to by Figure 4 When obtaining the shortest path to the source point v1 in the m=2th iteration, taking an adjacent intersection v3 of intersection v4 as an example... Therefore, T1 is updated. 1 (v3)=P1(v4)+ω 4,3 =10, otherwise proceed to step 4.2.2.6; where, Let b represent the k-th non-internal source point in the m-th iteration. k To Adjacency Set The upper bound of the weight of the shortest path at the q-th intersection. Let b represent the k-th non-internal source point. k Gather at the intersection The weight of the shortest path at the nth intersection. Represents the set of intersections The nth intersection to the adjacency set The weight of the q-th intersection; Describes the first intersection in the set V. One intersection; Represents the r-th intersection in the set V. q One intersection;
[0115] Step 4.2.2.6: If q≠Q, then assign q+1 to q and go to step 4.2.2.5; otherwise, go to step 4.2.2.7.
[0116] Step 4.2.2.7: Assign n+1 to n, and check if n > N. m-1 Check if the condition is met. If it is met, proceed to step 4.2.3; otherwise, proceed to step 4.2.2.2.
[0117] Step 4.2.3: In the m-th iteration, select the k-th non-internal source point b from the intersection set V. k The intersection with the smallest upper bound of the weight of the shortest path to each intersection in the set V of intersections. and Not belonging to the intersection set S k Let the k-th non-internal source point b k to the intersection The upper bound of the weight of the shortest path is Let b be the source point from the k-th non-internal point k to the intersection The weight of the shortest path is
[0118] if Then Assign to and the intersection Add to the k-th non-internal source node b k to the intersection set V, the first Intersection Shortest path intersection set Thus, the k-th non-internal source point b is obtained. k To the minth intersection in the intersection set V The set of shortest path intersections L k,min ,Right now and the intersection Add to the k-th non-internal source node b k Obtain the set S of intersections with the weights of the shortest path k And the k-th non-internal source point b in the m-th iteration kObtain the set of intersections with the weight of the shortest path. At the same time, based on the symmetry of undirected graphs, the s-th intersection in the set V is... k Intersection Add them to the min-th intersection respectively S is the set of intersections with weights of the shortest path obtained from the source point. min And the min-th intersection in the first iteration The set of intersections with the weights of the shortest path from the source point. like Figure 4 As shown, when m=1, among the upper bounds of the shortest path weights from source point v1 to each intersection, select the intersection v4 corresponding to the smallest upper bound value that does not belong to S1. At the same time, v4 is added to set S1 and In this context, S1 = S1∪{v4}, We obtain the shortest path L1(v4) from v1 to v4, and simultaneously add v1 to the set S4 of the weights of the shortest paths from the source point v4 to each intersection and the set S4 of the upper bounds of the weights of the shortest paths, i.e., S4 = S4∪{v1}. That is, Figure 5 S5 and The same applies to the initial inclusion of intersection v1;
[0119] Step 4.3: If the k-th non-internal source point b in the first m iterations k Obtain the set S of intersections with the weights of the shortest path k =V, which means that the k-th non-internal source point b is obtained. k Find the shortest path to any intersection in the set of intersections V, and assign the k-th non-internal source point b. k Add it to set P, and simultaneously remove the k-th non-internal source point b from set VnP. k If m+1 is assigned to m, then m is assigned to m and the process proceeds to step 4.4. Otherwise, m+1 is assigned to m and the process proceeds to step 4.2.
[0120] Step 4.4: Update the number of non-p neighbors of each intersection in the intersection set V:
[0121] Step 4.4.1: Obtain the k-th non-internal source point b k set of adjacent intersections The σth intersection;
[0122] Step 4.4.2: Initialize σ = 1;
[0123] Step 4.4.3: Count the non-p neighboring points of the σ-th intersection. After subtracting 1, if If the σ-th intersection belongs to node p, then the σ-th intersection is recorded as an internal source point, and t+1 is assigned to t before proceeding to step 4.4.4; otherwise, proceed directly to step 4.4.4.
[0124] Step 4.4.4: Assign σ+1 to σ, and go to step 3.3.3, until... Represents a set The degree;
[0125] Step 4.4.5: Assign k+1 to k, then proceed to step 6;
[0126] Step 5: Shared computation strategy for lower-level internal source points: the t-th internal source point c t Obtain the weight of the shortest path;
[0127] Step 5.1: Obtain the first [item] from set VnP. Intersection like Figure 6 As shown, when updating the number of non-p neighboring points for the 5th time, VnP = {v6, v8, v9};
[0128] Step 5.2: Initialization
[0129] Step 5.3: Obtain the t-th internal source point c in the t-th iteration. t set of adjacent intersections The γth intersection to the intersection Weight of the shortest path
[0130] Step 5.4: Initialize γ = 1;
[0131] Step 5.5: If Then Assign to and set Let I be the index of the γth intersection in the intersection set V. γ ,in, c represents the t-th internal source point. t To the set VnP, the first Intersection The weight of the shortest path, c represents the t-th internal source point. t Gather at adjacent intersections The weight of the γth intersection;
[0132] Step 5.6: Assign γ+1 to γ, then proceed to step 5.5, until... Thus, the t-th internal source point c is obtained. t To the set VnP, the first Intersection Weight of the shortest path and serial number I γ And the t-th internal source point c t Add the I-th intersection to the set V γ Intersection To the set VnP, the first Intersection The set of intersections with the shortest path Thus, the t-th internal source point c is obtained. t To the Intersection The set of intersections with the shortest path At the same time, the t-th internal source point c t Join the Intersection The set of weights of the corresponding shortest path Right now Proceed to step 5.7. Represents a set The degree; Describes the first intersection in the set V. There are 1 intersection, which is the t-th internal source point c. t ,by Figure 6 As shown, when At that time, the weight of the shortest path from the internal source point v3 to the intersection v6 is obtained, and finally I is obtained. γ =4 and P3(v6) = 16;
[0133] Step 5.7: Update the t-th internal source point c t Number of non-p neighbors of adjacent intersections:
[0134] Step 5.7.1: Obtain the t-th internal source point c t set of adjacent intersections The σth intersection;
[0135] Step 5.7.2: Initialize σ = 1;
[0136] Step 5.7.3: Count the non-p neighboring points of the σ-th intersection. After subtracting 1, if Then, mark the σ-th intersection as the internal source point, assign t+1 to t, and proceed to step 5.7.4; otherwise, proceed directly to step 5.7.4.
[0137] Step 5.7.4: Assign σ+1 to σ, and go to step 5.7.3, until... Proceed to step 5.8;
[0138] Step 5.8: [The sentence is incomplete and requires more context to be translated accurately.] Assign to Then proceed to step 5.3 until φ = |VnP|, thus outputting the t-th internal source point c. t The weight of the shortest path to all intersections in the set of intersections V, i.e., as shown in the figure. Figure 6 The weight of the shortest path in bold in the table on the left is used to determine the weight of the t-th internal source point c. t Add it to set P, and simultaneously remove the t-th internal source point c from set VnP. t Assign t+1 to t, and proceed to step 6;
[0139] Step 6: If set Then proceed to step 3; otherwise, it means that all intersections in the intersection set V are nodes p at this time, such as... Figure 7 As shown, in the final table updating the number of non-p neighboring points, all intersections have been added to set P, indicating that all intersections in the road network have obtained the shortest path to any intersection in the road network, and the search is complete.
[0140] In this embodiment, an electronic device includes a memory and a processor. The memory is used to store a program that supports the processor in executing the above-described method for obtaining the shortest path from all sources of the urban road network. The processor is configured to execute the program stored in the memory.
[0141] In this embodiment, a computer-readable storage medium stores a computer program, which, when executed by a processor, performs the steps of the above-described method for obtaining the shortest path from all sources of the urban road network.
Claims
1. A method for obtaining the total shortest path of an urban road network based on two-layer shared computation, characterized by: Follow these steps: Step 1: Construct the city road network, define parameters and initialize it; Obtain real-time road network data and obtain the urban road network G = (V, A, W), where V represents the set of intersections, and V = {v1, v2, v3, ..., v i ,…,v R }, v i Let represent the i-th intersection, i = 1, 2, 3, ..., R, where R is the total number of intersections in the urban road network G, and A represents the set of road segments between intersections, where A = {(v i ,v j )|i,j=1,2,3,…,R},(v i ,v j ) represents the i-th intersection v i to the j-th intersection v j Undirected road segments between, and (v i ,v j )=(v j ,v i W represents the set of weights for road segments between intersections, W = {ω} i,j |i,j=1,2,3,…,R},ω i,j For road segment (v i ,v j The weight of ) if the i-th intersection v i to the j-th intersection v j There are road segments (v) i ,v j If ), then it represents the i-th intersection v. i With the j-th intersection v j The intersections are adjacent to each other, and ω i,j ≥0; if the i-th intersection v i to the j-th intersection v j There is no road segment between them (v) i ,v j If ω i,j =+∞; Step 2: Define and initialize node p and the set of intersections P: Define the i-th intersection v in the set of intersections V. i to the j-th intersection v j The upper bound of the weight of the shortest path is T. i (v j ), and initialize T i (v j ) is +∞; Define the i-th intersection v in the set of intersections V. i to the j-th intersection v j The weight of the shortest path is P. i (v j ), and initialize P i (v j ) is +∞; Define S i Represents the set of intersections V, starting with the i-th intersection v. i Let the set of intersections be the weights of the shortest paths obtained from the source point, and initialize them. If the i-th intersection v in the set of intersections V i Given the weights of the shortest paths to other intersections in the set of intersections V, we define the i-th intersection v. i Let p be the node, and let v be the i-th intersection. i Add it to the intersection set P; initialization And all intersections are initialized to be non-p nodes; Define VnP as the set of intersections in the intersection set V that are not in the intersection set P, and |VnP| as the degree of the set VnP. Initialize VnP = V. Define ADJ i v represents the i-th intersection in the set of intersections V. i The set of adjacent intersections, |ADJ i | represents the set ADJ i The degree; definition For the i-th intersection v i Adjacent intersection set ADJ i The value in the middle represents the number of adjacent intersections of non-p nodes, i.e., the value of the i-th intersection v. i The number of non-p neighbors; If the i-th intersection v in the set of intersections V i All adjacent intersections are nodes p, i.e. Then define the i-th intersection v i Define an internal source point; define and initialize the index t = 1 for the internal source point; Define all intersections in the intersection set V that are not internal source points as non-internal source points; define and initialize the index k of the non-internal source points to 1; Define the boundary source point e θ Let V represent the intersections in the set V where node p has a non-zero number of non-p neighbors; Define a set H to store the non-p nodes in the adjacent intersections of all boundary source points; Step 3: Upper-level source node classification strategy: Obtain the update order of non-internal source nodes with the shortest path weight; Step 3.1: If set H is not empty, then select the intersection with the smallest number of non-p neighbor points in set H and denote it as... Otherwise, find the intersection with the smallest number of non-p neighbors in set VnP, denoted as... Select intersection set of adjacent intersections Add all intersections that are not part of the intersection set P to the set. Then set The number of intersections is Number of non-p neighboring nodes if This indicates an intersection. Let c be the t-th internal source point. t And let the t-th internal source point c t The index in the intersection set V is Proceed to step 5; otherwise, proceed to step 3.
2. Step 3.2: Select Set The index of the intersection corresponding to the minimum number of non-p neighbor points is assigned to the k-th non-internal source point b. k And let the k-th non-internal source point b k The index s in the intersection set V is k Proceed to step 4; Step 4: Shared computation strategy for lower-level non-internal source points: Obtain the k-th non-internal source point b k The weight of the shortest path to each intersection in the set of intersections V; Step 4.1: Initialize the weights from non-internal source points to each intersection: Define the current internal iteration count as m, and initialize m = 1; Initialize the k-th non-internal source point b in the m-th iteration. k up to the s k Intersection The upper bound of the weight of the shortest path is Then the k-th non-internal source point b k up to the s k Intersection The weight of the shortest path is and the sth k Intersection Add to the k-th non-internal source point b respectively k The set of intersections with the corresponding shortest path weight and the k-th non-internal source point b in the (m-1)-th iteration k The set of intersections with the corresponding shortest path weight Define L k,i Let b represent the k-th non-internal source point. k To the i-th intersection v in the set of intersections V i Find the set of intersections with the shortest path and initialize them. Step 4.2: For the (m-1)th iteration, take the kth non-internal source point b k The set of intersections with the weights of the shortest path obtained from the source point. Perform a forward search on all intersections and update the weights of the shortest paths: Step 4.2.1: If the k-th non-internal source point b k The set of intersections S corresponding to the weight of the shortest path k If the set of intersections contains all intersections in V, then for the k-th non-internal source point b... k If the shortest path search ends, proceed to step 4.3; otherwise, execute step 4.2.2 sequentially. Step 4.2.2: Initialize the k-th non-internal source point b in the m-th iteration. k The set of intersections with the corresponding shortest path weight Let b be the k-th non-internal source point in the (m-1)-th iteration. k The set of intersections with the corresponding shortest path weight The number of intersections in the middle is N m-1 ; and extract the nth intersection from it, and let the index of the nth intersection in the intersection set V be . Step 4.2.2.1: Initialize n = 1; Step 4.2.2.2: If the set of intersections... If the nth intersection is an internal source point, then proceed to step 4.2.2.7; otherwise, traverse all adjacent intersections of the nth intersection. And select all those that do not belong to the intersection set. The intersections form the adjacency set of the nth intersection. Step 4.2.2.3: Retrieve the adjacency set Let the q-th intersection in the array be an adjacency set. The index of the q-th intersection in the intersection set V is r. q ; Step 4.2.2.4: Initialize q = 1; Step 4.2.2.5: If Then Assign to Otherwise, proceed to step 4.2.2.6; where, Let b represent the k-th non-internal source point in the m-th iteration. k To Adjacency Set The upper bound of the weight of the shortest path at the q-th intersection. Let b represent the k-th non-internal source point. k Gather at the intersection The weight of the shortest path at the nth intersection. Represents the set of intersections The nth intersection to the adjacency set The weight of the q-th intersection; Describes the first intersection in the set V. One intersection; Represents the r-th intersection in the set V. q One intersection; Step 4.2.2.6: If q≠Q, then assign q+1 to q and go to step 4.2.2.5; otherwise, go to step 4.2.2.
7. Step 4.2.2.7: Assign n+1 to n, and check if n > N. m - 1 Check if the condition is met. If it is met, proceed to step 4.2.3; otherwise, proceed to step 4.2.2.
2. Step 4.2.3: In the m-th iteration, select the k-th non-internal source point b from the intersection set V. k The intersection with the smallest upper bound of the weight of the shortest path to each intersection in the set V of intersections. and Not belonging to the intersection set S k Let the k-th non-internal source point b k to the intersection The upper bound of the weight of the shortest path is Let b be the source point from the k-th non-internal point k to the intersection The weight of the shortest path is if Then Assign to and the intersection Add the k-th non-internal source point b k To the Intersection Shortest path intersection set Thus, the k-th non-internal source point b is obtained. k to the intersection The set of shortest path intersections L k,min ,Right now and the intersection Add to the k-th non-internal source point b respectively k The set of intersections S corresponding to the weight of the shortest path k And the k-th non-internal source point b in the m-th iteration k The set of intersections with the corresponding shortest path weight At the same time, based on the symmetry of undirected graphs, the sk-th intersection in the intersection set V is... Add them to the intersection respectively S is the set of intersections with weights of the shortest path obtained from the source point. min And the min-th intersection in the first iteration The set of intersections with the weights of the shortest path obtained from the source point. Step 4.3: If the k-th non-internal source point b in the first m iterations k The set of intersections S corresponding to the weight of the shortest path k =V, which means that the k-th non-internal source point b is obtained. k Find the shortest path to any intersection in the set of intersections V, and assign the k-th non-internal source point b. k Add it to set P, and simultaneously remove the k-th non-internal source point b from set VnP. k If m+1 is assigned to m, then m is assigned to m and the process proceeds to step 4.
4. Otherwise, m+1 is assigned to m and the process proceeds to step 4.
2. Step 4.4: Update the number of non-p neighbors of each intersection in the intersection set V: Step 4.4.1: Obtain the k-th non-internal source point b k Adjacent intersection set ADJ sk The σth intersection; Step 4.4.2: Initialize σ = 1; Step 4.4.3: Count the non-p neighboring points of the σ-th intersection. After subtracting 1, if If the σ-th intersection belongs to node p, then the σ-th intersection is recorded as an internal source point, and t+1 is assigned to t before proceeding to step 4.4.4; otherwise, proceed directly to step 4.4.
4. Step 4.4.4: Assign σ+1 to σ, and go to step 4.4.3, until... Represents a set The degree; Step 4.4.5: Assign k+1 to k, then proceed to step 6; Step 5: Shared computation strategy for lower-level internal source points: the t-th internal source point c t Obtain the weight of the shortest path; Step 5.1: Obtain the first [item] from set VnP. Intersection Step 5.2: Initialization Step 5.3: Obtain the t-th internal source point c in the t-th iteration. t set of adjacent intersections The γth intersection to the intersection Weight of the shortest path Step 5.4: Initialize γ = 1; Step 5.5: If Then Assign to and set Let I be the index of the γth intersection in the intersection set V. γ ,in, c represents the t-th internal source point. t To the set VnP, the first Intersection The weight of the shortest path, c represents the t-th internal source point. t Gather at adjacent intersections The weight of the γth intersection; Step 5.6: Assign γ+1 to γ, then proceed to step 5.5, until... Thus, the t-th internal source point c is obtained. t To the set VnP, the first Intersection Weight of the shortest path and serial number I γ And the t-th internal source point c t Add the I-th intersection to the set V γ Intersection To the set VnP, the first Intersection The set of intersections with the shortest path Thus, the t-th internal source point c is obtained. t To the Intersection The set of intersections with the shortest path At the same time, the t-th internal source point c t Join the Intersection The set of weights of the corresponding shortest path Right now Proceed to step 5.7; Represents a set The degree; Describes the first intersection in the set V. One intersection; Step 5.7: Update the t-th internal source point c t Number of non-p neighbors of adjacent intersections: Step 5.7.1: Obtain the t-th internal source point c t set of adjacent intersections The σth intersection; Step 5.7.2: Initialize σ = 1; Step 5.7.3: Count the non-p neighboring points of the σ-th intersection. After subtracting 1, if Then, mark the σ-th intersection as the internal source point, assign t+1 to t, and proceed to step 5.7.4; otherwise, proceed directly to step 5.7.
4. Step 5.7.4: Assign σ+1 to σ, and go to step 5.7.3, until... Proceed to step 5.8; Step 5.8: [The sentence is incomplete and requires more context to be translated accurately.] Assign to Then proceed to step 5.3 until φ = |VnP|, thus obtaining the t-th internal source point c. t The weights of the shortest paths to all intersections in the set of intersections V, and the weights of the t-th internal source point c. t Add it to set P, and simultaneously remove the t-th internal source point c from set VnP. t After assigning t+1 to t, proceed to step 6; where |VnP| represents the degree of set VnP; Step 6: If set If the search is successful, proceed to step 3. Otherwise, it means that all intersections in the intersection set V are p nodes, indicating that all intersections in the road network have obtained the shortest path to any intersection in the road network, and the search is complete.
2. An electronic device, comprising a memory and a processor, characterized in that, The memory is used to store a program that supports the processor in executing the urban road network full-source shortest path acquisition method of claim 1, and the processor is configured to execute the program stored in the memory.
3. A computer-readable storage medium storing a computer program, characterized in that, The computer program, when run by the processor, executes the steps of the method for obtaining the shortest path from all sources in the urban road network as described in claim 1.