Serializablepublic class KDTree extends Object implements Serializable
| 构造器 | 说明 |
|---|---|
KDTree(int k) |
Creates a KD-tree with specified number of dimensions.
|
| 限定符和类型 | 方法 | 说明 |
|---|---|---|
void |
delete(double[] key) |
Delete a node from a KD-tree.
|
void |
insert(double[] key,
Object value) |
Insert a node in a KD-tree.
|
Object |
nearest(double[] key) |
Find KD-tree node whose key is nearest neighbor to key.
|
Object[] |
nearest(double[] key,
int n) |
Find KD-tree nodes whose keys are n nearest neighbors to key.
|
Object[] |
range(double[] lowk,
double[] uppk) |
Range search in a KD-tree.
|
Object |
search(double[] key) |
Find KD-tree node whose key is identical to key.
|
String |
toString() |
public KDTree(int k)
k - number of dimensionspublic void insert(double[] key,
Object value)
@Book{GonnetBaezaYates1991,
author = {G.H. Gonnet and R. Baeza-Yates},
title = {Handbook of Algorithms and Data Structures},
publisher = {Addison-Wesley},
year = {1991}
}
key - key for KD-tree nodevalue - value at that keyKeySizeException - if key.length mismatches KKeyDuplicateException - if key already in treepublic Object search(double[] key)
key - key for KD-tree nodeKeySizeException - if key.length mismatches Kpublic void delete(double[] key)
key - key for KD-tree nodeKeySizeException - if key.length mismatches KKeyMissingException - if no node in tree has keypublic Object nearest(double[] key)
@techreport{AndrewMooreNearestNeighbor,
author = {Andrew Moore},
title = {An introductory tutorial on kd-trees},
institution = {Robotics Institute, Carnegie Mellon University},
year = {1991},
number = {Technical Report No. 209, Computer Laboratory,
University of Cambridge},
address = {Pittsburgh, PA}
}
key - key for KD-tree nodeKeySizeException - if key.length mismatches Kpublic Object[] nearest(double[] key, int n)
key - key for KD-tree noden - how many neighbors to findKeySizeException - if key.length mismatches KIllegalArgumentException - if n is negative or exceeds tree sizepublic Object[] range(double[] lowk, double[] uppk)
lowk - lower-bounds for keyuppk - upper-bounds for keyKeySizeException - on mismatch among lowk.length, uppk.length, or KCopyright © 2019. All rights reserved.