A kNN Query Method Based on Tree Decomposition in a Dynamic Road Network

By adopting a tree decomposition method in the dynamic road network, the dwarf tree decomposition and designing related arrays and table sets are solved, and the efficient query process and adaptability of the dynamic road network are achieved.

CN116881581BActive Publication Date: 2025-06-24DALIAN MARITIME UNIVERSITY
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310874608.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-07-17
Publication Date
2025-06-24
Estimated Expiration
2043-07-17

AI Technical Summary

Technical Problem

It is difficult for the prior art to efficiently conduct kNN query in dynamic road networks, especially when traffic conditions change in real time. The indexing and query algorithms of traditional static road network design cannot effectively meet the query needs.

Method used

Using a tree decomposition method, a dwarf tree decomposition is constructed, the ancestor array, time-consuming array and descendant table collection of tree nodes are designed, and efficient query is carried out through the shortest-circuit network. Combined with the pruning strategy to reduce unnecessary calculations, a maintenance method and incremental query algorithm for indexing when dynamic update of road networks are proposed.

Benefits of technology

The time efficiency of kNN query is improved, and the query time and efficiency can be greatly improved while ensuring the correctness of the query, and is suitable for real-time traffic conditions in dynamic road networks.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116881581B_ABST
    Figure CN116881581B_ABST
Patent Text Reader

Abstract

The present invention discloses a kNN query method based on tree decomposition on a dynamic road network, which includes obtaining a road network data set, constructing an undirected weighted road graph according to the road network data set, where the undirected weighted road graph includes a vertex set, an edge set, and a weight set, constructing tree nodes according to the undirected weighted road graph, using the connected tree node set as a low tree decomposition, numbering each tree node of the low tree decomposition and obtaining the ancestor array, time-consuming array, and descendant table set of all tree nodes, obtaining the vertex to be queried, and obtaining the nearest neighbor set of the vertex to be queried according to the low tree decomposition. On the premise of ensuring the correctness of the kNN query, the query time and efficiency are greatly improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of kNN queries on dynamic road networks, and particularly to a kNN query method based on tree decomposition on dynamic road networks. Background Art

[0002] Location-based service (LBS) can provide users with accurate location information and personalized services at any time and place, thus playing a significant role in the application of intelligent transportation systems. However, due to the increasing number of modern transportation vehicles and irreversible problems such as irregular urban road network design, traffic congestion or even blockage is likely to occur at specific time points, such as the peak commuting hours. Therefore, in order to reduce the occurrence of this phenomenon, in addition to increasing the construction of urban roads and bridges, on the existing road network, the location information service is reasonably utilized to relieve traffic pressure and improve travel efficiency.

[0003] The key to solving the above problems is how to reasonably utilize location services. To make good use of location services, a perfect and efficient road network query technology is needed. In the increasingly popular location-based service, calculating the k-nearest neighbor (kNN) based on the query point is a typical application. The kNN query problem has a very wide range of applications in real life. For example, the online car-hailing service on the Uber software needs to query the k users who can be reached fastest to send taxi requests, so that the driver can selectively pick up passenger orders. However, considering that traffic jams often occur and may change at any time on traffic roads, the travel time of a section of road may change at any time. Therefore, in order to save the time costs of online car-hailing drivers and passengers, the orders that take a long time for online car-hailing drivers to pick up passengers need to be replaced. At present, the kNN query problem in road networks has been widely studied, and the query research work is mainly divided into two types: based on Euclidean space and based on road network queries. In the existing solutions, some are not restricted by the real road network, some query algorithms have low efficiency, and some require prior knowledge of the k value. In addition, more importantly, in real life, the traffic conditions are changing in real time, which makes the indexing and query algorithms based on traditional static road network designs unable to effectively meet the queries. Therefore, solving the kNN query problem under dynamic road networks has very important practical significance. Summary of the Invention

[0004] The present invention provides a kNN query method based on tree decomposition on dynamic road networks to overcome the above technical problems.

[0005] A kNN query method based on tree decomposition on dynamic road networks includes,

[0006] Step 1: Obtain a road network dataset, and construct an undirected weighted road graph according to the road network dataset. The undirected weighted road graph includes a vertex set, an edge set, and a weight set. The vertices are the intersections in the road network dataset, the edges are the road segments between two intersections in the road network dataset, and the weights are the average time required for a vehicle to pass through a road segment.

[0007] Step 2: Sort the vertex set in ascending order according to the degree of vertices. Select vertices from the sorted vertex set in sequence as the deleted vertices, take the deleted vertices as the main vertices, construct tree nodes according to the main vertices and the neighbor vertex sets of the main vertices, and assign a deleted point serial number to the tree nodes. Store the tree nodes and the deleted point serial numbers in the tree node set, and sort the tree node set in ascending order according to the deleted point serial numbers.

[0008] Step 3: Obtain the sorted tree node set. For each tree node in the tree node set, take the tree node corresponding to the first vertex as the deleted vertex in the neighbor vertex set of the current tree node as the parent node of the current tree node, connect the current tree node with the parent node, and take the connected tree node set as the short tree decomposition.

[0009] Step 4: Number each tree node in the short tree decomposition. For each numbered tree node, construct an ancestor array, a time-consuming array, and a descendant table respectively. Obtain the ancestor array, the time-consuming array, and the descendant table set of all tree nodes.

[0010] Step 5: Obtain the vertex to be queried. According to the short tree decomposition, obtain the ancestor array of the vertex to be queried. Calculate the shortest road network time-consuming between each vertex in the ancestor array and the vertex to be queried in sequence and determine whether the shortest road network time-consuming meets the first threshold. If not, obtain the next vertex in the ancestor array, and recalculate the shortest road network time-consuming between the vertex and the vertex to be queried and determine whether it meets the updated first threshold. Otherwise, add the vertex in the ancestor array to the result set and update the first threshold according to the shortest road network time-consuming. At the same time, obtain the descendant table of the vertex, calculate the shortest road network time-consuming between each vertex in the result set and the vertex in the descendant table respectively, and determine whether the sum of the shortest road network time-consuming between the vertex and the vertex in the descendant table and the shortest road network time-consuming between the vertex and the vertex to be queried meets the updated first threshold. If the sum of the shortest road network time-consuming meets the updated first threshold, add the vertex in the descendant table to the result set, and update the first threshold according to the sum of the shortest road network time-consuming. If the sum of the shortest road network time-consuming does not meet the updated first threshold, obtain the next vertex in the ancestor array, and recalculate the shortest road network time-consuming between the vertex and the vertex to be queried and determine whether it meets the updated first threshold.

