Clustering
C++20 header-only: DBSCAN, HDBSCAN, k-means.
Loading...
Searching...
No Matches
clustering::KDTreeNode Struct Reference

Node in a KDTree, sharing the same struct shape between internals and leaves. More...

#include <clustering/index/kdtree.h>

Collaboration diagram for clustering::KDTreeNode:
[legend]

Public Attributes

std::size_t m_index
 Internal: pivot slot in the tree's reordered point buffer.
std::size_t m_dim
 Internal: split dimension. Leaf: point count packed at m_index.
KDTreeNodem_left
 Left child, or nullptr on a leaf.
KDTreeNodem_right
 Right child, or nullptr on a leaf.
std::uint32_t m_id
 Monotonic identifier assigned at construction; keys into the owning tree's per-node bounds buffer.

Detailed Description

Node in a KDTree, sharing the same struct shape between internals and leaves.

Internal node: m_index is the pivot's slot in the owning tree's reordered point buffer, m_dim is the split dimension, and m_left / m_right point to children.

Leaf node: m_index is the start offset into the same reordered buffer, m_dim is the count of points packed at that offset, and m_left == m_right == nullptr.

The leaf-vs-internal test is m_left == nullptr && m_right == nullptr. The struct is declared outside KDTree so the allocator can bump-allocate fixed-size slots without seeing the tree's template parameters.

Definition at line 38 of file kdtree.h.

Member Data Documentation

◆ m_dim

std::size_t clustering::KDTreeNode::m_dim

Internal: split dimension. Leaf: point count packed at m_index.

Definition at line 43 of file kdtree.h.

◆ m_id

std::uint32_t clustering::KDTreeNode::m_id

Monotonic identifier assigned at construction; keys into the owning tree's per-node bounds buffer.

Stays valid for the tree's lifetime and never collides across nodes of the same tree. Four bytes is enough: KDTree's node budget never exceeds N, which the HDBSCAN contract caps at the signed 32-bit range.

Definition at line 52 of file kdtree.h.

◆ m_index

std::size_t clustering::KDTreeNode::m_index

Internal: pivot slot in the tree's reordered point buffer.

Leaf: base offset into the same buffer (leaf points live at slots [m_index, m_index + m_dim)).

Definition at line 41 of file kdtree.h.

◆ m_left

KDTreeNode* clustering::KDTreeNode::m_left

Left child, or nullptr on a leaf.

Definition at line 45 of file kdtree.h.

◆ m_right

KDTreeNode* clustering::KDTreeNode::m_right

Right child, or nullptr on a leaf.

Definition at line 47 of file kdtree.h.


The documentation for this struct was generated from the following file: