M-tree


M-trees are tree data structures that are similar to R-trees and B-trees. It is constructed using a metric and relies on the triangle inequality for efficient range and k-nearest neighbor queries.
While M-trees can perform well in many conditions, the tree can also have large overlap and there is no clear strategy on how to best avoid overlap. In addition, it can only be used for distance functions that satisfy the triangle inequality, while many advanced dissimilarity functions used in information retrieval do not satisfy this.

Overview

As in any Tree-based data structure, the M-Tree is composed of Nodes and Leaves. In each node there is a data object that identifies it uniquely and a pointer to a sub-tree where its children reside. Every leaf has several data objects. For each node there is a radius that defines a Ball in the desired metric space. Thus, every node and leaf residing in a particular node is at most distance from, and every node and leaf with node parent keep the distance from it.

M-Tree construction

Components

An M-Tree has these components and sub-components:
  1. Non-leaf nodes
  2. # A set of routing objects NRO.
  3. # Pointer to Node's parent object Op.
  4. Leaf nodes
  5. # A set of objects NO.
  6. # Pointer to Node's parent object Op.
  7. Routing Object
  8. # routing object Or.
  9. # Covering radius r.
  10. # Pointer to covering tree T.
  11. # Distance of Or from its parent object d
  12. Object
  13. # object Oj.
  14. # Object identifier oid.
  15. # Distance of Oj from its parent object d

    Insert

The main idea is first to find a leaf node where the new object belongs. If is not full then just attach it to. If is full then invoke a method to split. The algorithm is as follows:
Input: Node of M-Tree,
Output: A new instance of containing all entries in original
's routing objects or objects
if is not a leaf then

Split

If the split method arrives to the root of the tree, then it choose two routing objects from, and creates two new nodes containing all the objects in original, and store them into the new root. If split methods arrives to a node that is not the root of the tree, the method choose two new routing objects from, re-arrange every routing object in in two new nodes and, and store these new nodes in the parent node of original. The split must be repeated if has not enough capacity to store. The algorithm is as follow:
Input: Node of M-Tree,
Output: A new instance of containing a new partition.
/* The new routing objects are now all those in the node plus the new routing object */
let be entries of
if is not the root then

/* This node will contain part of the objects of the node to be split */
Create a new node
/* Promote two routing objects from the node to be split, to be new routing objects */
Create new objects
Promote
/* Choose which objects from the node being split will act as new routing objects */
Partition
/* Store entries in each new routing object */

if is the current root then

else

M-Tree Queries

Range Query

A range query is where a minimum similarity/maximum distance value is specified.
For a given query object and a maximum search distance
, the range query range selects all the indexed objects such that.
Algorithm RangeSearch starts from the root node and recursively traverses all the paths which cannot be excluded from leading to qualifying objects.
Input: Node of M-Tree MT, : query object, : search radius
Output: all the DB objects
K Nearest Neighbor query takes the cardinality of the input set as an input parameter. For a given query object Q ∈ D and an
integer k ≥ 1, the k-NN query NN selects the k indexed objects which have the shortest distance from Q, according to the distance function d.