[0011] Step 6: Take the first k vertices in the result set as the nearest neighbor set of the vertex to be queried.

[0012] Preferably, constructing an ancestor array, a time-consuming array, and a descendant table for each numbered tree node respectively includes using X(v).anc to represent the ancestor array of the numbered tree node X(v), {X(u1), X(u2), …, X(u k )} are the tree nodes on the path from X(v) to the root node root, where X(u1) is X(v), X(u k ) is root, X(v).anc = {u1, u2, ..., u k}, for any 1 ≤ i ≤ k, using X(v).anc i to represent the i-th element in X(v).anc,

[0013] using X(v).cost to represent the time-consuming array of the tree node X(v), X(v).anc = {u1, u2, ..., u k}, X(v).cost = {cost(v, u1), cost(v, u2), …, cost(v, u k )}, X(v).cost stores the shortest path network time-consuming from vertex v to each vertex in X(v).anc. For any 1 ≤ i ≤ k, using X(v).cost i to represent the i-th element in X(v).cost, X(v).cost i = cost(v, X(v).anc i ),

[0014] The descendant table of the tree node X(v) is represented by X(v).cCostList. X(v).cCostList is a set of shortest path network time-consuming labels. Each label is a binary tuple, represented by <u, cost(u, v)>. u is the main vertex corresponding to any descendant node of X(v), and cost(u, v) is the shortest path network time-consuming from u to v.

[0015] Preferably, calculating the shortest path network time-consuming between each vertex in the ancestor array and the vertex to be queried includes representing the vertex in the ancestor array as v, representing the vertex to be queried as u, and calculating the shortest path network time-consuming between v and u according to formula (1),

[0016]

[0017] where, represents the weight between v and s, X(v).acce represents the set of neighbor vertices of v, s is a vertex in the set of neighbor vertices, and cost(s, u) is the shortest path network time-consuming between s and u.

[0018] Preferably, when the weight of the undirected weighted graph of the road changes, determine the vertex corresponding to the weight change, the set of affiliated vertices, the tree node corresponding to the vertex, and the set of tree nodes corresponding to the set of affiliated vertices. Update the weights of the edges corresponding to the tree nodes in the decomposition of the short tree and the weights between the tree nodes and the set of tree nodes corresponding to the set of affiliated vertices according to the minimum weight characteristic and the weight propagation mechanism. At the same time, update the time-consuming arrays and descendant tables of all tree nodes.

[0019] Preferably, a sentinel "sen" is set in the descendant table of the tree node. The "sen" is used to record the position of the shortest road network time-consuming label traversed by the descendant table during the kNN query before the update. When the weight of the undirected weighted graph of the road changes, perform an incremental query by viewing the shortest road network time-consuming labels affected before "sen" in the descendant table.

[0020] The present invention provides a kNN query method based on tree decomposition in a dynamic road network. It designs the construction and connection methods of tree nodes in the decomposition of the short tree, improves the generation method of the traditional tree decomposition, designs the ancestor array, time-consuming array, and descendant table set of tree nodes based on the decomposition of the short tree, and uses them as the underlying index. At the same time, it performs efficient queries based on the shortest road network time consumption, and performs pruning during the query process according to the relationship between the shortest road network time consumption and the first threshold, reducing a large amount of unnecessary calculations, thereby improving the time efficiency of kNN queries. Then, it proposes a method for maintaining the index when the road network is dynamically updated, and designs an incremental query algorithm to meet the query efficiency. It solves the problems in the existing kNN query methods that some are not restricted by the road network, some cannot flexibly adapt to changes in the k value, and some are only applicable to static road networks. More importantly, the query algorithm proposed by the present invention greatly improves the query time and efficiency on the premise of ensuring the correctness of kNN queries. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings required for the description of the embodiments or the prior art. Obviously, the following drawings are some embodiments of the present invention. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.

[0022] Figure 1 is the flowchart of the method of the present invention;

[0023] Figure 2 is an example diagram of the road network data used by the present invention when calculating kNN queries;

[0024] Figure 3 is an example diagram of the decomposition of the short tree generated by the improved tree decomposition generation strategy of the present invention;

[0025] Figure 4 is the index structure based on the decomposition and construction of dwarf trees in the present invention;

[0026] Figure 5 is the descendant list of each node in the DDT-Index of the index structure of the present invention;

[0027] Figure 6 is the flowchart of the kNN query algorithm of the present invention;

[0028] Figure 7 is a schematic diagram of the present invention taking the 5NN (q = v7, k = 5) query of vertex v7 as an example;

[0029] Figure 8 is the logical structure diagram of the SS-Graph of the present invention and the process diagram of maintaining the edge weights during road network update;

[0030] Figure 9 is the DDT-Index corresponding to the increase in the weight of the edge (v8, v9) in the road network G of the present invention and the descendant list of each node X(v i )

[0031] Figure 10 is the DDT-Index corresponding to the decrease in the weight of the edge (v7, v5) in the road network G of the present invention and the descendant list of each node X(v i )

[0032] Figure 11 is an example diagram of the incremental query of 5NN of v7 in the present invention. Detailed implementation manners

[0033] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are some, but not all, of the embodiments of the present invention. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the protection scope of the present invention.

[0034] Figure 1 is the flowchart of the method of the present invention. As Figure 1 shown, the method of this embodiment may include:

[0035] Step 1: Obtain a road network data set, and construct an undirected weighted graph of the road network according to the road network data set. The undirected weighted graph of the road network includes a vertex set, an edge set, and a weight set. The vertices are the intersections in the road network data set, the edges are the road segments between two intersections in the road network data set, and the weights are the average time required for a vehicle to pass through the road segment.

[0036] Step 2: Sort the vertex set in ascending order according to the degrees of the vertices. Select vertices from the sorted vertex set as the deletion vertices in sequence. Take the deletion vertex as the main vertex, construct tree nodes based on the main vertex and the neighbor vertex set of the main vertex, and assign a deletion point serial number to the tree nodes. Store the tree nodes and the deletion point serial numbers in the tree node set, and sort the tree node set in ascending order according to the deletion point serial numbers.

[0037] Step 3: Obtain the sorted tree node set. For each tree node in the tree node set, take the tree node corresponding to the first vertex as the deletion vertex in the neighbor vertex set of the current tree node as the parent node of the current tree node, connect the current tree node with the parent node, and take the connected tree node set as the decomposition of the short tree.

[0038] Step 4: Number each tree node in the decomposition of the short tree. For each numbered tree node, construct an ancestor array, a time-consuming array, and a descendant list respectively. Obtain the ancestor array, time-consuming array, and descendant list set of all tree nodes.

