ArticleslgStudy

computer science

Implicit k-d tree

Implicit k-d tree is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Implicit k-d tree rather than just read about it. In short: An implicit k-d tree is a k-d tree defined implicitly above a rectilinear grid. Its split planes' positions and orientations are not given explicitly but implicitly by some recursive splitting-function defined on the hyperrectangles belonging to the tree's nodes.

Implicit k-d tree — main illustration
Implicit k-d tree — illustration

Key takeaways

  • Implicit k-d tree belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Implicit k-d tree to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Implicit k-d tree from memory before moving on to harder problems.

Reference excerpt

An implicit k-d tree is a k-d tree defined implicitly above a rectilinear grid. Its split planes' positions and orientations are not given explicitly but implicitly by some recursive splitting-function defined on the hyperrectangles belonging to the tree's nodes. Each inner node's split plane is positioned on a grid plane of the underlying grid, partitioning the node's grid into two subgrids.

Nomenclature and references The terms "min/max k-d tree" and "implicit k-d tree" are sometimes mixed up. This is because the first publication using the term "implicit k-d tree" did actually use explicit min/max k-d trees but referred to them as "implicit k-d trees" to indicate that they may be used to ray trace implicitly given iso surfaces. Nevertheless, this publication used also slim k-d trees which are a subset of the implicit k-d trees with the restriction that they can only be built over integer hyperrectangles with sidelengths that are powers of two. In the 00s, implicit k-d trees as defined here were introduced, with applications in computer graphics. As it is possible to assign attributes to implicit k-d tree nodes, one may refer to an implicit k-d tree which has min/max values assigned to its nodes as an "implicit min/max k-d tree".

Construction Implicit k-d trees are generally not constructed explicitly. When accessing a node, its split plane orientation and position are evaluated using the specific splitting-function defining the tree. Different splitting-functions may result in different trees for the same underlying grid.

Splitting-functions Splitting-functions may be adapted to special purposes. Underneath two specifications of special splitting-function classes.

Non-degenerated splitting-functions do not allow the creation of degenerated nodes (nodes whose corresponding integer hyperrectangle's volume is equal zero). Their corresponding implicit k-d trees are full binary trees, which have for n leaf nodes n - 1 inner nodes. Their corresponding implicit k-d trees are non-degenerated implicit k-d trees. complete splitting-functions are non-degenerated splitting-functions whose corresponding implicit k-d tree's leaf nodes are single grid cells such that they have one inner node less than the amount of gridcells given in the grid. The corresponding implicit k-d trees are complete implicit k-d trees. A complete splitting function is for example the grid median splitting-function. It creates fairly balanced implicit k-d trees by using k-dimensional integer hyperrectangles hyprec[2][k] belonging to each node of the implicit k-d tree. The hyperrectangles define which gridcells of the rectilinear grid belong to their corresponding node. If the volume of this hyperrectangle equals one, the corresponding node is a single grid cell and is therefore not further subdivided and marked as leaf node. Otherwise the hyperrectangle's longest extent is chosen as orientation o. The corresponding split plane p is positioned onto the grid plane that is closest to the hyperrectangle's grid median along that orientation. Split plane orientation o:

o = min{argmax(i = 1 ... k: (hyprec[1][i] - hyprec[0][i]))}

Split plane position p:

p = roundDown((hyprec[0][o] + hyprec[1][o]) / 2)

Assigning attributes to implicit k-d tree nodes An advantage of implicit k-d trees is that their split plane's orientations and positions need not to be stored explicitly. But some applications require besides the split plane's orientations and positions further attributes at the inner tree nodes. These attributes may be for example single bits or single scalar values, defining if the subgrids belonging to the nodes are of interest or not. For complete implicit k-d trees it is possible to pre-allocate a correctly sized array of attributes and to assign each inner node of the tree to a unique element in that allocated array. The amount of gridcells in the grid is equal the volume of the integer hyperrectangle belonging to the grid. As a complete implicit k-d tree has one inner node less than grid cells, it is known in advance how many attributes need to be stored. The relation "Volume of integer hyperrectangle to inner nodes" defines together with the complete splitting-function a recursive formula assigning to each split plane a unique element in the allocated array. The corresponding algorithm is given in C-pseudo code underneath.

It is worth mentioning that this algorithm works for all rectilinear grids. The corresponding integer hyperrectangle does not necessarily have to have sidelengths that are powers of two.

Applications Implicit max-k-d trees are used for ray casting isosurfaces/MIP (maximum intensity projection). The attribute assigned to each inner node is the maximal scalar value given in the subgrid belonging to the node. Nodes are not traversed if their scalar values are smaller than the searched iso-value/current maximum intensity along the ray. The low storage requirements of the implicit max kd-tree and the favorable visualization complexity of ray casting allow to ray cast (and even change the isosurface for) very large scalar fields at interactive framerates on commodity PCs. Similarly an implicit min/max kd-tree may be used to efficiently evaluate queries such as terrain line of sight.

Complexity Given an implicit k-d tree spanned over a k-dimensional grid with n gridcells.

Assigning attributes to the nodes of the tree takes O ( k n ) {\displaystyle \mathrm {O} (kn)} time. Storing attributes to the nodes takes O ( n ) {\displaystyle \mathrm {O} (n)} memory. Ray casting iso-surfaces/MIP an underlying scalar field using the corresponding implicit max k-d tree takes roughly O ( log ⁡ ( n ) ) {\displaystyle \mathrm {O} (\log(n))} time.

See also k-d tree min/max k-d tree

References

Illustrations

Implicit k-d tree: Construction and storage of a 2D implicit max kd-tree using the grid median splitting-function. Each cell of the rectilinear grid has one scalar value from low (bright blue) to high (bright red) assigned to it. The grid's memory footprint is indicated in the lower line. The implicit max kd-tree's predefined memory footprint needs one scalar value less than that. The storing of the node's max values is indicated in the upper line.
Construction and storage of a 2D implicit max kd-tree using the grid median splitting-function. Each cell of the rectilinear grid has one scalar value from low (bright blue) to high (bright red) assigned to it. The grid's memory footprint is indicated in the lower line. The implicit max kd-tree's predefined memory footprint needs one scalar value less than that. The storing of the node's max values is indicated in the upper line.

Worked examples

Example 1 — a first encounter with Implicit k-d tree

Start with the simplest possible case. Write down what Implicit k-d tree claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Implicit k-d tree before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Implicit k-d tree ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Implicit k-d tree

In research
Implicit k-d tree appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Implicit k-d tree in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Implicit k-d tree is common in secondary-school and first-year university syllabi. It links to neighbouring topics Computer graphics data structures, Trees (data structures), so understanding it makes those chapters shorter.
In everyday life
Look for Implicit k-d tree outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.

Affiliate

Preply — study more efficiently by working with a personal tutor. 50% off.

How to study Implicit k-d tree in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Implicit k-d tree means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Implicit k-d tree out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Implicit k-d tree in simple terms?

An implicit k-d tree is a k-d tree defined implicitly above a rectilinear grid. Its split planes' positions and orientations are not given explicitly but implicitly by some recursive splitting-function defined on the hyperrectangles belonging to the tree's nodes.

Why does Implicit k-d tree matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Implicit k-d tree?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Implicit k-d tree.

Tags

  • Computer graphics data structures
  • Trees (data structures)

Keep exploring