Rename num argument to Layer::search() to links

This commit is contained in:
Dirkjan Ochtman 2020-12-17 13:04:16 +01:00
parent 3241070758
commit d42bf8adc9
1 changed files with 4 additions and 4 deletions

View File

@ -417,12 +417,12 @@ trait Layer {
/// element; `search.candidates` contains the enter points `ep`. `points` contains all the
/// points, which is required to calculate distances between two points.
///
/// The `num` argument represents the number of links from each candidate to consider. This
/// The `links` argument represents the number of links from each candidate to consider. This
/// function may be called for a higher layer (with M links per node) or the zero layer (with
/// M * 2 links per node), but for performance reasons we often call this function on the data
/// representation matching the zero layer even when we're referring to a higher layer. In that
/// case, we use `num` to constrain the number of per-candidate links we consider for search.
fn search<P: Point>(&self, point: &P, search: &mut Search, points: &[P], num: usize) {
/// case, we use `links` to constrain the number of per-candidate links we consider for search.
fn search<P: Point>(&self, point: &P, search: &mut Search, points: &[P], links: usize) {
while let Some(candidate) = search.candidates.pop() {
if let Some(found) = search.nearest.last() {
if candidate.distance > found.distance {
@ -430,7 +430,7 @@ trait Layer {
}
}
for pid in self.nearest_iter(candidate.pid).take(num) {
for pid in self.nearest_iter(candidate.pid).take(links) {
search.push(pid, point, points);
}
}