[0039] Step 5: Obtain the vertex to be queried. According to the decomposition of the short tree, obtain the ancestor array of the vertex to be queried. Calculate the shortest path network time-consuming between each vertex in the ancestor array and the vertex to be queried in sequence and determine whether the shortest path network time-consuming meets the first threshold. If not, obtain the next vertex in the ancestor array, recalculate the shortest path network time-consuming between the vertex and the vertex to be queried, and determine whether it meets the updated first threshold. Otherwise, add the vertex in the ancestor array to the result set, update the first threshold according to the shortest path network time-consuming, and at the same time obtain the descendant list of the vertex. Calculate the shortest path network time-consuming between each vertex in the result set and the vertices in the descendant list respectively, and determine whether the sum of the shortest path network time-consuming between the vertex and the vertices in the descendant list and the shortest path network time-consuming between the vertex and the vertex to be queried meets the updated first threshold. If the sum of the shortest path network time-consuming meets the updated first threshold, add the vertices in the descendant list to the result set and update the first threshold according to the sum of the shortest path network time-consuming. If the sum of the shortest path network time-consuming does not meet the updated first threshold, obtain the next vertex in the ancestor array, recalculate the shortest path network time-consuming between the vertex and the vertex to be queried, and determine whether it meets the updated first threshold.

[0040] Step 6: Take the first k vertices in the result set as the nearest neighbor set of the vertex to be queried.

[0041] Based on the above scheme, a method for constructing and connecting tree nodes in the decomposition of a short tree is designed, which improves the generation method of traditional tree decomposition. Based on the short tree decomposition, an ancestor array, a time-consuming array, and a set of descendant tables of tree nodes are designed and used as the underlying index. At the same time, efficient queries are performed based on the shortest path network time-consuming, and pruning is performed during the query process according to the relationship between the shortest path network time-consuming and the first threshold, reducing a large amount of unnecessary calculations, thereby improving the time efficiency of kNN queries. Then, a method for maintaining the index during the dynamic update of the road network is proposed, and an incremental query algorithm is designed to meet the query efficiency. On the premise of ensuring the correctness of kNN queries, the query time efficiency is greatly improved.

[0042] Step 1: Obtain a road network dataset, and construct an undirected weighted graph of the road network according to the road network dataset. The undirected weighted graph of the road network includes a vertex set, an edge set, and a weight set. The vertices are the intersections in the road network dataset, the edges are the road segments between two intersections in the road network dataset, and the weights are the average time required for vehicles to pass through the road segments. Specifically, the road network (hereinafter referred to as the road network) is modeled as an undirected weighted graph G(V, E), and V and E are used to represent the sets of vertices and edges in the road network respectively.

[0043] Each vertex v ∈ V in G represents an intersection of a road or the end point of a road (assuming that all car rental requests issued by users are located at road intersections). An edge e(u, v) ∈ E (u ≠ v) represents the road segment between intersection u and intersection v, and each edge corresponds to a weight indicating the average time required to pass through this road segment.

[0044] For each vertex v ∈ V, let nbr(v) = {u|(u, v) ∈ E} represent the set of all neighbor vertices of vertex v, and let deg(v) = |nbr(v)| represent the degree of vertex v, that is, the number of neighbor vertices.

[0045] Step 2: Sort the vertex set in ascending order according to the degree of the vertices. The degree of the vertices is the number of neighbor vertices of the vertices. The degree of vertex v is represented as deg(v) = |nbr(v)|. Select vertices from the sorted vertex set in turn as the deleted vertices, take the deleted vertices as the main vertices, construct tree nodes according to the main vertices and the set of neighbor vertices of the main vertices, and assign a deletion point serial number to the tree nodes. Store the tree nodes and the deletion point serial numbers in the tree node set, and sort the tree node set in ascending order according to the deletion point serial numbers.

[0046] Step 3: Obtain the sorted tree node set. For each tree node in the tree node set, take the tree node corresponding to the first deleted vertex in the neighbor vertex set of the current tree node as the parent node of the current tree node, connect the current tree node with the parent node, and use the connected tree node set as the short tree decomposition.

[0047] Specifically, Steps 2 and 3 are the process of generating a Dwarf Tree Decomposition (DDT).

[0048] Step 2.1: Vertex deletion. Using the vertex deletion strategy, vertices in the road network G are sequentially deleted to construct tree nodes, and a deletion vertex number r is assigned to each tree node. After all vertices in G are deleted, a set of tree nodes Λ is formed.

[0049] A tree node is represented by X(v), which consists of v and its neighbor vertices. In this embodiment, v is called the main vertex of X(v), and X(v).acce is used to represent the set of neighbor vertices of v, which is called the set of attached vertices of X(v).

[0050] Dwarf tree vertex deletion strategy: To ensure that the tree width of the tree decomposition is as small as possible, vertices are selected in ascending order of the degree of each vertex in G. For vertices with the same degree, the vertex with a smaller number of previous neighbors is selected as the deletion vertex.

[0051] The previous neighbor refers to, for the vertex v to be deleted, assuming that the set of vertices deleted before v is Vpre, for any vertex v' ∈ Vpre, if v ∈ X(v').acce, then v' is a previous neighbor of v.

[0052] For example Figure 3 in, assume that the next vertex to be deleted is v7, and the set of vertices deleted before v7 is X(v7).Vpre = {v8, v 10 , v9, v6}, where v7 ∈ X(v9).acce and v7 ∈ X(v6).acce, then it can be obtained that exnbr(v7) = 2.

[0053] Step 2.2: Tree decomposition construction. For the set of tree nodes Λ formed after all vertices in the road network are deleted, according to the deletion vertex number, for each tree node X(v) in Λ, the tree node corresponding to the vertex in its set of attached vertices that was deleted first is used as the parent node of X(v) for connection, and finally the decomposition DDT is constructed.

[0054] Step 4: Number each tree node of the dwarf tree decomposition. Numbering the tree nodes specifically includes numbering each tree node X(v) in the DDT, denoted by X(v).no. If the child node X(v) i is the m-th child of its parent node X(v) j , then X(v) i .no = X(v) j.no +'m'. It is stipulated that the number of the root node is 1. When m exceeds 9, letter strings can be used for continuous numbering. By numbering the tree nodes, only the longest common prefix of the numbers of any two tree nodes needs to be found to quickly determine the relationship between the two tree nodes and the lowest common ancestor. For example, when the length of the longest common prefix of the numbers corresponding to the tree nodes X(v) and X(u) is equal to one of the lengths of the numbers of the two tree nodes, then X(v) and X(u) are in an ancestor-descendant relationship. Otherwise, the number of the tree node corresponding to the lowest common ancestor of X(v) and X(u) is the longest common prefix at this time. By determining the ancestor-descendant relationship and the lowest common ancestor of any two main vertices, the shortest time consumption between the two points can be quickly obtained.

