Multi-Dimensional Data Structure (mdds)
A collection of multi-dimensional data structure and indexing algorithm.
Overview of data structures included in mdds
This library implements the following data structure:
Segment tree is a balanced-binary-tree based data structure efficient
for detecting all intervals (or segments) that contain a given point.
The segments may overlap with each other. The end points of stored segments are not inclusive, that is, when an interval spans from 2 to 6, an arbitrary point x within that interval can take a value of 2 <= x < 6.
Flat Segment Tree
Flat segment tree is a variant of segment tree that is designed to store a collection of non-overlapping segments. This structure is efficient when you need to store values associated with 1 dimensional segments that never overlap with each other. Like segment tree, stored segments' end points are non-inclusive.
Rectangle set stores 2-dimensional rectangles and provides an efficient way to query all rectangles that contain a given point in 2-dimensional space. It internally uses nested segment tree. Each rectangle is defined by two 2-dimensional points: the top-left and bottom-right points, and the bottom-right point is non-inclusive. For instance, if a rectangle ranges from (x=2, y=2) to (x=10, y=20), then a 2-dimension point A (x,y) is said to be inside that rectangle only when 2 <= x < 10 and 2 <= y < 20.
Point Quad Tree
Point quad tree stores 2-dimensional points and provides an efficient way to query all points within specified rectangular region.
Multi Type Vector
Multi-type vector allows storage of unspecified number of types in a single logical array such that contiguous elements of identical type are stored in contiguous segment in memory space.
Multi Type Matrix
Multi-type matrix is a matrix structure that allows storage of four different element types: numeric, string, boolean and empty. It uses multi-type vector as its underlying storage.
Sorted String Map
Sorted string map is a simple data structure that takes a pre-sorted list of key-value pairs that are known at compile time, and allows efficient lookup. It does not allocate memory to duplicate its content, as it directly uses the pre-sorted list provided by the caller.
Trie map is an associative container that stores multiple key-value pairs where keys are stored in a trie structure to optimize for prefix searches.
Packed Trie Map
Packed trie map is nearly identical to the trie map counterpart except that this one is immutable. It packs all its content in a contiguous array for optimum storage and lookup efficiency.
mdds is free software. You may copy, distribute, and modify it under the terms of the License contained in the file COPYING distributed with this package. This license is the same as the MIT/X Consortium license.
|Version||API Version||Release Date||Download||Check Sum||File Size (bytes)|
Older releases are archived here.
Once you have downloaded the package, run the following commands to install the mdds headers to your system:
tar xvf mdds_<version>.tar.bz2 cd mdds_<version> ./autogen.sh make check # optional for executing tests. make install
It will install the headers under
/usr/local by default. Use the
option of the autogen.sh script to specify custom install location if you wish
to install it to a non-default location.
API Incompatibility Notes
trie_map / packed_trie_map
The find() method now returns a const_iterator instance rather than a value type. It returns an end position iterator when the method fails to find a match.
The prefix_search() method now returns a search_results instance that has begin() and end() methods to allow iterating through the result set.
The constructor no longer takes a null value parameter.
Some nested type names have been renamed:
- string_type -> key_type
- char_type -> key_unit_type
- string_buffer_type -> key_buffer_type
Some functions expected from the key trait class have been renamed:
- init_buffer() -> to_key_buffer()
- to_string() -> to_key()
The kay trait class now expects the following additional static methods:
- key_buffer_type to_key_buffer(const key_type& key)
- key_unit_type* buffer_data(const key_buffer_type& buf)
- size_t buffer_size(const key_buffer_type& buf)
- The search_result nested class has been renamed to search_results, to keep the name consistent with that of the same name in trie_map and packed_trie_map.
- The matrix trait structure (formerly known as the string trait structure) now needs to specify the type of block that stores integer values as its integer_element_block member.
Starting with version 1.0, mdds now requires support for C++11. Stick with 0.12 or earlier versions if you use a compiler that doesn't support C++11.
data_type has been renamed to value_type for segment_tree, rectangle_set, and point_quad_tree.
- The number of template parameters in custom_block_func1, custom_block_func2 and custom_block_func3 have been reduced by half, by deducing the numerical block type ID from the block type definition directly. If you use the older variant, simply remove the template arguments that are numerical block IDs.
- The search_tree() method in 0.8.0 returns std::pair instead of just returning bool as of 0.7.1. If you use this method and relies on the return value of the old version, use the second parameter of the new return value which is equivalent of the previous return value.
- The search() method now returns ::std::pair. This method previously returned only bool. Use the second parameter of the new return value which is equivalent of the previous return value.
Who uses mdds?
These are the projects that are known to use mdds.