CN101840434A - Breadth first method for searching nearest k point pairs in spatial network database - Google Patents
Breadth first method for searching nearest k point pairs in spatial network database Download PDFInfo
- Publication number
- CN101840434A CN101840434A CN201010175152A CN201010175152A CN101840434A CN 101840434 A CN101840434 A CN 101840434A CN 201010175152 A CN201010175152 A CN 201010175152A CN 201010175152 A CN201010175152 A CN 201010175152A CN 101840434 A CN101840434 A CN 101840434A
- Authority
- CN
- China
- Prior art keywords
- point
- nearest
- closest approach
- neighbors
- searching
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Images
Landscapes
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The invention belongs to the technical field of spacial databases, in particular to a breadth first method for searching nearest k point pairs in the spacial network database. The method comprises the following steps of: inputting two vertex sets S and T and a positive integer k, taking each vertex Si in the set S as a central point, taking the set T as a query target vertex set, calculating a first nearest neighbor of each Si, comparing the distances between the nearest neighbors and the central points thereof, and selecting the nearest neighbor with the minimal distance and the central point thereof as the first nearest point pair; searching a second nearest neighbor of the central point of the first nearest point pair, and selecting the neighbor with the distance second to the minimal distance and the central point thereof as the second nearest point pair; and repeating the process until finding the kth nearest point pair. Through the breadth first search sequence, the k point pairs with the minimal distance can be found, and the searching times for the nearest neighbors in the searching process is greatly reduced, so the access times for vertexes and sides of the spacial network in the searching process is reduced and the searching speed is improved.
Description
Technical field
The invention belongs to the spatial database technology field, be specifically related to a kind of nearest k breadth first method that point is right of in the spatial network database, searching.
Background technology
In recent years, along with the particularly development of location technology of wireless communication technique, Geographic Information System, and the raising of computer information processing ability, spatial database has obtained good application in reality, become one of current research focus, its development prospect is extensively had an optimistic view of.
In spatial database, the storage of data is based on the spatial geographical locations information of storage object and organizes, and the inquiry of being carried out also is the space querying information-related with the spatial geographical locations of query object.As one of modal space querying in the spatial database, k point to inquiry is recently, and to importing two data S set and T, it is right that each element of each element of S and T constitutes point, calculates the right distance of these points, chooses minimum k and returns.
Put in the right querying method at existing nearest k, most methods all proposes at the spatial database under the euclidean geometry space environment.Under the euclidean geometry space environment, distance between points is an air line distance, and under the spatial network environment, distance between points be by 2 shortest paths in network apart from decision, therefore can't be applied directly under the spatial network environment at the querying method under the euclidean geometry space environment.Under the spatial network environment, existing nearest k point searched with depth first method lookup method, because this method can be found out the point of a lot of redundancies in search procedure right, therefore the visit capacity to the summit of spatial network and limit is very big, causes seek rate very slow.Therefore need badly and will improve, to improve seek rate to the method.
Summary of the invention
The objective of the invention is to propose a kind of method of breadth First, to improve seek rate at nearest k the problem that point is right in the spatial network database.
The lookup method that the present invention proposes, by the looked-up sequence with breadth First, the point that had both guaranteed finally to search is to being nearest k, reduced in the search procedure access times to the summit and the limit of spatial network again, accelerated seek rate.
At first basic concepts is defined:
Define 1. networks (G): the topological structure of syntople between the expression summit (vertex), by set (E) formation on the limit between vertex set (V) and the summit.
Define 2. distance between two points (distance): the length of shortest path between 2.
Define 3. nearest-neighbors (NN): to the input query point (or central point) q and the query aim S set=S1, S2 ..., Sn}, in S, find out and q between the minimum summit Si of distance, Si is the nearest-neighbors (q.NN) of q.
Define 4. to and point adjust the distance: to vertex set S and T, the summit Si among the S and the summit Tj among the T constitute point to (Si, Tj), the distance between Si and the Tj is for to (Si, distance Tj).
Define 6. set sizes | S|: the number of S set institute containing element.
According to above definition, for the vertex set S and the T of input, S={S1, S2 ..., Sm}, T={T1, T2 ..., Tn}, nearest k of proposing of the present invention put lookup method are based on following character:
(1) be the query aim set with T, supposed to find first nearest-neighbors Si.1NN of each the summit Si among the S, this m is made of a little to (Si central point Si and Si.1NN, Si.1NN), i=1,2 ... m, this m some centering, establish the minimum point of distance to for (Sj, Sj.1NN), then (Sj must be that first closest approach of S and T is right Sj.1NN).
(2) suppose currently to have found out i closest approach to (Sx, Sx.tNN), wherein, i=2,3 ..., k-1, Sx.tNN represents t the nearest-neighbors of Sx, then search t+1 the nearest-neighbors of Sx, it is right to constitute new point, find out so the little point of some centering distance i+1 is arranged to must being that i+1 the closest approach of S and T is right.
Based on above character, the inventive method is right with nearest k point of two set of sequential search of breadth First, and concrete steps are:
(1) for the vertex set S and the T of input, establish m=|S |, n=|T|, S={S1, S2 ..., Sm}, T={T1, T2 ..., Tn} is without loss of generality, and supposes m<n.
(2) be the query aim set with T, search the 1st the nearest-neighbors Si.1NN of each the summit Si among the S, this m is made of a little to (Si central point Si and Si.1NN, Si.1NN), i=1,2,, m, it is right to get the minimum point of distance this m some centering, be made as (p1, q1), p1 ∈ S, q1 ∈ T, then (p1 is that first closest approach of S and T is right q1).
(3) the 1st the central point p1 that closest approach is right to obtaining in (2), search the 2nd the nearest-neighbors p1.2NN of p1, p1 and p1.2NN constitute m+1 point to (Sj, Sj.2NN), it is little that obtain in (2), (3) m+1 some centering got distance the 2nd, be made as (p2, q2), then (p2 is that second closest approach of S and T is right q2).
(4) (the individual closest approach of 0<t<k), to repeating step (3), it is right to calculate next closest approach, till t=k to the t of the S that obtained and T.
Lookup method according to above step is carried out, carried out altogether | S|+k time nearest-neighbors is searched, and nearest k point finding out S and T is right.Such lookup method can be very fast find out nearest k the point right, guaranteed that again the result who finally draws is correct.Accompanying drawing 2 is a inventive method and background technology experimental result relatively, can verify very clearly that by accompanying drawing the inventive method compares the raising on seek rate with background technology.
Description of drawings
Figure 1 shows that one by 17 summits and 20 spatial networks that the limit is formed, its orbicular spot n1, n2 ..., n17 represents 17 summits, the straight line that connects round dot represents to connect the limit on two summits, the weights on this limit of integer representation on the straight line.Red round dot is that S set={ n6, n9, n14}, blue round dot are set T={n1, n3, n5, n10, n12, n13, n15}.
Figure 2 shows that the inventive method and background technology experimental result relatively, wherein, S set comprises 13 summits, and set T comprises 47 summits, and k gets 5,6,7,8,9,10.
Embodiment
With an example the specific embodiment of the present invention is described below.
In a spatial network by accompanying drawing 1 expression, the user imports S set and T and positive integer k, and it is right to inquire about nearest k point, S={n6, and n9, n14}, T={n1, n3, n5, n10, n12, n13, n15}, k=4, search according to following steps so:
(1) choosing S is the central point set, and T is the query aim set, and the 1st nearest-neighbors of searching n6, n9, n14 is respectively n5, n10, n15, it is right to obtain 3 points: (n6, n5,5), (n9, n10,2), (n14, n15,3), the 3rd number is represented the distance that this point is right in the bracket;
(2) it is right to the point of middle distance minimum to find out in (1) 3 points, is (n9, n10,2), and then (n9 is that the 1st closest approach of S and T is right n10);
(3) to the 1st closest approach obtaining in (2) to (the 2nd nearest-neighbors of searching n9 is n3 for n9, central point n9 n10), obtains the 4th point to (n9, n3,9);
(4) it is right to the little point of (n6, n5,5), (n9, n10,2), (n14, n15,3), (n9, n3,9) middle distance the 2nd to find out 4 points (2) and (3) obtaining, is (n14, n15,3), and then (n14 is that the 2nd closest approach of S and T is right n15);
(5) the 2nd closest approach that (4) are obtained is to (the 2nd nearest-neighbors of searching n14 is n12 for n14, central point n14 n15), obtains the 5th point to (n14, n12,4);
(6) find out 5 points (2), (3), (5) obtaining to (n6, n5,5), (n9, n10,2), (n14, n15,3), the point that (n9, n3,9), (n14, n12,4) middle distance the 3rd are little is right, be (n14, n12,4) that then (n14 is that the 3rd closest approach of S and T is right n12);
(7) the 3rd closest approach that (6) are obtained is to (the 3rd nearest-neighbors of searching n14 is n13 for n14, central point n14 n12), obtains the 6th point to (n14, n13,9);
(8) find out 6 points (2), (3), (5), (7) obtaining to (n6, n5,5), (n9, n10,2), (n14, n15,3), (n9, n3,9), (n14, n12,4), (n14, n13,9) point that middle distance the 4th is little is right, is (n6, n5,5), then (n6 is that the 4th closest approach of S and T is right n5);
(9) 4 closest approaches that (2), (4), (6), (8) are found to (n9, n10), (n14, n15), (n14, n12), (n6 n5) returns to the user.
From above example as can be seen, to S set, T and the positive integer k of user's input, the inventive method is searched by 7 nearest-neighbors according to the looked-up sequence of breadth First, has found nearest 4 points of S and T right.These 4 points have a centering 4 apart from minimum to being, and the nearest-neighbors of being carried out in the search procedure to search number of times be 7, with theoretical value | S|+k equates.
Claims (4)
1. search nearest k the breadth first method that point is right in a spatial network database, it is characterized in that concrete steps are as follows:
1) carry out pre-service for two vertex set S of inquiring user input and T and positive integer k:
Calculate S and each self-contained number of vertices of T, represent that with m and n choose the less set of number of vertices and gather as central point, another one is the query aim vertex set;
2) it is right to search the 1st closest approach:
According to the selected central point set query aim fixed point set of step (1), suppose central point set central point Si (i=1,2,, m), calculate the 1st nearest-neighbors of each Si, in the some pair set that heart point and nearest-neighbors constitute, it is right to select the 1st closest approach in these;
3) it is right to search the 2nd closest approach:
Right according to first closest approach that step (2) is found out, calculate the next nearest-neighbors of its central point, it is right to constitute new point, adds the some pair set that step (2) is obtained to, and it is right therefrom to select the 2nd closest approach;
4) search the 3rd, 4 ..., a k closest approach is right:
Right according to i the closest approach of selecting before, i=2,3 ..., k-1, repeating step (3), it is right to calculate next closest approach, up to obtain k closest approach to till.
2. method according to claim 1, it is as follows to it is characterized in that searching described in the step (2) the 1st step that closest approach is right:
A) each the central point Si among the pair set S (i=1,2 ..., m), search the 1st the nearest-neighbors Si.1NN of Si, each Si and Si.1NN constitute point to (Si, Si.1NN);
B) with m the point to (Si, Si.1NN) (i=1,2 ..., m) sort by the right distance of point, leave in the set A;
C) point of choosing set A middle distance minimum to (Sj, Sj.1NN) right as the 1st closest approach;
D) will put (Sj Sj.1NN) deletes from set A.
3. method according to claim 1, it is as follows to it is characterized in that searching described in the step (3) the 2nd step that closest approach is right:
A) the 1st closest approach that step (2) is obtained is to (Sj Sj.1NN), searches the 2nd the nearest-neighbors Sj.2NN of Sj, and Sj and Sj.2NN constitute new point to (Sj Sj.2NN), will newly put adding in the set A;
B) choose the point of set A middle distance minimum to right as the 2nd closest approach;
C) with the 2nd closest approach to from set A, deleting.
4. method according to claim 1, it is characterized in that searching described in the step (4) the 3rd, 4 ..., the right step of a k closest approach is as follows:
A) hypothesis current found out i closest approach to (Sx, Sx.tNN), wherein, i=2,3 ..., k-1, Sx.tNN represents t the nearest-neighbors of Sx, then searches t+1 the nearest-neighbors of Sx, it is right to constitute new point, adds in the set A;
B) choose the point of set A middle distance minimum to right as i+1 closest approach.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201010175152A CN101840434A (en) | 2010-05-13 | 2010-05-13 | Breadth first method for searching nearest k point pairs in spatial network database |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201010175152A CN101840434A (en) | 2010-05-13 | 2010-05-13 | Breadth first method for searching nearest k point pairs in spatial network database |
Publications (1)
Publication Number | Publication Date |
---|---|
CN101840434A true CN101840434A (en) | 2010-09-22 |
Family
ID=42743807
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201010175152A Pending CN101840434A (en) | 2010-05-13 | 2010-05-13 | Breadth first method for searching nearest k point pairs in spatial network database |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN101840434A (en) |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102183708A (en) * | 2011-02-22 | 2011-09-14 | 山东科汇电力自动化有限公司 | Wide-area traveling wave distance measurement method |
CN106681920A (en) * | 2016-12-27 | 2017-05-17 | 河南理工大学 | Concurrent system model detection method based on geodesic distance |
CN113811928A (en) * | 2019-04-12 | 2021-12-17 | 格步计程车控股私人有限公司 | Distributed memory space data storage for K nearest neighbor search |
-
2010
- 2010-05-13 CN CN201010175152A patent/CN101840434A/en active Pending
Cited By (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102183708A (en) * | 2011-02-22 | 2011-09-14 | 山东科汇电力自动化有限公司 | Wide-area traveling wave distance measurement method |
CN102183708B (en) * | 2011-02-22 | 2013-05-08 | 山东科汇电力自动化有限公司 | Wide-area traveling wave distance measurement method |
CN106681920A (en) * | 2016-12-27 | 2017-05-17 | 河南理工大学 | Concurrent system model detection method based on geodesic distance |
CN113811928A (en) * | 2019-04-12 | 2021-12-17 | 格步计程车控股私人有限公司 | Distributed memory space data storage for K nearest neighbor search |
CN113811928B (en) * | 2019-04-12 | 2024-02-27 | 格步计程车控股私人有限公司 | Distributed memory space data storage for K nearest neighbor search |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110069500B (en) | Dynamic mixed indexing method for non-relational database | |
CN109271467B (en) | Direction-aware road network moving object k neighbor query method | |
CN105357247B (en) | Multidimensional property cloud resource range lookup method based on layering cloud peer-to-peer network | |
Wu et al. | A Hybrid Mobile Node Localization Algorithm Based on Adaptive MCB‐PSO Approach in Wireless Sensor Networks | |
CN102156756A (en) | Method for finding optimal path in road network based on graph embedding | |
CN102749084A (en) | Path selecting method oriented to massive traffic information | |
CN103744886B (en) | Directly extracted k nearest neighbor searching algorithm | |
Ahmadi et al. | A mixed breadth-depth first search strategy for sequenced group trip planning queries | |
CN112328877A (en) | Skyline inquiry method for multiple users on time-dependent road network | |
CN113468293A (en) | Road network Top-k path query method based on multi-keyword coverage | |
CN101840434A (en) | Breadth first method for searching nearest k point pairs in spatial network database | |
CN112507047B (en) | Optimal ordered path query method based on interest point preference | |
Wu et al. | Evolutionary path planning of a data mule in wireless sensor network by using shortcuts | |
Lima et al. | Efficient and robust WiFi indoor positioning using hierarchical navigable small world graphs | |
Li et al. | An efficient mobile social network for enhancing contents sharing over mobile ad-hoc networks | |
CN116541721A (en) | Positioning and road network matching method and system for signaling data | |
CN108804582A (en) | Method based on the chart database optimization of complex relationship between big data | |
Wang et al. | Must: An effective and scalable framework for multimodal search of target modality | |
Huang et al. | Continuous within query in road networks | |
Li et al. | A novel distributed air index for efficient spatial query processing in road sensor networks on the air | |
Tang et al. | Supporting continuous skyline queries in dynamically weighted road networks | |
Zhu et al. | A data-driven sequential localization framework for big telco data | |
CN108415954A (en) | The uncertain monochromatic mutually K-NN search processing method of one kind | |
CN110031017B (en) | Multi-target optimal path planning method for vehicle and machine | |
CN105787076A (en) | Monochrome mutual nearest neighbor query processing method for uncertain spatial data |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
C12 | Rejection of a patent application after its publication | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20100922 |