[0055] For each numbered tree node, construct an ancestor array, a time consumption array, and a descendant list respectively. The step of constructing an ancestor array, a time consumption array, and a descendant list for each numbered tree node respectively includes using X(v).anc to represent the ancestor array of the numbered tree node X(v), {X(u1), X(u2), …, X(u k )} are the tree nodes on the path from X(v) to the root node root, where X(u1) is X(v), and X(u k ) is root, X(v).anc = {u1, u2,..., u k}, for any 1 ≤ i ≤ k, use X(v).anc i to represent the i-th element in X(v).anc.

[0056] Use X(v).cost to represent the time consumption array of the tree node X(v). X(v).anc = {u1, u2,..., u k}, X(v).cost = {cost(v, u1), cost(v, u2), …, cost(v, u k )}, X(v).cost stores the shortest path network time consumption from vertex v to each vertex in X(v).anc. For any 1 ≤ i ≤ k, use X(v).cost i to represent the i-th element in X(v).cost, and X(v).cost i = cost(v, X(v).anc i ).

[0057] The descendant list of the tree node X(v) is represented by X(v).cCostList. X(v).cCostList is a set of shortest path network time consumption labels. Each label is a binary tuple, represented by <u, cost(u, v)>, where u is the main vertex corresponding to any descendant node of X(v), and cost(u, v) is the shortest path network time consumption from u to v.

[0058] Obtain the ancestor array, time-consuming array, and descendant table set of all tree nodes.

[0059] Step 5: Obtain the vertex to be queried. According to the decomposition of the short tree, obtain the ancestor array of the vertex to be queried. Calculate the shortest path network time-consuming between each vertex in the ancestor array and the vertex to be queried in turn, and determine whether the shortest path network time-consuming meets the first threshold. If it does not meet the threshold, obtain the next vertex in the ancestor array, recalculate the shortest path network time-consuming between the vertex and the vertex to be queried, and determine whether it meets the updated first threshold. Otherwise, add the vertex in the ancestor array to the result set, update the first threshold according to the shortest path network time-consuming, and at the same time obtain the descendant table of the vertex. Calculate the shortest path network time-consuming between each vertex in the result set and the vertex in the descendant table respectively, and determine whether the sum of the shortest path network time-consuming between the vertex and the vertex in the descendant table and the shortest path network time-consuming between the vertex and the vertex to be queried meets the updated first threshold. If the sum of the shortest path network time-consuming meets the updated first threshold, add the vertex in the descendant table to the result set and update the first threshold according to the sum of the shortest path network time-consuming. If the sum of the shortest path network time-consuming does not meet the updated first threshold, obtain the next vertex in the ancestor array, recalculate the shortest path network time-consuming between the vertex and the vertex to be queried, and determine whether it meets the updated first threshold.

[0060] The calculation of the shortest path network time-consuming between each vertex in the ancestor array and the vertex to be queried includes representing the vertex in the ancestor array as v, representing the vertex to be queried as u, and calculating the shortest path network time-consuming between v and u according to formula (1).

[0061]

[0062] Among them, represents the weight between v and s, X(v).acce represents the set of neighbor vertices of v, s is a vertex in the set of neighbor vertices, and cost(s, u) is the shortest path network time-consuming between s and u.

[0063] Step 6: Take the first k vertices in the result set as the nearest neighbor set of the vertex to be queried.

[0064] The above Steps 5 and 6 can be regarded as the process of performing kNN queries. Specifically,

[0065] Step 4.1: Obtain the processing vertex table of the query point q, that is, X(q).anc.

[0066] Step 4.2: Scan the vertices in X(q).anc in turn. For the i-th (1 ≤ i ≤ |X(q).anc|) vertex s scanned, calculate cost(q, s), and cost(q, s) = X(q).cost i, if cost(q, s) ≤ threshold, add s to the result set R and update threshold; otherwise, continue to scan the (i + 1)-th ancestor node.

[0067] Step 4.3: For the vertex s added to the result set R, sequentially scan the vertices v corresponding to the labels in X(s).cCostList i , and calculate curCost(q, v i , s), curCost(q, v i , s) = cost(q, s) + cost(v i , s), if curCost(q, v i , s) ≤ threshold, add v i to the result set R and update threshold; otherwise, stop scanning the current X(s).cCostList. Repeat Step 4.2 and Step 4.3 until all vertices in X(q).anc have been scanned.

[0068] To reduce the computational cost, design the following pruning strategies in Steps 4.2 and 4.3:

[0069] Strategy 1: When the shortest path network time consumption from the query point q to the main vertex s corresponding to the ancestor node X(s) is greater than or equal to the threshold, according to Theorem 1, there is no need to continue scanning the labels in X(s).cCostList.

[0070] Strategy 2: When the current shortest path network time consumption from the query point q passing through the ancestor node X(s) to the vertex v is greater than the threshold, according to Theorem 2, there is no need to continue scanning and calculating the time consumption labels after v.

[0071] Strategy 3: Given the query point q, according to Theorem 3, for the vertices v (v ∈ X(q).cCostList) that have been scanned and calculated, there is no need to recalculate in the descendant lists of other ancestor nodes of X(q).

[0072] Strategy 4: Given the query point q, for the vertices v (v ∈ X(q).anc) that have been scanned and calculated, if v appears in the descendant list of another ancestor node X(s), according to Theorem 4, there is no need to calculate the time consumption label corresponding to the vertex v in X(s).cCostList.

[0073] Among them, Theorem 1: Given the query point q and any ancestor node vertex X(s) of X(q), if cost(q, s) ≥ threshold, then for any vertex v ∈ X(s).cCostList, curCost(q, v, s) > threshold.

[0074] Proof: Given a query point q and any ancestor node vertex X(s) of X(q), for any vertex v ∈ X(s).cCostList, curCost(q, v, s) = cost(q, s) + cost(v, s). Since cost(q, s) ≥ threshold and cost(v, s) > 0, then curCost(q, v, s) > threshold. Therefore, v cannot be a kNN of q.

[0075] Theorem 2: Given a query point q and any ancestor node vertex X(s) of X(q), if cost(q, s) < threshold and curCost(q, v, s) > threshold (v ∈ X(s).cCostList), for any vertex p ∈ X(q).cCostList sorted after v, curCost(q, p, s) > threshold.

