ArticleslgStudy

computer science

PH-tree

PH-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 PH-tree rather than just read about it. In short: The PH-tree is a tree data structure used for spatial indexing of multi-dimensional data (keys) such as geographical coordinates, points, feature vectors, rectangles or bounding boxes. The PH-tree is space partitioning index with a structure similar to that of a quadtree or octree.

PH-tree — main illustration
PH-tree — illustration

Key takeaways

  • PH-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 PH-tree to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of PH-tree from memory before moving on to harder problems.

Reference excerpt

The PH-tree is a tree data structure used for spatial indexing of multi-dimensional data (keys) such as geographical coordinates, points, feature vectors, rectangles or bounding boxes. The PH-tree is space partitioning index with a structure similar to that of a quadtree or octree. However, unlike quadtrees, it uses a splitting policy based on tries and similar to Crit bit trees that is based on the bit-representation of the keys. The bit-based splitting policy, when combined with the use of different internal representations for nodes, provides scalability with high-dimensional data. The bit-representation splitting policy also imposes a maximum depth, thus avoiding degenerated trees and the need for rebalancing.

Overview The basic PH-tree is a spatial index that maps keys, which are d-dimensional vectors with integers, to user defined values. The PH-tree is a multi-dimensional generalization of a Crit bit tree in the sense that a Crit bit tree is equivalent to a PH-tree with 1 {\displaystyle 1} -dimensional keys. Like the Crit bit tree, and unlike most other spatial indexes, the PH-tree is a map rather than a multimap. A d-dimensional PH-tree is a tree of nodes where each node partitions space by subdividing it into 2 d {\displaystyle 2^{d}} quadrants (see below for how potentially large nodes scales with high dimensional data). Each quadrant contains at most one entry, either a key-value pair (leaf quadrant) or a key-subnode pair. For a key-subnode pair, the key represents the center of the subnode. The key is also the common prefix (bit-representation) of all keys in the subnode and its child subnodes. Each node has at least two entries, otherwise it is merged with the parent node. Some other structural properties of PH-trees are:

They are 2 n {\displaystyle 2^{n}} -ary trees. They are inherently unbalanced but imbalance is limited due to their depth being limited to the bit width of the keys, e.g. to 32 for a d {\displaystyle d} -dimensional key with 32-bit integers. Insertion or removal operations cause exactly one node to be modified and potentially a second node to be added or removed. This can be useful for concurrent implementations. This also means little variation in modification cost. Their structure is independent from insertion/removal order.

Splitting strategy Similar to most quadtrees, the PH-tree is a hierarchy of nodes where every node splits the space in all d dimensions. Thus, a node can have up to 2 d {\displaystyle 2^{d}} subnodes, one for each quadrant.

Quadrant numbering The PH-tree uses the bits of the multi-dimensional keys to determine their position in the tree. All keys that have the same leading bits are stored in the same branch of the tree. For example, in a node at level L, to determine the quadrant where a key should be inserted (or removed or looked up), it looks at the L's bit of each dimension of the key. For a 3D node with 8 quadrants (forming a cube) the L's bit of the first dimension of the key determines whether the target quadrant is on the left or the right of the cube, the L's bit of the second dimension determines whether it is at the front or the back, and the L's bit of the third dimension determines bottom vs top, see picture.

1D example Example with three 1D keys with 8-bit values: k 0 = { 1 } b a s e 10 = { 00000001 } b a s e 2 {\displaystyle k_{0}=\{1\}_{base\ 10}=\{00000001\}_{base\ 2}} , k 1 = { 4 } 10 = { 00000100 } 2 {\displaystyle k_{1}=\{4\}_{10}=\{00000100\}_{2}} and k 2 = { 35 } 10 = { 00100011 } 2 {\displaystyle k_{2}=\{35\}_{10}=\{00100011\}_{2}} . Adding k 0 {\displaystyle k_{0}} and k 1 {\displaystyle k_{1}} to an empty tree results in a single node. The two keys first differ in their 6th bit so the node has a level L = 5 {\displaystyle L=5} (starting with 0). The node has a 5-bit prefix representing the common 5 bits of both keys. The node has two quadrants, each key is stored in one quadrant. Adding a third key k 3 {\displaystyle k_{3}} results in one additional node at L = 2 {\displaystyle L=2} with one quadrant containing the original node as subnode and the other quadrant containing the new key k 2 {\displaystyle k_{2}} .

… excerpt ends here. Continue reading the full article.

Illustrations

PH-tree: Example of a PH-tree with three keys added, resulting in two nodes. A root node (red) and a subnode (blue).
Example of a PH-tree with three keys added, resulting in two nodes. A root node (red) and a subnode (blue).
PH-tree: Example of a PH-tree with two 2D keys in one node
Example of a PH-tree with two 2D keys in one node

Worked examples

Example 1 — a first encounter with PH-tree

Start with the simplest possible case. Write down what PH-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 PH-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 PH-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 PH-tree

In research
PH-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 PH-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
PH-tree is common in secondary-school and first-year university syllabi. It links to neighbouring topics Database index techniques, Geometric data structures, Trees (data structures), so understanding it makes those chapters shorter.
In everyday life
Look for PH-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 PH-tree in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what PH-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 PH-tree out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is PH-tree in simple terms?

The PH-tree is a tree data structure used for spatial indexing of multi-dimensional data (keys) such as geographical coordinates, points, feature vectors, rectangles or bounding boxes. The PH-tree is space partitioning index with a structure similar to that of a quadtree or octree.

Why does PH-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 PH-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 PH-tree.

Tags

  • Database index techniques
  • Geometric data structures
  • Trees (data structures)

Keep exploring