Level Comparison

The below charts show the load balance between the different levels of the tree. Tree construction is compared against one call to find_colliding_pairs.

Some observations:

  • The cost of rebalancing the first level is the most erratic. This is because in some cases we're hitting the worst cases of pdqselect. I like to think of the algorithm as a sponge and the problem as water seeping through it. First you you have coarse filtering, then it gets more precise.
  • The load goes from the top levels to the bottom levels as the aabbs spread out more.
  • The load on the first few levels is not high unless the aabbs are clumped up.
  • The leaves don't have much work to do since aabbs have a size, they aren't likely to into a leaf.

Level 0Level 1Level 2Level 3Level 4Level 5Level 6Complexity of rebal levels with abspiral(5000,x)Spiral GrowNumber of Comparisons01e52.0e53.0e54.0e55.0e50.70.80.91.01.11.21.31.4 Level 0Level 1Level 2Level 3Level 4Level 5Level 6Complexity of query levels with abspiral(5000,x)Spiral GrowNumber of Comparisons05e51e61.5e62.0e62.5e60.70.80.91.01.11.21.31.4 Level 0Level 1Level 2Level 3Level 4Level 5Level 6Bench of rebal levels with abspiral(5000,x)Spiral GrowTime taken in Seconds0e00.00050.00100.00150.70.80.91.01.11.21.31.4 Level 0Level 1Level 2Level 3Level 4Level 5Level 6Bench of query levels with abspiral(5000,x)Spiral GrowTime taken in Seconds0e00.0020.0040.0060.0080.70.80.91.01.11.21.31.4