[0076] Proof: For any vertex p ∈ X(q).cCostList sorted after v, it is easy to obtain that cost(p, s) > cost(v, s). Since curCost(q, v, s) = cost(v, s) + cost(q, s) > threshold, then curCost(q, p, s) = cost(q, s) + cost(p, s) > curCost(q, v, s) > threshold. Therefore, p cannot be a kNN of q.

[0077] Theorem 3: Given a query point q, for any vertex v ∈ X(q).cCostList ∪ q, curCost(q, v, q) = Cost(q, v).

[0078] Proof: For any vertex v ∈ X(q).cCostList ∪ q, curCost(q, v, q) = cost(q, q) + cost(v, q). Since cost(q, q) = 0, then curCost(q, v, q) = Cost(q, v).

[0079] Theorem 4: Given a query point q and any ancestor node X(s) of X(q), for any v ∈ X(q).anc and v ∈ X(s).cCostList, cost(q, v) ≤ curCost(q, v, s).

[0080] Proof: According to formula (1), if s ∈ X(q).acce, then cost(q, v) ≤ curCost(q, v, s). If Then cost(q, v) < curCost(q, v, s). In summary, cost(q, v) ≤ curCost(q, v, s).

[0081] When the weight of the undirected weighted graph of the road changes, determine the vertex corresponding to the weight change, the set of affiliated vertices, the tree node corresponding to the vertex, and the set of tree nodes corresponding to the set of affiliated vertices. Update the weights of the edges corresponding to the tree nodes in the decomposition of the short tree and the weights between the tree nodes corresponding to the set of tree nodes and the set of affiliated vertices according to the minimum weight property and the weight propagation mechanism. At the same time, update the time-consuming arrays and descendant tables of all tree nodes.

[0082] Among them, the minimum weight property is as follows: Given the SS-Graph corresponding to the short tree decomposition DDT, the present invention refers to the vertex connected to the front end of the arrow as the inner neighbor and the vertex connected to the end of the arrow as the outer neighbor. Let v r1 , v r2 ,..., v rn be the inner neighbors of v s , and v s11 , v s12 , v s21 , v s22 ,..., v sn1 , v sn2 be the inner neighbors of v r1 , v r2 ,..., v rn . Given any shortcut edge s, if then it can be said that v s satisfies the minimum weight property. Each rectangular vertex in the SS-Graph satisfies the minimum weight property.

[0083] The shortcut edge weight propagation mechanism is as follows: According to the minimum weight property, in the SS-Graph, for the rectangular vertex v s corresponding to the shortcut edge s, when one of them changes, it may cause v s to violate the minimum weight property. When changes, it may further affect the upper rectangular vertex to violate the minimum weight property. Therefore, when the weight of a shortcut edge s changes, first judge whether v s violates the minimum weight property. If it violates, then adjust and then use the outer neighbor of the outer neighbor of v s as the candidate vertex for further adjustment. If it does not violate, no other processing is required. According to this mechanism, adjust iteratively until all rectangular vertices satisfy the minimum weight property.

[0084] Specifically, for the cases of increasing and decreasing edge weights in graph G, in this embodiment, according to the minimum weight property and the weight propagation mechanism, the weights of the edges corresponding to the rectangular vertices in the SS-graph are updated, and at the same time, the weights from the main vertex to the affiliated vertices in the tree nodes are updated. Among them, SS-Graph and DDT are the same physical structure, and its corresponding logical view can be regarded as a directed graph containing two types of vertices. The rectangular vertices in the graph correspond one-to-one to the edges from the main vertex to each affiliated vertex in the tree nodes of the short tree decomposition DDT. The circular vertices represent an influence relationship, that is, the change of the weights of two adjacent edges (v, u) and (v, w) of a vertex v may affect the change of the weight of the edge (u, w). After updating the weights from the main vertex to the affiliated vertices in the tree nodes, the cost array of each tree node is updated according to the formula.

[0085] When the road network is updated, the incremental query can combine the previous query results to more quickly return the kNN query results. Specifically, a sentinel sen is set in the descendant table of the tree node respectively. The sen is used to record the position of the shortest road network time-consuming label traversed by the descendant table during the kNN query before the update. When the weight of the undirected weighted graph of the road changes, the incremental query is performed by checking the shortest road network time-consuming labels affected before sen in the descendant table. The scanning strategy of vertices during the incremental query is specifically as follows:

[0086] 1) If the shortest road network time-consuming from the ancestor node X(v) to the query point remains unchanged, only some time-consuming labels in the descendant table of the ancestor node are affected and changed, and the index subscript of the foremost affected label is greater than sen, then the ancestor node can be scanned upward continuously; if the index subscript of the first affected time-consuming label is less than or equal to sen, then it is necessary to scan the vertices in sequence starting from the first affected label and calculate the current shortest road network time-consuming from it to the query point, and the labels before the first affected time-consuming label do not need to be calculated anymore.

[0087] 2) If the shortest road network time-consuming from the ancestor node X(v) to the query point changes, then it is necessary to scan the descendant table of X(v) in sequence again and calculate the current shortest road network time-consuming from it to the query point, and the subsequent ancestor vertices also need to scan their descendant tables again.

[0088] Figure 2 This is an example graph of road network data used in this embodiment when calculating the kNN query. Each vertex v in it represents the intersection of a road or the end point of a road. It is assumed that the car rental requests sent by users are all located at road intersections. Each edge e(u, v) represents the road section between intersection u and intersection v, and each edge corresponds to a weight indicating the average time required to pass through this road section, which we call the road network time-consuming. For convenience, the direction of the edges in the road network is not considered.

[0089] Figure 3 To Figure 2 generate an example diagram of a short tree decomposition generated from the road network diagram shown using an improved tree decomposition generation strategy, where the left diagram shows Figure 2 the set of tree nodes formed by sequentially deleting vertices in accordance with the vertex deletion strategy. Each tree node has a vertex deletion serial number, and each tree node consists of a main vertex and the neighbor vertices of the main vertex, and also includes the road network travel time from the main vertex to each neighbor vertex.

[0090] For example, when deleting vertex v8, first add the vertices v9 and v5 adjacent to vertex v8 to the set X(v8), X(v8) = {v9, v5}, and retain the weights from vertex v8 to vertices v9 and v5. Then delete the edges connected to vertex v8, and add an edge between vertices v9 and v5, whose weight is After deleting vertex v8, it becomes the corresponding tree node X(v8) = {v8, v9, v5}, X(v8).acce = {v9, v5}.

