Move reset of insertion into add_neighbor_heuristic()

This commit is contained in:
Dirkjan Ochtman 2021-01-21 10:12:05 +01:00
parent a0b90dfd66
commit 1d5cd4e6ec
1 changed files with 1 additions and 1 deletions

View File

@ -403,7 +403,6 @@ fn insert<P: Point>(
// `candidate` here is the new node's neighbor // `candidate` here is the new node's neighbor
let &Candidate { distance, pid } = candidate; let &Candidate { distance, pid } = candidate;
if let Some(heuristic) = heuristic { if let Some(heuristic) = heuristic {
insertion.reset();
let found = insertion.add_neighbor_heuristic( let found = insertion.add_neighbor_heuristic(
new, new,
layer.as_slice().nearest_iter(pid), layer.as_slice().nearest_iter(pid),
@ -524,6 +523,7 @@ impl Search {
points: &[P], points: &[P],
params: Heuristic, params: Heuristic,
) -> &[Candidate] { ) -> &[Candidate] {
self.reset();
self.push(new, point, points); self.push(new, point, points);
for pid in current { for pid in current {
self.push(pid, point, points); self.push(pid, point, points);