liveBook · Manning

Region search

As explained in Advanced Algorithms and Data Structures

Region search is the operation of finding dataset points that lie within a specified region of a multidimensional space.

Region search returns dataset points inside a specified region of multidimensional space. Typical regions include hyper-spheres, defined by distance from a center, and hyper-rectangles, defined by coordinate ranges. section 9.3.6

Implement region search by traversing the spatial index and pruning branches that cannot intersect the query region:

  • For a k-d tree, test each point, visit the nearer branch, then visit the other branch only when its split boundary intersects the region. section 9.3.6
  • For an SS-tree, test region–node-envelope intersection and inspect individual points only at leaves. section 10.4.2

Complexity and trade-offs

A small region may follow one balanced-tree path in O(log n), while a region containing every point requires O(n) traversal. Thus the worst-case running time is O(n), although pruning can be substantial for selective regions. Regions bounded by generic, non-axis-parallel lines require more complex methods than k-d-tree search. section 9.3.6

How Advanced Algorithms and Data Structures covers it

How deep it goes
Explains recursive implementations, pruning, region intersections, and complexity, but defers generic non-axis-parallel regions.
Examples
Uses hyper-sphere and hyper-rectangle queries with recursive pointsInSphere, pointsInRectangle, and pointsWithinRegion procedures.
What it assumes
Assumes understanding of k-d trees or SS-trees, multidimensional coordinates, and region–boundary intersection tests.
What you can do after
Apply region queries via k-d-tree or SS-tree traversal while estimating pruning behavior and worst-case running time.
How it connects
Connects region search with k-d trees, SS-trees, hyper-spheres, hyper-rectangles, and range queries.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Advanced Algorithms and Data Structures. The section links point to the parts of the book it draws on.