Fix heuristic selection candidate sourcing
This commit is contained in:
parent
08e1f4e085
commit
e4d66890da
20
src/lib.rs
20
src/lib.rs
|
@ -569,17 +569,19 @@ impl Search {
|
|||
self.working.clear();
|
||||
// Get input candidates from `self.nearest` and store them in `self.working`.
|
||||
// `self.candidates` will represent `W` from the paper's algorithm 4 for now.
|
||||
while let Some(Reverse(candidate)) = self.candidates.pop() {
|
||||
for &candidate in &self.nearest {
|
||||
self.working.push(candidate);
|
||||
for hop in layer.nearest_iter(candidate.pid) {
|
||||
if !self.visited.insert(hop) {
|
||||
continue;
|
||||
}
|
||||
if params.extend_candidates {
|
||||
for hop in layer.nearest_iter(candidate.pid) {
|
||||
if !self.visited.insert(hop) {
|
||||
continue;
|
||||
}
|
||||
|
||||
let other = &points[hop];
|
||||
let distance = OrderedFloat::from(point.distance(other));
|
||||
let new = Candidate { distance, pid: hop };
|
||||
self.working.push(new);
|
||||
let other = &points[hop];
|
||||
let distance = OrderedFloat::from(point.distance(other));
|
||||
let new = Candidate { distance, pid: hop };
|
||||
self.working.push(new);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue