Containers
Just like you can create a uni-dimensional map with:
1 2 3 |
|
1 2 3 |
|
Spatial containers allow you to create an \(m\)-dimensional map with something like:
1 2 3 4 |
|
1 2 |
|
A spatial_map
is currently defined as an alias to an r_tree
. If you want to be specific about which data structure to use, you can directly define:
1 2 3 4 5 |
|
1 2 3 4 5 |
|
Here's a summary of what each container is good at:
Container | Best Application | Optimal |
---|---|---|
kd_tree |
Non-uniformly distributed objects | Yes |
r_tree |
Non-uniformly distributed objects that might overlap in space | Yes |
r_star_tree |
Same as r_tree with more expensive insertion and less expensive queries |
Yes |
quad_tree |
Uniformly distributed objects | No |
implicit_tree |
Benchmarks only | No |
Although pareto::front
and pareto::archive
also implement the SpatialContainer concept, they serve a different purpose we discuss in Sections Front Concept and Archive Concept. However, their interface remains unchanged for the most common use cases:
1 2 |
|
1 2 |
|
Complexity
-
Containers with optimal asymptotic complexity have a \(O(m \log n)\) cost to search, insert and remove elements.
-
Quadtrees do not have optimal asymptotic complexity because removing elements might require reconstructing subtrees with cost \(O(m n \log n)\).
-
The container
implicit_tree
is emulates a tree with astd::vector
. You can think of it as a multidimensionalflat_map
. However, unlike a flat map, sorting the elements in a single dimension does not make operations much unless \(m \leq 3\). Its basic operations cost \(O(mn)\) and it's mostly used as a reference for our benchmarks.