M-tree
This article provides insufficient context for those unfamiliar with the subject. (June 2010) (Learn how and when to remove this template message) |
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 (k-NN) 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.[1]
Contents
1 Overview
2 M-Tree construction
2.1 Components
2.2 Insert
2.3 Split
3 M-Tree Queries
3.1 Range Query
3.2 k-NN queries
4 See also
5 References
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 r{displaystyle r} that defines a Ball in the desired metric space. Thus, every node n{displaystyle n} and leaf l{displaystyle l} residing in a particular node N{displaystyle N} is at most distance r{displaystyle r} from N{displaystyle N}, and every node n{displaystyle n} and leaf l{displaystyle l} with node parent N{displaystyle N} keep the distance from it.
M-Tree construction
Components
An M-Tree has these components and sub-components:
- Non-leaf nodes
- A set of routing objects NRO.
- Pointer to Node's parent object Op.
- Leaf nodes
- A set of objects NO.
- Pointer to Node's parent object Op.
- Routing Object
- (Feature value of) routing object Or.
- Covering radius r(Or).
- Pointer to covering tree T(Or).
- Distance of Or from its parent object d(Or,P(Or))
- Object
- (Feature value of the) object Oj.
- Object identifier oid(Oj).
- Distance of Oj from its parent object d(Oj,P(Oj))
Insert
The main idea is first to find a leaf node N where the new object O belongs. If N is not full then just attach it to N. If N is full then invoke a method to split N. The algorithm is as follows:
Algorithm Insert
Input: Node N of M-Tree MT, Entry On{displaystyle O_{n}}
Output: A new instance of MT containing all entries in original MT plus On{displaystyle O_{n}}
Ne←N{displaystyle N_{e}gets N}'s routing objects or objects
if N is not a leaf then
{
/* Look for entries that the new object fits into */
let Nin{displaystyle N_{in}} be routing objects from Ne{displaystyle N_{e}}'s set of routing objects NRO{displaystyle N_{RO}} such that d(Or,On)≤r(Or){displaystyle d(O_{r},O_{n})leq r(O_{r})}
if Nin{displaystyle N_{in}} is not empty then
{
/* If there are one or more entry, then look for an entry such that is closer to the new object */
Or∗←minOr∈Nind(Or,On){displaystyle O_{r}^{*}gets min _{O_{r}in N_{in}}d(O_{r},O_{n})}
}
else
{
/* If there are no such entry, then look for an object with minimal distance from */
/* its covering radius's edge to the new object */
Or∗←minOr∈Nind(Or,On)−r(Or){displaystyle O_{r}^{*}gets min _{O_{r}in N_{in}}d(O_{r},O_{n})-r(O_{r})}
/* Upgrade the new radii of the entry */
r(Or∗)←d(Or∗,On){displaystyle r(O_{r}^{*})gets d(O_{r}^{*},O_{n})}
}
/* Continue inserting in the next level */
return insert(T(Or∗),On{displaystyle T(O_{r}^{*}),O_{n}});
else
{
/* If the node has capacity then just insert the new object */
if N is not full then
{ store(N,On{displaystyle N,O_{n}}) }
/* The node is at full capacity, then it is needed to do a new split in this level */
else
{ split(N,On{displaystyle N,O_{n}}) }
}
- "←" denotes assignment. For instance, "largest ← item" means that the value of largest changes to the value of item.
- "return" terminates the algorithm and outputs the following value.
Split
If the split method arrives to the root of the tree, then it choose two routing objects from N, and creates two new nodes containing all the objects in original N, and store them into the new root. If split methods arrives to a node N that is not the root of the tree, the method choose two new routing objects from N, re-arrange every routing object in N in two new nodes N1{displaystyle N_{1}} and N2{displaystyle N_{2}}, and store these new nodes in the parent node Np{displaystyle N_{p}} of original N. The split must be repeated if Np{displaystyle N_{p}} has not enough capacity to store N2{displaystyle N_{2}}. The algorithm is as follow:
Algorithm Split
Input: Node N of M-Tree MT, Entry On{displaystyle O_{n}}
Output: A new instance of MT containing a new partition.
/* The new routing objects are now all those in the node plus the new routing object */
let be NN entries of N∪O{displaystyle Ncup O}
if N is not the root then
{
/*Get the parent node and the parent routing object*/
let Op{displaystyle O_{p}} be the parent routing object of N
let Np{displaystyle N_{p}} be the parent node of N
}
/* This node will contain part of the objects of the node to be split */
Create a new node N'
/* Promote two routing objects from the node to be split, to be new routing objects */
Create new objects Op1{displaystyle O_{p1}} and Op2{displaystyle O_{p2}}.
Promote(N,Op1,Op2{displaystyle N,O_{p1},O_{p2}})
/* Choose which objects from the node being split will act as new routing objects */
Partition(N,Op1,Op2,N1,N2{displaystyle N,O_{p1},O_{p2},N_{1},N_{2}})
/* Store entries in each new routing object */
Store N1{displaystyle N_{1}}'s entries in N and N2{displaystyle N_{2}}'s entries in N'
if N is the current root then
{
/* Create a new node and set it as new root and store the new routing objects */
Create a new root node Np{displaystyle N_{p}}
Store Op1{displaystyle O_{p1}} and Op2{displaystyle O_{p2}} in Np{displaystyle N_{p}}
}
else
{
/* Now use the parent routing object to store one of the new objects */
Replace entry Op{displaystyle O_{p}} with entry Op1{displaystyle O_{p1}} in Np{displaystyle N_{p}}
if Np{displaystyle N_{p}} is no full then
{
/* The second routing object is stored in the parent only if it has free capacity */
Store Op2{displaystyle O_{p2}} in Np{displaystyle N_{p}}
}
else
{
/*If there is no free capacity then split the level up*/
split(Np,Op2{displaystyle N_{p},O_{p2}})
}
}
- "←" denotes assignment. For instance, "largest ← item" means that the value of largest changes to the value of item.
- "return" terminates the algorithm and outputs the following value.
M-Tree Queries
Range Query
A range query is where a minimum similarity/maximum distance value is specified.
For a given query object Q∈D{displaystyle Qin D} and a maximum search distance
r(Q){displaystyle r(Q)}, the range query range(Q, r(Q)) selects all the indexed objects Oj{displaystyle O_{j}} such that d(Oj,Q)≤r(Q){displaystyle d(O_{j},Q)leq r(Q)}.[2]
Algorithm RangeSearch starts from the root node and recursively traverses all the paths which cannot be excluded from leading to qualifying objects.
Algorithm RangeSearch
Input: Node N of M-Tree MT, Q: query object, r(Q){displaystyle r(Q)}: search radius
Output: all the DB objects such that d(Oj,Q)≤r(Q){displaystyle d(Oj,Q)leq r(Q)}
{
let Op{displaystyle O_{p}} be the parent object of node N;
if N is not a leaf then {
for each entry(Or{displaystyle O_{r}}) in N do {
if |d(Op,Q)−d(Or,Op)|≤r(Q)+r(Or){displaystyle |d(O_{p},Q)-d(O_{r},O_{p})|leq r(Q)+r(O_{r})} then {
Compute d(Or,Q){displaystyle d(O_{r},Q)};
if d(Or,Q)≤r(Q)+r(Or){displaystyle d(O_{r},Q)leq r(Q)+r(O_{r})} then
RangeSearch(*ptr(T(Or{displaystyle T(O_{r}})),Q,r(Q){displaystyle r(Q)});
}
}
}
else {
for each entry(Oj{displaystyle O_{j}}) in N do {
if |d(Op,Q)−d(Oj,Op)|≤r(Q){displaystyle |d(O_{p},Q)-d(O_{j},O_{p})|leq r(Q)} then {
Compute d(Oj,Q){displaystyle d(O_{j},Q)};
if d(Oj,Q){displaystyle d(O_{j},Q)} ≤ r(Q){displaystyle r(Q)} then
add oid(Oj){displaystyle oid(O_{j})} to the result;
}
}
}
}
- "←" denotes assignment. For instance, "largest ← item" means that the value of largest changes to the value of item.
- "return" terminates the algorithm and outputs the following value.
oid(Oj){displaystyle oid(O_{j})} is the identifier of the object which resides on a separate data file.
T(Or){displaystyle T(O_{r})} is a sub-tree – the covering tree of Or{displaystyle O_{r}}
k-NN queries
K Nearest Neighbor (k-NN) 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(Q, k) selects the k indexed objects which have the shortest distance from Q, according to the distance function d.
[2]
See also
- Segment tree
Interval tree - A degenerate R-Tree for 1 dimension (usually time).- Bounding volume hierarchy
- Spatial index
- GiST
References
^ Ciaccia, Paolo; Patella, Marco; Zezula, Pavel (1997). "M-tree An Efficient Access Method for Similarity Search in Metric Spaces" (PDF). Proceedings of the 23rd VLDB Conference Athens, Greece, 1997. IBM Almaden Research Center: Very Large Databases Endowment Inc. pp. 426–435. p426. Retrieved 2010-09-07..mw-parser-output cite.citation{font-style:inherit}.mw-parser-output q{quotes:"""""""'""'"}.mw-parser-output code.cs1-code{color:inherit;background:inherit;border:inherit;padding:inherit}.mw-parser-output .cs1-lock-free a{background:url("//upload.wikimedia.org/wikipedia/commons/thumb/6/65/Lock-green.svg/9px-Lock-green.svg.png")no-repeat;background-position:right .1em center}.mw-parser-output .cs1-lock-limited a,.mw-parser-output .cs1-lock-registration a{background:url("//upload.wikimedia.org/wikipedia/commons/thumb/d/d6/Lock-gray-alt-2.svg/9px-Lock-gray-alt-2.svg.png")no-repeat;background-position:right .1em center}.mw-parser-output .cs1-lock-subscription a{background:url("//upload.wikimedia.org/wikipedia/commons/thumb/a/aa/Lock-red-alt-2.svg/9px-Lock-red-alt-2.svg.png")no-repeat;background-position:right .1em center}.mw-parser-output .cs1-subscription,.mw-parser-output .cs1-registration{color:#555}.mw-parser-output .cs1-subscription span,.mw-parser-output .cs1-registration span{border-bottom:1px dotted;cursor:help}.mw-parser-output .cs1-hidden-error{display:none;font-size:100%}.mw-parser-output .cs1-visible-error{font-size:100%}.mw-parser-output .cs1-subscription,.mw-parser-output .cs1-registration,.mw-parser-output .cs1-format{font-size:95%}.mw-parser-output .cs1-kern-left,.mw-parser-output .cs1-kern-wl-left{padding-left:0.2em}.mw-parser-output .cs1-kern-right,.mw-parser-output .cs1-kern-wl-right{padding-right:0.2em}
^ ab P. Ciaccia; M. Patella; F. Rabitti; P. Zezula. "Indexing Metric Spaces with M-tree" (PDF). Department of Computer Science and Engineering. University of Bologna. p. 3. Retrieved 19 November 2013.
Comments
Post a Comment