Skip to content

Commit ead2838

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent cd1dd9f commit ead2838

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

data_structures/kd_tree/nearest_neighbour_search.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
from typing import Optional, List, Tuple
22
from .kd_node import KDNode
33

4+
45
def nearest_neighbour_search(
5-
root: Optional[KDNode],
6-
query_point: List[float]
6+
root: Optional[KDNode], query_point: List[float]
77
) -> Tuple[Optional[List[float]], float, int]:
88
"""
99
Performs a nearest neighbor search in a KD-Tree for a given query point.
@@ -44,7 +44,8 @@ def search(node: Optional[KDNode], depth: int = 0) -> None:
4444
# Calculate the current distance (squared distance)
4545
current_point = node.point
4646
current_dist = sum(
47-
(query_coord - point_coord) ** 2 for query_coord, point_coord in zip(query_point, current_point)
47+
(query_coord - point_coord) ** 2
48+
for query_coord, point_coord in zip(query_point, current_point)
4849
)
4950

5051
# Update nearest point if the current node is closer

0 commit comments

Comments
 (0)