[0091] The right diagram is the generated short tree decomposition. In the construction stage, for each tree node X(v) in the set of tree nodes Λ, according to the vertex deletion order r, connect the tree node corresponding to the vertex that is deleted first among its attached vertices as the parent node of X(v), and finally form the short tree decomposition DDT. For example, the vertex deletion serial number of the tree node X(v9) corresponding to vertex v9 is the smallest in the attached vertex set of X(v8), so connect the tree node X(v9) as the parent node of the tree node X(v8).

[0092] Figure 4 To Figure 2 construct an index structure based on the short tree decomposition, for each node except X(v), it consists of three parts, including the node number X(v).no, the ancestor array X(v).anc, and the cost array X(v).cost; by numbering the tree nodes, only need to find the longest common prefix of the numbers of any two tree nodes to quickly determine the relationship between the two tree nodes and the least common ancestor.

[0093] For example, when the length of the longest common prefix of the numbers corresponding to the tree nodes X(v) and X(u) is equal to one of the lengths of the numbers of the two tree nodes, then X(v) and X(u) are in an ancestor-descendant relationship, otherwise, the tree node number corresponding to the least common ancestor of X(v) and X(u) is the longest common prefix at this time. By determining the ancestor-descendant relationship and the least common ancestor of any two main vertices, the shortest travel time between the two points can be quickly obtained.

[0094] In Figure 4Among them, the number of the root node X(v0) is 1. The child node X(v9) is the first child node of its parent node X(v5). Since X(v5).no = 11, then X(v9).no = 111; X(v2) is the second child node of X(v5), then X(v2).no = 112. The ancestor array of each tree node X(v) stores the main vertices corresponding to the tree nodes on the path from X(v) to the root node root. The elements in the ancestor array correspond one by one to the elements in the time-consuming array. For example, the ancestor array of the tree node X(v4) is X(v4).anc = {v4, v2, v5, v0}, where X(v).anc2 = v2. The time-consuming array of the tree node X(v) stores the shortest path network time-consuming from the main vertex v to each vertex in X(v).anc.

[0095] The time-consuming array of the tree node X(v4) is X(v4).cost = {0, 2, 3, 2}, indicating that the shortest path network time-consuming to the main vertices v4, v2, v5, v0 corresponding to each ancestor node is 0, 2, 3, 2 respectively. The shortest path network time-consuming corresponding to the main vertices of each ancestor node from the query point can be obtained through the array subscript. For example, X(v4).cost2 = 2, indicating that the shortest path network time-consuming from the vertex v4 to the main vertex v2 corresponding to the ancestor node X(v2) is 2.

[0096] Figure 5 For the descendant list of each node in the index structure DDT-Index. For example, in the table, X(v9).cCostList = {(v7, 1), (v6, 1), (v8, 2)}, indicating that the main vertices corresponding to the descendant nodes of the tree node X(v9) are v7, v6, v8, and the ascending order sequences of the shortest path network time-consuming from the vertex v9 to the main vertices corresponding to its each descendant node are 1, 1, 2 respectively.

[0097] Figure 6 It is the flowchart of the kNN query algorithm in the present invention.

[0098] After a query point q and an integer k are given,

[0099] In the first step, obtain the processing vertex table of the query point q, that is, X(q).anc.

[0100] In the second step, scan the vertices in X(q).anc in turn. For the i-th (1 ≤ i ≤ |X(q).anc|) vertex s scanned, calculate cost(q, s), cost(q, s) = X(q).cost i , if cost(q, s) ≤ threshold, then add s to the result set R and update threshold, otherwise continue to scan the (i + 1)-th ancestor node.

[0101] In the third step, for the vertex s added to the result set R, sequentially scan the vertices v corresponding to the tags in X(s).cCostList i , and calculate curCost(q, v i , s), curCost(q, v i , s) = cost(q, s) + cost(v i , s). If curCost(q, v i , s) ≤ threshold, then add v i to the result set R and update threshold; otherwise, stop scanning the current X(s).cCostList

[0102] Repeat the second and third steps until all vertices in X(q).anc have been scanned

[0103] Figure 7 Taking 5NN(q = v7, k = 5) for the query vertex v7 as an example, first obtain the vertices in the ancestor array of X(v7) as the processing vertices. X(v7).anc = {v7, v9, v5, v0}. For X(v7), since v7 is the query point itself, no processing is required. Then expand its descendant list to get X(v7).cCostList = {<v6, 2>}. Calculate curCost(v7, v6, v6) = cost(v7, v6) = 2 which is less than the threshold, so add v6 to the result set R. At this time, R = {v6}

[0104] For the vertex v9, since cost(v7, v9) = 1 which is less than the threshold, add v9 to the result set R. At this time, R = {v9, v6} and |R| = 2 < k, so continue to scan its descendant list. X(v9).cCistList = {<v7, 1>, <v6, 1>, <v8, 2>}. v7 is the query point itself and no processing is required. X(v6) is a descendant node of X(v7), so according to Strategy 3, v6 also does not need to be processed. For the vertex v8, since curCost(v7, v8, v9) = cost(v7, v9) + cost(v8, v9) = 3 which is less than the threshold, add v8 to the result set. At this time, the result set R = {v9, v6, v8}

[0105] For the vertex v5, cost(v7, v5) = 4 is still less than the threshold, add v5 to the result set. At this time, R = {v9, v6, v8, v5} and |R| = 4 < k, so continue to scan its descendant list

[0106] X(v5).cCistList = {<v8, 2>, <v3, 2>, <v4, 3>, <v2, 4>, <v9, 4>,

[0107] <v7,4> ,<v1,4> ,<v6,5> , <v 10 ,6>}, for vertex v8, since curCost(v7,v8,v5)=6 <curCost(v7,v8,v9)=3,所以不做处理。对于顶点v3,由于curCost(v7,v3,v5)=cost(v7,v5)+cost(v3,v5)=6小于阈值,所以将v3加入结果集。

[0108] At this time, R = {v9, v6, v8, v5, v3} and |R| = 5 = k, so the threshold is updated to 6. When scanning to vertex v4, since curCost(v7, v4, v5) = 7>threshold = 6, according to strategy 2, we can stop scanning X(v5).cCistList. We continue to scan the ancestor array of query point v7. When scanning vertex v0, since cost(v7, v0) = 4 <threshold=6,所以将加入结果集R并更新阈值threshold=4。此时,R={v9,v6,v8,v5,v0}。根据策略1,则不需要再扫描X(v0).cCostList。至此,X(v7)的所有祖先节点扫描完毕。由于k=5,所以,取结果集R中前5个顶点对象,最终得到v7的5NN为{v9,v6,v8,v5,v0}。

