1 / 11

Databases and games: indexing

Learn how to interpret queries geometrically, process data efficiently, and optimize search structures for multi-dimensional datasets. Discover the power of range trees and layered range trees.

marcusb
Download Presentation

Databases and games: indexing

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Databases and games: indexing Orthogonal range queries & Layered range trees Nick Gaens

  2. Orthogonal range queries Queries in a database can be interpreted geometrically • by transforming records into points in a multi-dimensional space • and than querying that set of points instead. Source: "Orthogonal range searching" by Antoine Vigneron, INRA. (link)

  3. Orthogonal range queries Relation to games? Orthogonal: determination of a multi- dimensional position (mostly 2D or 3D) of e.g. some unit on a map. Range: very frequently used. E.g. “select all units that are at most 2 positions away from my current location”.

  4. Processing Example: “For each friendly unit, count all enemy units on some 2D map.” Naïve solution: O(n²) Can be improved by introducing indices, structured in e.g. a tree. 

  5. Range tree Multi-dimensional Range Tree 2D Range Tree What? An ordered tree data structure to hold a list of points. What for? It allows all points within a given range to be efficiently retrieved When? Typically used for structuring two- or higher-dimensional data sets. Source: Lecture 10 of the course “(Geometric) Data Structures”, ISG, Universität Magdeburg. (link) Source: Homepage of the course “(Geometric) Data Structures”, ISG, Universität Magdeburg. (link)

  6. Range tree Building a range tree from a data set containing n points space: O(n log n) time: O(n log n) Querying a multi-dimensional range tree time: O((log n)d + k)

  7. Optimizations Simple: • ignore categorical data, since it can be replaced by a hash table with O(1) • position static and frequently updated parameters in such a way that updating the tree has a minimal cost Less simple: • fractional cascading

  8. Fractional cascading Searching in similar lists, especially sublists. Main idea is to perform queries in the associated structures in time O(1 + k), instead of O(log n + k). Query time: Traverse S1: O(k) Follow pointer: O(1) Traverse S2: O(k) Source: Lecture 6 of the course “Computational Geometry”, Joachim Gudmundsson. (link)

  9. Layered range tree Range tree Fractional cascading Layered range tree Example: Buildup time: O(n logd n) Query time: O(k + logd n) Gain: log n Buildup time: O(n logd-1 n) Query time: O(k + logd-1 n) Source: Lecture 6 of the course “Computational Geometry”, Joachim Gudmundsson. (link)

  10. Conclusions Example: “For each friendly unit, count all enemy units on some 2D map.” • Naïvely processing orthogonal range queries causes a performance disaster.O(n²) • Relatively simple data structures (range trees) can be used to query multi-dimensional data sets quite efficiently.Buildup: O(n logd n) and query: O(n logd n + k) • Such a range tree can even be optimized further by introducing fractional cascading, resulting in a layered range tree.Buildup: O(n logd-1 n) and query: O(n logd-1 n + k)

  11. Q&A Questions?

More Related