MCPcopy Create free account
hub / github.com/TheAlgorithms/Python / KDNode

Class KDNode

data_structures/kd_tree/kd_node.py:12–38  ·  view source on GitHub ↗

Represents a node in a KD-Tree. Attributes: point: The point stored in this node. left: The left child node. right: The right child node.

Source from the content-addressed store, hash-verified

10
11
12class KDNode:
13 """
14 Represents a node in a KD-Tree.
15
16 Attributes:
17 point: The point stored in this node.
18 left: The left child node.
19 right: The right child node.
20 """
21
22 def __init__(
23 self,
24 point: list[float],
25 left: KDNode | None = None,
26 right: KDNode | None = None,
27 ) -> None:
28 """
29 Initializes a KDNode with the given point and child nodes.
30
31 Args:
32 point (list[float]): The point stored in this node.
33 left (Optional[KDNode]): The left child node.
34 right (Optional[KDNode]): The right child node.
35 """
36 self.point = point
37 self.left = left
38 self.right = right

Callers 1

build_kdtreeFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected