Skip to main content

Nearest Neighbor Query

  • Reference work entry
Encyclopedia of Database Systems
  • 518 Accesses

Synonyms

NN query; kNN query

Definition

Given a dataset P and a query point q, a k nearest neighbor (kNN) query returns the k closest data points p 1 ,p 2 ,...,p k to q. For any point p∈P−{p 1 ,p 2 ,...,p k }: dist(p i , q)≤dist(p, q) ∀ 1≤i≤k, where dist depends on the underlying distance metric. The usual metric is the L x norm, or formally, given two points q, p whose coordinates on the i-th dimension (1≤i≤m) are q i and p i respectively, their L x distance is:

$${{L_x (p,\,q) = (\Sigma _{i = 1 \sim m} \,\left| {p_i - q_i } \right|^x )^{1/x} ,\,{{\rm for}\, x}} \ne \infty, }$$
$$L_x (p,\,q) = \max \ _{i = 1 \sim m} (\left| {p_i - q_i } \right|){{, {\rm for} \,x = }}\infty. $$

Most work on spatial and spatio-temporal databases focuses on Euclidean distance (i.e., L 2 ), but alternative definitions have been used in various domains (e.g., road networks, time series).

Key Points

Nearest neighbor search constitutes an important component for several tasks such as clustering, outlier...

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 2,500.00
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Recommended Reading

  1. Korn F. and Muthukrishnan S. Influence sets based on reverse nearest neighbor queries. In Proc. ACM SIGMOD Int. Conf. on Management of Data, 2000, pp. 201–212.

    Google Scholar 

  2. Papadias D., Tao Y., Mouratidis K., and Hui K. Aggregate nearest neighbor queries in spatial databases. ACM Trans. Database Sys., 30(2):529–576, 2005.

    Article  Google Scholar 

  3. Seidl T. and Kriegel H-P. Optimal multi-step k-nearest neighbor search. In Proc. ACM SIGMOD Int. Conf. on Management of Data, 1998, pp 154–165.

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2009 Springer Science+Business Media, LLC

About this entry

Cite this entry

Papadias, D. (2009). Nearest Neighbor Query. In: LIU, L., ÖZSU, M.T. (eds) Encyclopedia of Database Systems. Springer, Boston, MA. https://doi.org/10.1007/978-0-387-39940-9_245

Download citation

Publish with us

Policies and ethics