[0109] Figure 8 The present invention uses the logical structure to maintain the index structure when the road network is dynamically updated. SS-Graph and DDT are the same physical structure, and their corresponding logical view can be regarded as a directed graph containing two types of vertices, such as Figure 8 As shown. The rectangular vertices in the figure correspond one by one to the edges corresponding to the main vertex to each subsidiary vertex in the tree node of the dwarf tree decomposition DDT. The circular vertex represents an influence relationship, that is, the change in the weights of the two adjacent edges (v,u) and (v,w) of a vertex v may affect the weight of the edge (u,w). The upper part of the rectangular vertex represents the edge, the lower right part represents the shortest path network time of the vertices at both ends of the edge, and the lower left part is a weight counter, which represents the number of solutions for obtaining the shortest path network time, represented by cnt. For the convenience of description, the present invention calls the edge corresponding to the rectangular vertex a shortcut edge, represented by v s Indicates that the circular vertex is represented by v r express.

[0110] by Figure 8Taking the rectangular vertex corresponding to mid(v7, v0) as an example, the shortest road network time from vertex v7 to v0 is 4, and the weight counter is 2, indicating that v7 can reach v0 directly or via v6, and the road network times of these two schemes are equal.

[0111] During the maintenance process, a queue q is used to store the affected rectangular vertices.

[0112] For the case where the edge weight value decreases. For example, the weight of edge (v7, v5) decreases from 4 to 2. According to the minimum weight property, first check whether the weight of rectangular vertex v(v7, v5) is affected. By counting It shows that the weight of v(v7, v5) is affected, so modify and add v(v7, v5) to the queue q. At this time, q = {v(v7, v5)}.

[0113] Then v(v7, v5) dequeues. Due to the change in the weight of rectangular vertex v(v7, v5), by checking with SS-Graph, the outer neighbors' outer neighbors of rectangular vertex v(v7, v5) may have rectangular vertices v(v9, v5) and v(v5, v0) that may become the next affected vertices.

[0114] Check rectangular vertex v(v9, v5).

[0115] It shows that the weight of this vertex is affected, modify and add it to the queue q.

[0116] For rectangular vertex v((v5, v0)).

[0117] It shows that the weight of rectangular vertex (v5, v0) is not affected by the change in the weight of rectangular vertex v(v7, v5). At this time, the queue q = {v(v9, v5)}.

[0118] Similarly, due to the change in the weight of v(v9, v5), it may only affect v(v5, v0). After calculation using the minimum weight property, it is found that v(v5, v0) is not affected. At this time, the queue is empty, and the check can be stopped.

[0119] For the case where the edge weight value increases. For example, the weight of edge (v6, v9) increases from 1 to 2. Before the weight of edge (v6, v9) changes, Therefore, the weight counter of v(v6, v9) is decremented by 1. At this time, v(v6, v9).cnt = 1 - 1 = 0, indicating that a change in the weight of edge (v6, v9) will definitely affect the weight of v(v6, v9). Therefore, v(v6, v9) is added to the queue q. At this time, q = {v(v6, v9)}.

[0120] Then, v(v6, v9) is dequeued. First, calculate the rectangular vertices that may be affected by the change in the weight of v(v6, v9). The outer neighbors of the outer neighbors of v(v6, v9) are v(v9, v7) and v(v9, v0).

[0121] For v(v9, v7), since it shows that a change in the weight of v(v6, v9) will not affect the weight of v(v9, v7).

[0122] For v(v9, v0), since it shows that a change in the weight of v(v6, v9) may affect the weight of v(v9, v7). The weight counter of v(v9, v0) is decremented by 1. At this time, v(v9, v0).cnt = 1 - 1 = 0, indicating that a change in the weight of v(v6, v9) will definitely affect the weight of v(v9, v0). So, v(v9, v0) is added to the queue q. After checking the rectangular vertices that may be affected by the change in the weight of v(v6, v9), finally, calculate using the minimum weight property At the same time, modify the weight from v6 to the attached vertex v9 in X(v6) to 2. At this time, q = {v(v9, v0)}. After v(v9, v0) is dequeued, similarly, first check the rectangular vertices that may be affected by the change in the weight of v(v9, v0). For the outer neighbor's outer neighbor v(v5, v0) of v(v9, v0), since Therefore, the weight of will definitely not be affected by the change in the weight of v(v6, v9). After checking the rectangular vertices that may be affected by the change in the weight of v(v9, v0).

[0123] Then, calculate using the minimum weight property At the same time, modify the weight from v9 to the attached vertex v0 in X(v9) to 4. At this time, the queue q is empty, and the check can be stopped.

[0124] Figure 9 and Figure 10 are the corresponding DDT-Index and the descendant tables of each node X(v i ) after the weight of edge (v8, v9) in the road network G is increased from 2 to 4 and the weight of edge (v7, v5) is decreased from 4 to 2, respectively.

[0125] Figure 11An example of the 5NN for incremental query v7. A pos array is set for each node X(v) to indicate whether the road network travel time from v to X(v).anc has changed, and the default value is false. The initial scanned node of the incremental query algorithm still starts from the tree node corresponding to the query point. Since the road network travel time from X(v7) to itself does not change and eff = -1, the calculation result of the previous scanned node X(v7) can be directly added to the result set R and the threshold can be updated. When scanning to node X(v9), X(v7).pos2 = false, indicating that the shortest road network time from X(v7) to the ancestor node X(v9) has not changed, but X(v9).eff = 3, indicating that the descendant list of X(v9) has changed and the first affected labeled node is v8. In addition, X(v9).sen = 3, so according to the scanning strategy in this paper, the nodes corresponding to the labels before v8 can be added to the result set and the threshold can be updated, and the descendant list can be scanned continuously starting from v8. When scanning to the ancestor node X(v5), X(v7).pos2 = true, indicating that the shortest road network time from X(v7) to the ancestor node X(v5) has changed. Therefore, it is necessary to scan the descendant list of X(v5) from the beginning. Similarly, after scanning X(v0), the result set R = {v9, v6, v5, v3, v0} is finally obtained.

[0126] Overall beneficial effects:

[0127] The present invention provides a kNN query method based on tree decomposition on a dynamic road network, designs a method for constructing and connecting tree nodes in a stubby tree decomposition, improves the generation method of traditional tree decomposition, designs an ancestor array, a travel time array, and a descendant list set of tree nodes based on stubby tree decomposition, and uses them as the underlying index. At the same time, efficient queries are performed based on the shortest road network travel time, and pruning is performed during the query process according to the relationship between the shortest road network travel time and the first threshold, reducing a large amount of unnecessary calculations, thereby improving the time efficiency of kNN queries. Then, a method for maintaining the index when the road network is dynamically updated is proposed, and an incremental query algorithm is designed to meet the query efficiency. It solves the problems in existing kNN query methods that some are not restricted by the road network, some cannot flexibly adapt to changes in the k value, and some are only applicable to static road networks. More importantly, the query algorithm proposed by the present invention greatly improves the query time and efficiency on the premise of ensuring the correctness of kNN queries.

[0128] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that they can still modify the technical solutions described in the foregoing embodiments, or perform equivalent replacements on some or all of the technical features; and these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.

Claims

1. A kNN query method based on tree decomposition on a dynamic road network, characterized in that, including, Step 1: Obtain a road network dataset, and construct an undirected weighted road graph according to the road network dataset. The undirected weighted road graph includes a vertex set, an edge set, and a weight set. The vertices are the intersections in the road network dataset, the edges are the road segments between two intersections in the road network dataset, and the weights are the average time required for a vehicle to pass through a road segment. Step 2: Sort the vertex set in ascending order according to the degree of the vertices. Select vertices from the sorted vertex set in turn as deleted vertices, take the deleted vertices as the main vertices, construct tree nodes according to the main vertices and the neighbor vertex sets of the main vertices, and assign a deletion point number to the tree nodes. Store the tree nodes and the deletion point numbers in the tree node set, and sort the tree node set in ascending order according to the deletion point numbers. Step 3: Obtain the sorted tree node set. For each tree node in the tree node set, take the tree node corresponding to the first deleted vertex in the neighbor vertex set of the current tree node as the parent node of the current tree node, connect the current tree node with the parent node, and take the connected tree node set as the low tree decomposition. Step 4: Number each tree node in the low tree decomposition. For each numbered tree node, construct an ancestor array, a time-consuming array, and a descendant list respectively. Obtain the ancestor arrays, time-consuming arrays, and descendant list sets of all tree nodes. Step 5: Obtain the vertex to be queried. According to the low tree decomposition, obtain the ancestor array of the vertex to be queried. Calculate the shortest road network time-consuming between each vertex in the ancestor array and the vertex to be queried in turn and determine whether the shortest road network time-consuming meets the first threshold. If not, obtain the next vertex in the ancestor array, and recalculate the shortest road network time-consuming between the vertex and the vertex to be queried and determine whether it meets the updated first threshold. Otherwise, add the vertex in the ancestor array to the result set and update the first threshold according to the shortest road network time-consuming. At the same time, obtain the descendant list of the vertex, calculate the shortest road network time-consuming between each vertex in the result set and the vertices in the descendant list respectively, and determine whether the sum of the shortest road network time-consuming between the vertex and the vertices in the descendant list and the shortest road network time-consuming between the vertex and the vertex to be queried meets the updated first threshold. If the sum of the shortest road network time-consuming meets the updated first threshold, add the vertices in the descendant list to the result set and update the first threshold according to the sum of the shortest road network time-consuming. If the sum of the shortest road network time-consuming does not meet the updated first threshold, obtain the next vertex in the ancestor array, and recalculate the shortest road network time-consuming between the vertex and the vertex to be queried and determine whether it meets the updated first threshold. Step 6: Take the first k vertices in the result set as the nearest neighbor set of the vertex to be queried.

2. The kNN query method based on tree decomposition on a dynamic road network according to claim 1, wherein, For each numbered tree node, construct an ancestor array, a time-consuming array, and a descendant table respectively, including using X(v).anc to represent the ancestor array of the numbered tree node X(v). {X(u1), X(u2), …, X(u k )} are the tree nodes on the path from X(v) to the root node root, where X(u1) is X(v), and X(u k ) is root. X(v).anc = {u1, u2,..., u k}, and for any 1 ≤ i ≤ k, use X(v).anc i to represent the i-th element in X(v).anc. Use X(v).cost to represent the time-consuming array of the tree node X(v), X(v).anc = {u1, u2,..., u k}, X(v).cost = {cost(v, u1), cost(v, u2), …, cost(v, u k )}, X(v).cost stores the shortest path network time-consuming from vertex v to each vertex in X(v).anc. For any 1 ≤ i ≤ k, use X(v).cost i to represent the i-th element in X(v).cost, X(v).cost i = cost(v, X(v).anc i ), The descendant list of tree node X(v) is represented by X(v).cCostList. X(v).cCostList is a set of shortest road network time-consuming labels. Each label is a binary tuple, represented by <u, cost(u, v)>. u is the main vertex corresponding to any descendant node of X(v), and cost(u, v) is the shortest road network time-consuming from u to v.

3. A kNN query method based on tree decomposition on a dynamic road network according to claim 1, characterized in that, Calculating the shortest path network time consumption between each vertex in the ancestor array and the vertex to be queried includes representing the vertices in the ancestor array as v, representing the vertex to be queried as u, and calculating the shortest path network time consumption between v and u according to formula (1). Among them, represents the weight between v and s, X(v).acce represents the set of neighbor vertices of v, s is a vertex in the set of neighbor vertices, and cost(s, u) is the shortest path network time consumption between s and u.

4. A kNN query method based on tree decomposition on a dynamic road network according to claim 1, characterized in that, When the weight of the undirected weighted graph of the road changes, determine the vertex corresponding to the weight change, the set of affiliated vertices, the tree node corresponding to the vertex, and the set of tree nodes corresponding to the set of affiliated vertices. Update the weights of the edges corresponding to the tree nodes in the decomposition of the dwarf tree and the weights between the tree nodes corresponding to the set of tree nodes and the set of affiliated vertices according to the minimum weight characteristic and the weight propagation mechanism. At the same time, update the time-consuming arrays and descendant tables of all tree nodes.

5. The kNN query method based on tree decomposition on a dynamic road network according to claim 2, wherein, A sentinel sen is set in the descendant table of the tree node. The sen is used to record the position of the shortest path network time consumption label traversed by the descendant table during the kNN query before the update. When the weight of the undirected weighted graph of the road changes, perform an incremental query by viewing the shortest path network time consumption labels affected before sen in the descendant table.

Citation Information

Patent Citations

  • Mobile object-oriented neighbor query method in dynamic directed road network

    CN112836145A

  • Processing Search Queries Using A Data Structure

    US20130103678A1