Reverse k nearest neighbor query method and device based on Sketch graph and medium
By adopting the Sketch graph-based method in the reverse k nearest neighbor query technology, the inefficiency problem of query parameter k is solved when the data points are large or the data points are sparse, and efficient reverse k nearest neighbor query is realized, reducing computing overhead and adapting to large-scale road networks.
Patent Information
- Application Number
- CN202510109817.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-23
- Publication Date
- 2025-06-06
AI Technical Summary
The existing reverse k nearest neighbor query technology is difficult to efficiently process when the query parameter k is large or the data points are sparse, resulting in waste of verification and calculation of a large number of redundant nodes.
The reverse k nearest neighbor query method based on the Sketch graph is used to build a road network model, use the multi-source Dijkstra algorithm to generate a Sketch graph, and search for the reverse k nearest neighbor data points of the query point in the Sketch graph.
This method can effectively reduce the complexity of search space and time, improve query efficiency, reduce computing overhead, and adapt to the expansion of large-scale road networks.
Smart Images

Figure CN120104856A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of reverse k-nearest neighbor query, and in particular to a reverse k-nearest neighbor query method, device, equipment and medium. Background Art
[0002] Reverse k-nearest neighbor query is a new spatial query method proposed on the basis of k-nearest neighbor query, which aims to find all data points that regard the query point as k-nearest neighbor. This query technology has a wide range of practical applications in road network space, such as facility / service location selection, location-based service applications, potential impact analysis, etc. Reverse k-nearest neighbor query technology has been widely and deeply studied in Euclidean space, but due to the significant difference between the properties of road network space and Euclidean space, the reverse k-nearest neighbor query technology based on Euclidean space cannot be applied to road network space. Existing solutions based on road network space can be divided into two categories, eager-based methods and subgraph-based methods. The eager-based solution optimizes the Dijstra search on the original graph, and narrows the search range according to the judgment results of each point during the Dijstra search process. The subgraph-based method divides the original road network into several subgraphs, searches in subgraphs, and verifies all data points contained in the subgraph when a subgraph is found.
[0003] However, existing solutions have a common drawback, that is, they are difficult to apply when the query parameter k is large or the data points are sparse. The query parameter k and the sparsity of the data points determine the search range of the algorithm. The eager-based method is limited by Dijstra's search framework, and the search efficiency is low when the search range is large; the efficiency of the subgraph-based method decreases as the sparsity of the data points decreases, and when the scale of the road network increases, the subgraph storage overhead becomes unbearable. In addition, both methods will perform verification operations on a large number of redundant nodes, resulting in huge computational waste.
[0004] Therefore, it is urgent to propose a reverse k-nearest neighbor query method to solve the problem of verifying a large number of redundant nodes when the query parameters are large or the data points are sparse in spatial queries, resulting in huge computational waste. Summary of the invention
[0005] In order to overcome the problems existing in the related art, the present disclosure provides a reverse k-nearest neighbor query method, device, equipment and medium to solve the technical problem in the related art that when the query parameters are large or the data points are sparse in spatial query, verification operations are performed on a large number of redundant nodes, resulting in huge computational waste.
[0006] One or more embodiments of this specification provide a reverse k-nearest neighbor query method based on a Sketch graph, comprising the following steps:
[0007] Building a road network model based on a large-scale road network, and acquiring nodes in the road network model to build a data point set;
[0008] Constructing a Sketch diagram using multi-source Dijstra based on the data point set;
[0009] Connecting the query point to the Sketch diagram;
[0010] Search the Sketch graph for all reverse k-nearest neighbor data points of the query point.
[0011] Preferably, constructing a Sketch diagram based on the data point set using multi-source Dijstra specifically includes the following steps:
[0012] Building a Sketch diagram based on each data point in the data point set;
[0013] Taking any data point as the starting point, construct all neighbor data point information in the Sketch into triples, and add the triples to the traversal queue. The triples include the neighbor data point, the distance from the neighbor data point to the query point, and the previous data point on the traversal path.
[0014] The access is performed according to the triplet with the smallest distance from the neighbor data point to the query point that is popped out from the traversal queue each time until the traversal queue is empty.
[0015] Preferably, the step of accessing according to the triplet with the minimum distance popped out from the traversal queue each time specifically includes the following steps:
[0016] Extract neighbor data points from the triplet, determine whether the neighbor data point has been visited, and if not, continue to construct the neighbor data points of the neighbor data point into a new triplet and add it to the traversal queue, while updating the distance from the neighbor data point to the query point and the previous data point of the traversal path.
[0017] Preferably, the step of connecting the query point to the Sketch diagram specifically comprises the following steps:
[0018] Calculate the shortest distance from the query point to all data points, add an edge between the query point and the data point with the shortest distance, and set the edge weight to the corresponding shortest distance.
[0019] Preferably, the step of searching for all reverse k-nearest neighbor data points of the query point in the Sketch graph further comprises the following steps:
[0020] During the search process, the Sketch diagram is searched by Dijkstra method;
[0021] If the k nearest neighbors of the current data point do not include the query point, stop searching from the current data point;
[0022] If the k-nearest neighbors of the current data point include the query point, the current data point is added to the reverse k-nearest neighbor data points, and the search continues along the current data point.
[0023] One or more embodiments of this specification provide a reverse k-nearest neighbor query device based on Sketch graph, including a data point set construction module, a Sketch graph construction module, a connection module, and a search module;
[0024] The data point set construction module is used to construct a road network model based on a large-scale road network, and obtain nodes in the road network model to construct a data point set;
[0025] The Sketch diagram construction module is used to construct a Sketch diagram based on the data point set using multi-source Dijstra;
[0026] The connection module is used to connect the query point to the Sketch diagram;
[0027] The search module is used to search for all reverse k-nearest neighbor data points of the query point in the Sketch graph.
[0028] Preferably, the Sketch graph construction module includes a construction unit, a triple unit and a traversal unit;
[0029] The construction unit is used to construct a Sketch diagram based on each data point in the data point set;
[0030] The triplet unit is used to construct all neighbor data point information in the Sketch into triples starting from any data point, and add the triplet to the traversal queue. The triplet includes the neighbor data point, the distance from the neighbor data point to the query point, and the previous data point of the traversal path;
[0031] The traversal unit is used to access the triplet with the smallest distance from the neighbor data point to the query point that is popped out from the traversal queue each time until the traversal queue is empty.
[0032] Preferably, the traversal unit is specifically configured as follows:
[0033] Extract neighbor data points from the triplet, determine whether the neighbor data point has been visited, and if not, continue to construct the neighbor data points of the neighbor data point into a new triplet and add it to the traversal queue, while updating the distance from the neighbor data point to the query point and the previous data point of the traversal path.
[0034] One or more embodiments of the present specification provide a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the above-mentioned reverse k-nearest neighbor query method based on the Sketch graph when executing the computer program.
[0035] One or more embodiments of the present specification provide a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps of the above-mentioned reverse k-nearest neighbor query method based on the Sketch graph.
[0036] The present disclosure provides a reverse k-nearest neighbor query method, device, equipment and medium based on Sketch graph, which has the advantages of constructing a road network model based on a large-scale road network, obtaining nodes in the road network model to construct a data point set, being able to orderly sort out and integrate complex road network related data, and structured processing of massive and complex data, thereby improving overall processing efficiency; constructing a Sketch graph based on the data point set using multi-source Dijstra, and utilizing the advantages of the algorithm in processing graph structure data to find the shortest path, etc., being able to quickly generate a concise Sketch graph that can reflect key information, greatly reducing the search space and time complexity, being able to quickly locate the target data point, and realizing efficient query; connecting a query point to the Sketch graph; searching for all reverse k-nearest neighbor data points of the query point in the Sketch graph, being able to more accurately find all data points that meet the reverse k-nearest neighbor conditions, reducing a large amount of invalid calculations caused by complex data, improving query efficiency, and greatly reducing calculation overhead; the method of constructing a model starting from a large-scale road network has strong scalability, and can be flexibly adapted as the scale of the road network continues to expand and the amount of data continues to increase, and continue to play its query role. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] In order to more clearly illustrate one or more embodiments of this specification or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in this specification. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0038] Figure 1A schematic diagram of a flow chart of a reverse k-nearest neighbor query method based on a Sketch graph provided for one or more embodiments of this specification;
[0039] Figure 2 A schematic diagram of the structure of a road network model provided for one or more embodiments of this specification;
[0040] Figure 3 A schematic diagram of a Sketch diagram provided for one or more embodiments of this specification;
[0041] Figure 4 A schematic diagram of the structure of a reverse k-nearest neighbor query device based on a Sketch graph provided for one or more embodiments of this specification;
[0042] Figure 5 A schematic diagram of the structure of a computer device provided for one or more embodiments of this specification. DETAILED DESCRIPTION
[0043] In order to enable those skilled in the art to better understand the technical solutions in one or more embodiments of this specification, the technical solutions in one or more embodiments of this specification will be clearly and completely described below in conjunction with the drawings in one or more embodiments of this specification. Obviously, the described embodiments are only part of the embodiments of this specification, not all of the embodiments. Based on one or more embodiments of this specification, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the protection scope of the present invention.
[0044] The present invention is described in detail below in conjunction with specific implementation methods and the accompanying drawings.
[0045] Method Embodiment
[0046] According to an embodiment of the present invention, a reverse k-nearest neighbor query method based on Sketch graph is provided, such as Figure 1 As shown, it is a schematic diagram of the process of the reverse k-nearest neighbor query method based on the Sketch graph provided in this embodiment. The reverse k-nearest neighbor query method based on the Sketch graph according to an embodiment of the present invention includes the following steps:
[0047] S110: construct a road network model based on a large-scale road network, and obtain a node construction data point set in the road network model. Figure 2As shown in FIG. 1 , a schematic diagram of the structure of the road network model provided in this embodiment maps a large-scale road network into a weighted undirected graph structure with bounded degree, wherein the nodes on the graph structure of the road network model are intersections or landmarks with practical significance, the edges on the graph structure are roads, and the weights on the edges are the travel costs of the roads, such as the actual road distance or travel time, etc. The weights of the edges i and j are represented by w ij .
[0048] S120, constructing a Sketch graph based on the data point set using multi-source Dijstra, wherein the Sketch graph has the following properties: it is composed only of data points; the edge weights between nodes represent the shortest distance between the pair of data points in the original graph; the shortest distance of any non-adjacent data point pair can be obtained through the Sketch graph, such as Figure 3 As shown, it is a schematic diagram of the Sketch diagram provided in this embodiment. Figure 3 In, v 15 With v 2 The weight of the edge is 6, indicating that the shortest path distance between these two points in the original graph is 6, and v 15 With v 6 The shortest path distance can be obtained from Figure 3 The result is 6+4=10.
[0049] S130: Connect the query point to the Sketch diagram.
[0050] S140, searching the Sketch graph for all reverse k-nearest neighbor data points of the query point.
[0051] The method provided in this embodiment constructs a road network model based on a large-scale road network, obtains nodes in the road network model to construct a data point set, and can orderly sort and integrate complex road network related data, perform structured processing on massive and complex data, and improve overall processing efficiency; based on the data point set, a multi-source Dijstra is used to construct a Sketch graph, and the advantages of the algorithm in processing graph structure data to find the shortest path can be used to quickly generate a concise Sketch graph that can reflect key information, greatly reducing the search space and time complexity, and can quickly locate the target data point to achieve efficient query; connect the query point to the Sketch graph; search for all reverse k-nearest neighbor data points of the query point in the Sketch graph, and more accurately find all data points that meet the reverse k-nearest neighbor conditions, reduce a large number of invalid calculations caused by complex data, improve query efficiency, and greatly reduce computing overhead. The method of constructing a model starting from a large-scale road network has strong scalability, can be flexibly adapted as the scale of the road network continues to expand and the amount of data continues to increase, and continue to play its query role.
[0052] In one embodiment, constructing a Sketch diagram based on the data point set using multi-source Dijstra specifically includes the following steps:
[0053] A Sketch diagram is constructed based on each data point in the data point set, and a Sketch diagram is constructed based on each data point v i , construct Sketch data point p i , where data point p i The meaning of the reverse k-nearest neighbor query for a given point in a specific set P depends on the specific real-world problem. In some specific problems, two different types of data sets are given, and the present invention is applicable to both cases. For example Figure 2 Given two sets of data points O and U, where the query point can only come from set O.
[0054] Take any data point v 1 As the starting point, all the neighbor data point information in the Sketch diagram is constructed into a triple, and the triple is added to the traversal queue. The triple includes the neighbor data point, the distance from the neighbor data point to the query point, and the previous data point of the traversal path, which is expressed as:
[0055] (v i ,d i ,prev i );
[0056] Among them, v i is the label of the neighbor data point; d i is the distance from the neighbor data point to the query point, initialized to the edge weight; prev records the previous data point of the traversal path, initialized to v 1 .
[0057] For example Figure 2 V 15 As the starting point, the triples constructed by its neighbors are (v 18 ,1,v 15 ) and (v 20 ,2,v 15 ). The following steps are explained in the figure by default. 15 As the starting point.
[0058] According to the distance d from the query point to the neighbor data point with the smallest value popped out from the traversal queue each time i The traversal queue is empty, which includes the following steps:
[0059] Extract neighbor data points from the triplet, determine whether the neighbor data point has been visited, and if not, continue to construct the neighbor data points of the neighbor data point into a new triplet and add it to the traversal queue, while updating the distance from the neighbor data point to the query point and the previous data point of the traversal path.
[0060] Specifically, extract v from the triple i If v i If it has not been accessed, then continue to i Neighboring data points (v j ) is constructed into a triple and added to the traversal queue, marked as v i For example, Figure 2 In (v 18 ,1,v 15 ) is ejected first, v 18 is marked as visited and its neighbor v 14 and v 16 Will be used to construct new triples. For neighbor data points v j Construct new triples and update the corresponding d j and prev j .
[0061] Specifically, j The update formula is:
[0062] d j =d i +w ij ;
[0063] If v i is a data point, then prev j Update the value to v i , otherwise prev j Inherited by v i The prev value of the tuple. For example Figure 2 , v 16 The triplet of (v 16 ,1+1=2,v 15 ).
[0064] In v i is the condition of data point, extract prev i The data point represented by (set to v k ), at the Sketch data point p i and p k Add an edge between them, and set the weight to d i -d k .For example Figure 2 , assuming that the triplet popped out of the current queue represents (v 19 ,4,v 15 ), then v19 and v 15 An edge with a weight of 4 will be added to the corresponding data point in the Sketch diagram.
[0065] Repeat the above steps until all other data points have been visited or the traversal queue is empty. After performing the above steps for all data points, the Sketch diagram is constructed.
[0066] The method provided in this embodiment, by constructing a Sketch graph of each data point, using triples to construct a traversal queue and accessing in order by distance, can orderly and efficiently traverse the information of neighboring data points in the graph, accurately and comprehensively obtain related data associations, effectively reduce unnecessary search operations, and improve the efficiency and accuracy of overall data query and association analysis.
[0067] In one embodiment, connecting the query point to the Sketch diagram specifically includes the following steps:
[0068] Calculate the shortest distance from the query point to all data points, add an edge between the query point and the data point with the shortest distance, and set the edge weight to the corresponding shortest distance.
[0069] Specifically, the connection method is divided into two processing solutions according to the actual meaning of the problem. If the reverse k-nearest neighbor query problem only gives a data point set P, according to the problem definition, the query point can only come from P, so when building the Sketch diagram, all possible query points are already in the Sketch diagram. If the reverse k-nearest neighbor query problem is given two types of data point sets O and U, according to common problem scenarios, set O is called the candidate point set, which is all candidate points that may become query points; set U is called the user set, and the points in it are called user points. The result set of the reverse k-nearest neighbor query problem is a subset of U. In this case, connecting the query point to the Sketch diagram specifically includes:
[0070] For all points in set O, calculate the shortest distance from them to all user points.
[0071] Specifically, the shortest distance calculation in this step can apply the existing advanced road network shortest distance method.
[0072] For each point v∈O, add an edge between it and all user points, and the edge weight is set to the shortest distance between them.
[0073] If a user point can be reached through the shortest path of other user points, there is no need to add edges.
[0074] Specifically, v to user point u i The shortest path distance is Dist(v,u i ). If there is another user point u j, so that Dist(v,u i )=Dist(v,u j )+Dist(u j ,u i ), then there is no need to i Add a new edge between and v. For example Figure 3 v 7 , which is related to v 2 There are no other user points on the shortest path, so add an edge with a weight of 4. 6 The shortest path through v 2 , so there is no need to add edges between them.
[0075] See also Figure 3 , black data points and black edges represent the Sketch graph composed of the data points in set U, and gray data points and gray edges represent the connection relationship between the data points in set O and the Sketch graph.
[0076] The method provided in this embodiment can effectively integrate the relationship between the query point and the data point in the graph by connecting the query point to the Sketch graph and reasonably calculating, adding edges and setting edge weights, so as to facilitate the subsequent accurate and efficient implementation of related query and analysis operations based on this, and optimize the information processing flow based on the graph structure.
[0077] In one embodiment, searching the Sketch graph for all reverse k-nearest neighbor data points of the query point further includes the following steps:
[0078] During the search process, the Sketch diagram is searched using the Dijkstra method.
[0079] The query termination rule is: if the k nearest neighbors of the current data point do not include the query point, stop searching from the current data point. The search process is terminated until all search directions are terminated. This termination rule is the basis for the Sketch method to run, because it provides the method's search strategy and termination conditions. For example Figure 3 In the 7 is the query point, and k = 2. 2 When, because v 2 The first two nearest neighbors (v 1 ,v 8 ) does not include v 7 , we don't need to worry about the subsequent v 6 Search. Because v 6 to v 1 ,v 8 The distance must be greater than v 7 short, so there is no need to start from v 2 to search.
[0080] If the k-nearest neighbor of the current data point includes the query point, then the current data point is added to the node of the reverse k-nearest neighbor and the search continues along the current data point. Otherwise, the termination rule is executed. The specific method of k-nearest neighbor judgment can use the existing k-nearest neighbor search method. For example Figure 3 The query parameters are the same as in the example (1). We first access v 15 , perform k-nearest neighbor verification on it, and after determining that it can continue searching from it, put its neighbors into the search queue, and then proceed in the Dijkstra way. When the search process terminates, return the reverse k-nearest neighbor result set.
[0081] The method provided in this embodiment uses the Dijkstra method to search in the Sketch diagram, and accurately screens according to the correlation between the current data point and the query point. It can efficiently and accurately find the reverse k-nearest neighbor data points of the query point, reduce unnecessary searches, and improve the efficiency and accuracy of the reverse k-nearest neighbor query.
[0082] Device Embodiment
[0083] According to an embodiment of the present invention, a reverse k-nearest neighbor query device based on Sketch graph is provided, such as Figure 4 As shown, it is a structural schematic diagram of the reverse k-nearest neighbor query device based on the Sketch graph provided in this embodiment. According to the reverse k-nearest neighbor query device based on the Sketch graph according to the embodiment of the present invention, it includes a data point set construction module 41, a Sketch graph construction module 42, a connection module 43 and a search module 44.
[0084] The data point set construction module 41 is used to construct a road network model based on a large-scale road network, and obtain nodes in the road network model to construct a data point set.
[0085] The Sketch diagram construction module 42 is used to construct a Sketch diagram based on the data point set using multi-source Dijstra.
[0086] The connection module 43 is used to connect the query point to the Sketch diagram.
[0087] The search module 44 is used to search all reverse k-nearest neighbor data points of the query point in the Sketch graph.
[0088] In the device provided in this embodiment, the data point acquisition module 41 constructs a road network model based on a large-scale road network, obtains the nodes in the road network model to construct a data point set, and can orderly sort and integrate complex road network related data, perform structured processing on massive and complex data, and improve the overall processing efficiency; the Sketch graph construction module 42 uses multi-source Dijstra to construct a Sketch graph based on the data point set, and uses the advantages of the algorithm in processing graph structure data to find the shortest path, etc., to quickly generate a concise Sketch graph that can reflect key information, greatly reducing the search space and time complexity, and can quickly locate the target data point to achieve efficient query; the connection module 43 connects the query point to the Sketch graph; the search module 44 searches for all reverse k-nearest neighbor data points of the query point in the Sketch graph, and can more accurately find all data points that meet the reverse k-nearest neighbor conditions, reducing a large number of invalid calculations caused by complex data, improving query efficiency, and greatly reducing calculation overhead. The method of building a model starting from a large-scale road network has strong scalability and can be flexibly adapted as the scale of the road network continues to expand and the amount of data continues to increase, and continues to play its query role.
[0089] In one embodiment, the Sketch graph construction module 42 includes a construction unit 4201 , a triple unit 4202 and a traversal unit 4203 .
[0090] The construction unit 4201 is used to construct a Sketch diagram based on each data point in the data point set.
[0091] The triplet unit 4202 is used to construct all neighbor data point information in the Sketch diagram into triples with any data point as the starting point, and add the triplet to the traversal queue. The triplet includes the neighbor data point, the distance from the neighbor data point to the query point and the previous data point of the traversal path.
[0092] The traversal unit 4203 is used to access the triplet with the smallest distance from the neighbor data point to the query point that is popped out from the traversal queue each time until the traversal queue is empty. Specifically, the neighbor data point is extracted from the triplet to determine whether the neighbor data point has been visited. If not, the neighbor data points of the neighbor data point are continuously constructed into a new triplet to be added to the traversal queue, and the distance from the neighbor data point to the query point and the previous data point of the traversal path are updated at the same time.
[0093] The device provided in this embodiment constructs a Sketch diagram of each data point, uses triples to construct a traversal queue and accesses it in order and efficiently, can traverse the neighbor data point information in the diagram in an orderly and efficient manner, accurately and comprehensively obtain relevant data associations, effectively reduce unnecessary search operations, and improve the efficiency and accuracy of overall data query and association analysis.
[0094] The embodiment of the present invention is an apparatus embodiment corresponding to the above-mentioned method embodiment. The specific operations of the processing steps of each module can be understood by referring to the description of the method embodiment, which will not be repeated here.
[0095] like Figure 5 As shown, the present invention also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the reverse k-nearest neighbor query method based on the Sketch graph in the above-mentioned embodiment, or, when executed by a processor, implements the reverse k-nearest neighbor query method based on the Sketch graph in the above-mentioned embodiment.
[0096] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
[0097] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device or system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment. The device and system embodiments described above are merely schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.
[0098] 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 it. Although the present invention has been described in detail with reference to the above embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the above embodiments, or replace some or all of the technical features therein by equivalents. These modifications or replacements do not make the essence of the corresponding technical solutions deviate from the scope of the technical solutions of the embodiments of the present invention, and the contents not described in detail in the specification of the present invention belong to the common knowledge of those skilled in the art.
Claims
1. A reverse k-nearest neighbor query method based on Sketch graph, characterized in that: The following steps are involved: Building a road network model based on a large-scale road network, and acquiring nodes in the road network model to build a data point set; Constructing a Sketch diagram using multi-source Dijstra based on the data point set; Connecting the query point to the Sketch diagram; Search the Sketch graph for all reverse k-nearest neighbor data points of the query point.
2. The reverse k-nearest neighbor query method based on Sketch graph as claimed in claim 1, characterized in that: The step of constructing a Sketch diagram based on the data point set using multi-source Dijstra specifically includes the following steps: Building a Sketch diagram based on each data point in the data point set; Taking any data point as the starting point, construct all neighbor data point information in the Sketch into triples, and add the triples to the traversal queue. The triples include the neighbor data point, the distance from the neighbor data point to the query point, and the previous data point on the traversal path. The access is performed according to the triplet with the smallest distance from the neighbor data point to the query point that is popped out from the traversal queue each time until the traversal queue is empty.
3. The reverse k-nearest neighbor query method based on Sketch graph as claimed in claim 2, characterized in that: The access is performed according to the triplet with the minimum distance popped out from the traversal queue each time, specifically including the following steps: Extract neighbor data points from the triplet, determine whether the neighbor data point has been visited, and if not, continue to construct the neighbor data points of the neighbor data point into a new triplet and add it to the traversal queue, while updating the distance from the neighbor data point to the query point and the previous data point of the traversal path.
4. The reverse k-nearest neighbor query method based on Sketch graph as claimed in claim 1, characterized in that: The step of connecting the query point to the Sketch diagram specifically includes the following steps: Calculate the shortest distance from the query point to all data points, add an edge between the query point and the data point with the shortest distance, and set the edge weight to the corresponding shortest distance.
5. The reverse k-nearest neighbor query method based on Sketch graph as claimed in claim 1, characterized in that: The step of searching for all reverse k-nearest neighbor data points of the query point in the Sketch graph further includes the following steps: During the search process, the Sketch diagram is searched by Dijkstra method; If the k nearest neighbors of the current data point do not include the query point, stop searching from the current data point; If the k-nearest neighbors of the current data point include the query point, the current data point is added to the reverse k-nearest neighbor data points, and the search continues along the current data point.
6. A reverse k-nearest neighbor query device based on Sketch graph, characterized in that: It includes data point set building module, Sketch graph building module, connection module and search module; The data point set construction module is used to construct a road network model based on a large-scale road network, and obtain nodes in the road network model to construct a data point set; The Sketch diagram construction module is used to construct a Sketch diagram based on the data point set using multi-source Dijstra; The connection module is used to connect the query point to the Sketch diagram; The search module is used to search for all reverse k-nearest neighbor data points of the query point in the Sketch graph.
7. The reverse k-nearest neighbor query device based on Sketch graph as claimed in claim 6, characterized in that: The Sketch graph construction module includes a construction unit, a triple unit and a traversal unit; The construction unit is used to construct a Sketch diagram based on each data point in the data point set; The triplet unit is used to construct all neighbor data point information in the Sketch into triples starting from any data point, and add the triplet to the traversal queue. The triplet includes the neighbor data point, the distance from the neighbor data point to the query point, and the previous data point of the traversal path; The traversal unit is used to access the triplet with the smallest distance from the neighbor data point to the query point that is popped out from the traversal queue each time until the traversal queue is empty.
8. The reverse k-nearest neighbor query device based on Sketch graph as claimed in claim 7, characterized in that: The traversal unit is specifically configured as follows: Extract neighbor data points from the triplet, determine whether the neighbor data point has been visited, and if not, continue to construct the neighbor data points of the neighbor data point into a new triplet and add it to the traversal queue, while updating the distance from the neighbor data point to the query point and the previous data point of the traversal path.
9. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the reverse k-nearest neighbor query method based on the Sketch graph is implemented as described in any one of claims 1 to 5.
10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the reverse k-nearest neighbor query method based on the Sketch graph are implemented as described in any one of claims 1 to 5.