|
|
|||||||||||||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||||||||||||||
java.lang.Objectde.lmu.ifi.dbs.elki.logging.AbstractLoggable
de.lmu.ifi.dbs.elki.index.tree.TreeIndex<O,N,E>
de.lmu.ifi.dbs.elki.index.tree.metrical.MetricalIndex<O,D,N,E>
de.lmu.ifi.dbs.elki.index.tree.metrical.mtreevariants.AbstractMTree<O,D,N,E>
O - the type of DatabaseObject to be stored in the metrical indexD - the type of Distance used in the metrical indexN - the type of MetricalNode used in the metrical indexE - the type of MetricalEntry used in the metrical indexpublic abstract class AbstractMTree<O extends DatabaseObject,D extends Distance<D>,N extends AbstractMTreeNode<O,D,N,E>,E extends MTreeEntry<D>>
Abstract super class for all M-Tree variants.
| Nested Class Summary | |
|---|---|
private class |
AbstractMTree.SplitResult
Encapsulates a split object and the newly created node. |
| Field Summary | |
|---|---|
static OptionID |
DISTANCE_FUNCTION_ID
OptionID for DISTANCE_FUNCTION_PARAM |
protected ObjectParameter<DistanceFunction<O,D>> |
DISTANCE_FUNCTION_PARAM
Parameter to specify the distance function to determine the distance between database objects, must extend DistanceFunction. |
private DistanceFunction<O,D> |
distanceFunction
Holds the instance of the distance function specified by DISTANCE_FUNCTION_PARAM. |
protected static boolean |
extraIntegrityChecks
Debugging flag: do extra integrity checks |
| Fields inherited from class de.lmu.ifi.dbs.elki.index.tree.TreeIndex |
|---|
CACHE_SIZE_ID, cacheSize, dirCapacity, dirMinimum, file, FILE_ID, initialized, leafCapacity, leafMinimum, PAGE_SIZE_ID, pageSize |
| Fields inherited from class de.lmu.ifi.dbs.elki.logging.AbstractLoggable |
|---|
debug, logger |
| Constructor Summary | |
|---|---|
AbstractMTree(Parameterization config)
Constructor, adhering to Parameterizable |
|
| Method Summary | |
|---|---|
private void |
adjustTree(TreeIndexPath<E> subtree)
Adjusts the tree after insertion of some nodes. |
protected void |
batchNN(N node,
List<Integer> ids,
Map<Integer,KNNList<D>> knnLists)
Performs a batch k-nearest neigbor query for a list of query objects. |
private TreeIndexPath<E> |
choosePath(Integer objectID,
TreeIndexPath<E> subtree)
Chooses the best path of the specified subtree for insertion of the given object. |
protected void |
createEmptyRoot(O object)
Creates an empty root node and writes it to file. |
protected abstract E |
createNewDirectoryEntry(N node,
Integer routingObjectID,
D parentDistance)
Creates a new directory entry representing the specified node. |
protected abstract E |
createNewLeafEntry(O object,
D parentDistance)
Creates a new leaf entry representing the specified data object. |
private TreeIndexPath<E> |
createNewRoot(N oldRoot,
N newNode,
Integer firstRoutingObjectID,
Integer secondRoutingObjectID)
Creates a new root node that points to the two specified child nodes and return the path to the new root. |
boolean |
delete(O o)
Throws an UnsupportedOperationException since deletion of objects is not yet supported by an M-Tree. |
protected D |
distance(Integer id1,
Integer id2)
Returns the distance between the two specified ids. |
protected void |
doKNNQuery(Integer q,
KNNList<D> knnList)
Performs a k-nearest neighbor query for the given FeatureVector with the given parameter k and the according distance function. |
private void |
doRangeQuery(Integer o_p,
N node,
Integer q,
D r_q,
List<DistanceResultPair<D>> result)
Performs a range query on the specified subtree. |
DistanceFunction<O,D> |
getDistanceFunction()
Returns the distance function of this metrical index. |
protected List<DistanceEntry<D,E>> |
getSortedEntries(N node,
Integer q)
Sorts the entries of the specified node according to their minimum distance to the specified object. |
protected List<DistanceEntry<D,E>> |
getSortedEntries(N node,
Integer[] ids)
Sorts the entries of the specified node according to their minimum distance to the specified objects. |
private List<DistanceEntry<D,E>> |
getSortedEntries(N node,
List<Integer> ids)
Sorts the entries of the specified node according to their minimum distance to the specified objects. |
private boolean |
hasOverflow(N node)
Returns true if in the specified node an overflow has occurred, false otherwise. |
protected void |
insert(O object,
boolean withPreInsert)
Inserts the specified object into this M-Tree. |
List<DistanceResultPair<D>> |
kNNQuery(O object,
int k)
Performs a k-nearest neighbor query for the given object with the given parameter k and the according distance function. |
protected void |
postDelete(O o)
Throws an UnsupportedOperationException since deletion of objects is not yet supported by an M-Tree. |
List<DistanceResultPair<D>> |
rangeQuery(O object,
D epsilon)
Performs a range query for the given object with the given epsilon range and the according distance function. |
List<DistanceResultPair<D>> |
rangeQuery(O object,
String epsilon)
Performs a range query for the given object with the given epsilon range and the according distance function. |
void |
setDatabase(Database<O> database)
Sets the database in the distance function of this index (if existing). |
private AbstractMTree.SplitResult |
split(N node)
Splits the specified node and returns the split result. |
String |
toString()
Returns a string representation of this M-Tree by performing a breadth first enumeration on the tree and adding the string representation of the visited nodes and their entries to the result. |
| Methods inherited from class de.lmu.ifi.dbs.elki.index.tree.metrical.MetricalIndex |
|---|
reverseKNNQuery |
| Methods inherited from class de.lmu.ifi.dbs.elki.index.tree.TreeIndex |
|---|
close, createHeader, createNewDirectoryNode, createNewLeafNode, createRootEntry, getFileName, getLogicalPageAccess, getNode, getNode, getNodeClass, getPhysicalReadAccess, getPhysicalWriteAccess, getRoot, getRootEntry, getRootPath, initialize, initializeCapacities, initializeFromFile, preInsert, resetPageAccess |
| Methods inherited from class de.lmu.ifi.dbs.elki.logging.AbstractLoggable |
|---|
debugFine, debugFiner, debugFinest, exception, progress, verbose, warning |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface de.lmu.ifi.dbs.elki.index.Index |
|---|
insert, insert |
| Field Detail |
|---|
protected static final boolean extraIntegrityChecks
public static final OptionID DISTANCE_FUNCTION_ID
DISTANCE_FUNCTION_PARAM
protected final ObjectParameter<DistanceFunction<O extends DatabaseObject,D extends Distance<D>>> DISTANCE_FUNCTION_PARAM
DistanceFunction.
Key: -mtree.distancefunction
Default value:
EuclideanDistanceFunction
private DistanceFunction<O extends DatabaseObject,D extends Distance<D>> distanceFunction
DISTANCE_FUNCTION_PARAM.
| Constructor Detail |
|---|
public AbstractMTree(Parameterization config)
Parameterizable
config - Parameterization| Method Detail |
|---|
public final boolean delete(O o)
o - the object to be deleted
UnsupportedOperationException - thrown, since deletions aren't implemented yet.protected final void postDelete(O o)
postDelete in class TreeIndex<O extends DatabaseObject,N extends AbstractMTreeNode<O,D,N,E>,E extends MTreeEntry<D>>o - the object to be deleted
UnsupportedOperationException
public final List<DistanceResultPair<D>> rangeQuery(O object,
String epsilon)
MetricalIndex
rangeQuery in class MetricalIndex<O extends DatabaseObject,D extends Distance<D>,N extends AbstractMTreeNode<O,D,N,E>,E extends MTreeEntry<D>>object - the query objectepsilon - the string representation of the query range
public final List<DistanceResultPair<D>> rangeQuery(O object,
D epsilon)
MetricalIndex
rangeQuery in class MetricalIndex<O extends DatabaseObject,D extends Distance<D>,N extends AbstractMTreeNode<O,D,N,E>,E extends MTreeEntry<D>>object - the query objectepsilon - the string representation of the query range
public final List<DistanceResultPair<D>> kNNQuery(O object,
int k)
MetricalIndex
kNNQuery in class MetricalIndex<O extends DatabaseObject,D extends Distance<D>,N extends AbstractMTreeNode<O,D,N,E>,E extends MTreeEntry<D>>object - the query objectk - the number of nearest neighbors to be returned
public final DistanceFunction<O,D> getDistanceFunction()
MetricalIndex
getDistanceFunction in class MetricalIndex<O extends DatabaseObject,D extends Distance<D>,N extends AbstractMTreeNode<O,D,N,E>,E extends MTreeEntry<D>>public String toString()
toString in class Objectpublic final void setDatabase(Database<O> database)
Index
database - the database
protected final void insert(O object,
boolean withPreInsert)
object - the object to be insertedwithPreInsert - if this flag is true, the preInsert method will be
called before inserting the objectprotected final void createEmptyRoot(O object)
TreeIndex
createEmptyRoot in class TreeIndex<O extends DatabaseObject,N extends AbstractMTreeNode<O,D,N,E>,E extends MTreeEntry<D>>object - an object that will be stored in the index
protected final void doKNNQuery(Integer q,
KNNList<D> knnList)
q - the id of the query objectknnList - the query result list
private TreeIndexPath<E> choosePath(Integer objectID,
TreeIndexPath<E> subtree)
subtree - the subtree to be tested for insertionobjectID - the id of the object to be inserted
protected final void batchNN(N node,
List<Integer> ids,
Map<Integer,KNNList<D>> knnLists)
node - the node reprsenting the subtree on which the query should be
performedids - the ids of th query objectsknnLists - the knn lists of the query objcets
protected final List<DistanceEntry<D,E>> getSortedEntries(N node,
Integer q)
node - the nodeq - the id of the object
protected final List<DistanceEntry<D,E>> getSortedEntries(N node,
Integer[] ids)
node - the nodeids - the ids of the objects
protected final D distance(Integer id1,
Integer id2)
id1 - the first idid2 - the second id
protected abstract E createNewLeafEntry(O object,
D parentDistance)
object - the data object to be represented by the new entryparentDistance - the distance from the object to the routing object of
the parent node
protected abstract E createNewDirectoryEntry(N node,
Integer routingObjectID,
D parentDistance)
node - the node to be represented by the new entryroutingObjectID - the id of the routing object of the nodeparentDistance - the distance from the routing object of the node to
the routing object of the parent node
private AbstractMTree.SplitResult split(N node)
node - the node to be split
private List<DistanceEntry<D,E>> getSortedEntries(N node,
List<Integer> ids)
node - the nodeids - the ids of the objects
private void doRangeQuery(Integer o_p,
N node,
Integer q,
D r_q,
List<DistanceResultPair<D>> result)
o_p - the routing object of the specified nodenode - the root of the subtree to be traversedq - the id of the query objectr_q - the query rangeresult - the list holding the query resultsprivate void adjustTree(TreeIndexPath<E> subtree)
subtree - the subtree to be adjustedprivate boolean hasOverflow(N node)
node - the node to be tested for overflow
private TreeIndexPath<E> createNewRoot(N oldRoot,
N newNode,
Integer firstRoutingObjectID,
Integer secondRoutingObjectID)
oldRoot - the old root of this RTreenewNode - the new split nodefirstRoutingObjectID - the id of the routing objects of the first
child nodesecondRoutingObjectID - the id of the routing objects of the second
child node
|
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||||