9 SPATIAL TREES Flashcards
What is the primary focus of this chapter?
To improve nearest-neighbor searches using tree-based data structures and spatial partitioning.
The chapter builds on concepts from the previous chapter about finding specific values.
What are the two new tree-based data structures introduced?
- Uniform quadtrees
- k-d trees
What does the term ‘quadtree’ describe?
A class of two-dimensional data structures that partition each node into four subquadrants.
Based on the original quadtree proposed by Raphael Finkel and Jon Bentley.
What is a uniform quadtree?
A structure with equal-sized subregions that mirror the grid structure, proposed by David P. Anderson.
What is the main advantage of k-d trees over quadtrees?
K-d trees use a more flexible binary partitioning scheme that can adapt to the data and scale to higher dimensions.
What is the main drawback of using grids for two-dimensional data?
They can either consume significant memory with finely grained grids or lead to inefficient searches with coarsely grained grids.
How does a uniform quadtree partition space?
Each node is partitioned into four equal-sized quadrants, with a child node for each non-empty quadrant.
What are the labels commonly used for the four subtrees in a quadtree?
- NorthWest
- NorthEast
- SouthWest
- SouthEast
What information do internal quadtree nodes store?
- Pointers to up to four children
- Metadata such as the number of points in the branch and spatial bounds
What is a composite data structure for a QuadTreeNode?
QuadTreeNode {
* Boolean: is_leaf
* Integer: num_points
* Float: x_min
* Float: x_max
* Float: y_min
* Float: y_max
* Matrix of QuadTreeNodes: children
* Array of Points: points
}
What is the purpose of storing spatial bounds in a quadtree node?
To simplify the implementation of search algorithms by allowing quick look-up of bounds instead of deriving them.
What does the power of quadtrees allow in terms of data structure?
It creates an adaptive, hierarchical grid through branching at each level.
What criteria can be used to decide when to stop subdividing a node in a quadtree?
- Enough points to justify a split
- Large enough spatial bounds
- Maximum depth reached
What is the typical process for building uniform quadtrees?
Recursively divide allocated space into smaller subregions while checking conditions to stop subdividing.
What happens when adding points to a quadtree?
The tree is traversed to find the new point’s location, which may end at a leaf node or an internal dead end.
What does the QuadTreeInsert function do?
It ensures the point being inserted is within the quadtree’s bounds and calls QuadTreeNodeInsert.
What does the code in QuadTreeNodeInsert function do?
It increments num_points, determines which child bin the point belongs to, and adds the point accordingly.
What is the significance of checking splitting conditions when adding a point?
To determine whether to split the current leaf node into subnodes based on the number of points and spatial bounds.
What are the components of the Point structure in a quadtree?
- Float: x
- Float: y
What is the initial step when checking for a child in a quadtree?
Check whether the child exists; if not, create the child.
What values can xbin and ybin take in a quadtree?
Either 0 or 1.
What happens at leaf nodes when inserting points into a quadtree?
Points are inserted directly into the node.
What condition must be checked before splitting a leaf node in a quadtree?
Whether the splitting conditions are met.
How does the code handle splitting a leaf node?
It marks the node as a non-leaf and reinserts the points one at a time.