Nearest neighbor graph
From Wikipedia, the free encyclopedia
The nearest neighbor graph (NNG) for a set of n objects P in a metric space (e.g., for a set of points in the plane with Euclidean distance) is a directed graph with P being its vertex set and there is a directed edge from p to q whenever q is a nearest neighbor of p (i.e., the distance from p to q is no larger than than from p to any other object from P). [1]
In many discussions the directions of the edges are ignored and the NNG is defined as an ordinary (undirected) graph. However it is necessary to keep in mind that the nearest neighbor relation is not a symmetric one, i.e., p from the definition is not necessary a nearest neighbor for q.
In some discussions, in order to make the nearest neighbor for each object unique, the set P is indexed and in the case of a tie the object with, e.g., the largest index is taken for the nearest neighbor.[2]
The k-nearest neighbor graph (k-NNG) is a graph in which two vertices p and q are connected by an edge if the distance between p and q is k-th smallest among the distances distances from p to other objects from P
The NNG' is a special case of the k-NNG, namely it is the 1-NNG.
Another special case is the (n − 1)-NNG This graph is called the furthest neighbor graph (FNG, sometimes spelled farthest neighbor graph).
In theoretical discussions of algorithms a kind of general position is often assumed, namely, the nearest (k-nearest) neighbor is unique for each object. In implementations of the algorithms it is necessary bear in mind that this is not always the case.
NNGs for points in the plane as well as in multidimensional spaces find applications, e.g., in statistical analysis, data compression, motion planning, and facilities location. they are also a subject of computational geometry.
Contents |
[edit] NNGs for sets of points
[edit] One dimensional case
For a set of points on a line, the nearest neighbor of a point is its left or right (or both) neighbor, if they are sorted along the line. Therefore the NNG is a path or a forest of several paths and may be constructed in O(n log n) time by sorting. This estimate is asymptotically optimal for certain models of computation, because the constructed NNG gives the answer to the element uniqueness problem: it is sufficient to check whether the NNG has a a zero-length edge.
[edit] Higher dimensions
Unless stated otherwise, it is assumed that the NNGs are digraphs with uniquely defined nearest neighbors as described in the introduction.
- Along any directed path in an NNG the edge lengths are non-increasing.[2]
- Only cycles of length 2 are possible in an NNG and each weakly connected component of an NNF with at least 2 vertices has exactly ojne 2-cycle.[2]
- For the points in the plane the NNG is a planar graph with vertex degrees at most 6. If points are in general position, the degree is at most 5.[2]
- The NNG (treated as an undirected graph with multiple nearest neighbors allowed) of a set of points in the plane or any higher dimension is a subgraph of the Delaunay triangulation and the Gabriel graph of the pointset. If the points are in general position or if the single nearest neighbor condition is imposed, the NNG is a forest, a subgraph of the Euclidean minimum spanning tree.
[edit] References
- ^ Franco P. Preparata and Michael Ian Shamos (1985). Computational Geometry - An Introduction. Springer-Verlag. 1st edition: ISBN 0-387-96131-3; 2nd printing, corrected and expanded, 1988: ISBN 3-540-96131-3; Russian translation, 1989: ISBN 5-03-001041-6.
- ^ a b c d Eppstein, D.; Paterson, M. S. & Yao, Frances (1997), “On nearest-neighbor graphs”, Discrete and Computational Geometry 17 (3): 263-282, DOI 10.1007/PL00009293