|
|
|||||||||||||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object de.lmu.ifi.dbs.elki.logging.AbstractLoggable de.lmu.ifi.dbs.elki.utilities.optionhandling.AbstractParameterizable 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,MkTabTreeNode<O,D>,MkTabEntry<D>> de.lmu.ifi.dbs.elki.index.tree.metrical.mtreevariants.mktab.MkTabTree<O,D>
public class MkTabTree<O extends DatabaseObject,D extends Distance<D>>
MkMaxTree is a metrical index structure based on the concepts of the M-Tree supporting efficient processing of reverse k nearest neighbor queries for parameter k < kmax. All knn distances for k <= kmax are stored in each entry of a node.
Field Summary | |
---|---|
static String |
K_D
Description for parameter k. |
(package private) int |
k_max
Parameter k. |
static String |
K_P
Parameter k. |
Fields inherited from class de.lmu.ifi.dbs.elki.index.tree.metrical.mtreevariants.AbstractMTree |
---|
DEFAULT_DISTANCE_FUNCTION, DISTANCE_FUNCTION_D, DISTANCE_FUNCTION_P |
Fields inherited from class de.lmu.ifi.dbs.elki.index.tree.TreeIndex |
---|
CACHE_SIZE_D, CACHE_SIZE_P, cacheSize, DEFAULT_CACHE_SIZE, DEFAULT_PAGE_SIZE, dirCapacity, dirMinimum, file, FILE_NAME_D, FILE_NAME_P, initialized, leafCapacity, leafMinimum, PAGE_SIZE_D, PAGE_SIZE_P, pageSize |
Fields inherited from class de.lmu.ifi.dbs.elki.utilities.optionhandling.AbstractParameterizable |
---|
optionHandler |
Fields inherited from class de.lmu.ifi.dbs.elki.logging.AbstractLoggable |
---|
debug |
Constructor Summary | |
---|---|
MkTabTree()
Creates a new MkNNTabTree. |
Method Summary | |
---|---|
private void |
adjustKNNDistances(MkTabEntry<D> entry,
Map<Integer,KNNList<D>> knnLists)
Adjusts the knn distance in the subtree of the specified root entry. |
protected TreeIndexHeader |
createHeader()
Creates a header for this index structure. |
protected MkTabEntry<D> |
createNewDirectoryEntry(MkTabTreeNode<O,D> node,
Integer routingObjectID,
D parentDistance)
Creates a new directory entry representing the specified node. |
protected MkTabTreeNode<O,D> |
createNewDirectoryNode(int capacity)
Creates a new directory node with the specified capacity. |
protected MkTabEntry<D> |
createNewLeafEntry(O object,
D parentDistance)
Creates a new leaf entry representing the specified data object in the specified subtree. |
protected MkTabTreeNode<O,D> |
createNewLeafNode(int capacity)
Creates a new leaf node with the specified capacity. |
protected MkTabEntry<D> |
createRootEntry()
Creates an entry representing the root node. |
private void |
doReverseKNNQuery(int k,
Integer q,
MkTabEntry<D> node_entry,
MkTabTreeNode<O,D> node,
List<QueryResult<D>> result)
Performs a k-nearest neighbor query in the specified subtree for the given query object and the given parameter k. |
protected void |
initCapacity(O object)
Determines the maximum and minimum number of entries in a node. |
private List<D> |
initKnnDistanceList()
Retuns a knn distance list with all distances set to null distance. |
void |
insert(List<O> objects)
Inserts the specified objects into this MDkNNTree-Tree. |
void |
insert(O object)
Inserts the specified object into this MDkNNTree-Tree. |
private List<D> |
knnDistances(Integer objectID)
Returns the knn distance of the object with the specified id. |
private List<D> |
max(List<D> distances1,
List<D> distances2)
Returns an array that holds the maximum values of the both specified arrays in each index. |
protected void |
preInsert(MkTabEntry<D> entry)
Performs necessary operations before inserting the specified entry. |
List<QueryResult<D>> |
reverseKNNQuery(O object,
int k)
Performs a reverse k-nearest neighbor query for the given object ID. |
String[] |
setParameters(String[] args)
Sets the attributes of the class accordingly to the given parameters. |
Methods inherited from class de.lmu.ifi.dbs.elki.index.tree.metrical.mtreevariants.AbstractMTree |
---|
batchNN, choosePath, createEmptyRoot, delete, distance, doKNNQuery, getAttributeSettings, getDistanceFunction, getSortedEntries, getSortedEntries, initializeCapacities, insert, kNNQuery, postDelete, rangeQuery, setDatabase, toString |
Methods inherited from class de.lmu.ifi.dbs.elki.index.tree.TreeIndex |
---|
close, description, getLogicalPageAccess, getNode, getNode, getPhysicalReadAccess, getPhysicalWriteAccess, getRoot, getRootEntry, getRootPath, initialize, initializeFromFile, resetPageAccess |
Methods inherited from class de.lmu.ifi.dbs.elki.utilities.optionhandling.AbstractParameterizable |
---|
addOption, checkGlobalParameterConstraints, deleteOption, description, description, getParameters, getParameterValue, getPossibleOptions, inlineDescription, isSet, setParameters |
Methods inherited from class de.lmu.ifi.dbs.elki.logging.AbstractLoggable |
---|
debugFine, debugFiner, debugFinest, exception, message, progress, progress, progress, verbose, 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.utilities.optionhandling.Parameterizable |
---|
checkGlobalParameterConstraints, getParameters, getPossibleOptions, inlineDescription |
Field Detail |
---|
public static final String K_P
public static final String K_D
int k_max
Constructor Detail |
---|
public MkTabTree()
Method Detail |
---|
protected void preInsert(MkTabEntry<D> entry)
preInsert
in class TreeIndex<O extends DatabaseObject,MkTabTreeNode<O extends DatabaseObject,D extends Distance<D>>,MkTabEntry<D extends Distance<D>>>
entry
- the entry to be insertedpublic void insert(O object)
insert
in interface Index<O extends DatabaseObject>
insert
in class AbstractMTree<O extends DatabaseObject,D extends Distance<D>,MkTabTreeNode<O extends DatabaseObject,D extends Distance<D>>,MkTabEntry<D extends Distance<D>>>
object
- the object to be insertedpublic void insert(List<O> objects)
insert
in interface Index<O extends DatabaseObject>
insert
in class AbstractMTree<O extends DatabaseObject,D extends Distance<D>,MkTabTreeNode<O extends DatabaseObject,D extends Distance<D>>,MkTabEntry<D extends Distance<D>>>
objects
- the object to be insertedpublic List<QueryResult<D>> reverseKNNQuery(O object, int k)
reverseKNNQuery
in class AbstractMTree<O extends DatabaseObject,D extends Distance<D>,MkTabTreeNode<O extends DatabaseObject,D extends Distance<D>>,MkTabEntry<D extends Distance<D>>>
object
- the query objectk
- the number of nearest neighbors to be returned
public String[] setParameters(String[] args) throws ParameterException
Parameterizable
setParameters
in interface Parameterizable
setParameters
in class AbstractMTree<O extends DatabaseObject,D extends Distance<D>,MkTabTreeNode<O extends DatabaseObject,D extends Distance<D>>,MkTabEntry<D extends Distance<D>>>
args
- parameters to set the attributes accordingly to
ParameterException
- in case of wrong parameter-settingParameterizable.setParameters(String[])
protected TreeIndexHeader createHeader()
createHeader
in class TreeIndex<O extends DatabaseObject,MkTabTreeNode<O extends DatabaseObject,D extends Distance<D>>,MkTabEntry<D extends Distance<D>>>
protected void initCapacity(O object)
object
- a object that is stored in the treeprivate void doReverseKNNQuery(int k, Integer q, MkTabEntry<D> node_entry, MkTabTreeNode<O,D> node, List<QueryResult<D>> result)
k
- the parameter k of the knn-queryq
- the id of the query objectnode_entry
- the entry representing the nodenode
- the root of the subtreeresult
- the list holding the query resultprivate List<D> knnDistances(Integer objectID)
objectID
- the id of the query object
private void adjustKNNDistances(MkTabEntry<D> entry, Map<Integer,KNNList<D>> knnLists)
entry
- the root entry of the current subtreeknnLists
- a map of knn lists for each leaf entryprivate List<D> max(List<D> distances1, List<D> distances2)
distances1
- the first arraydistances2
- the second array
private List<D> initKnnDistanceList()
protected MkTabTreeNode<O,D> createNewLeafNode(int capacity)
createNewLeafNode
in class TreeIndex<O extends DatabaseObject,MkTabTreeNode<O extends DatabaseObject,D extends Distance<D>>,MkTabEntry<D extends Distance<D>>>
capacity
- the capacity of the new node
protected MkTabTreeNode<O,D> createNewDirectoryNode(int capacity)
createNewDirectoryNode
in class TreeIndex<O extends DatabaseObject,MkTabTreeNode<O extends DatabaseObject,D extends Distance<D>>,MkTabEntry<D extends Distance<D>>>
capacity
- the capacity of the new node
protected MkTabEntry<D> createNewLeafEntry(O object, D parentDistance)
createNewLeafEntry
in class AbstractMTree<O extends DatabaseObject,D extends Distance<D>,MkTabTreeNode<O extends DatabaseObject,D extends Distance<D>>,MkTabEntry<D extends Distance<D>>>
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 MkTabEntry<D> createNewDirectoryEntry(MkTabTreeNode<O,D> node, Integer routingObjectID, D parentDistance)
createNewDirectoryEntry
in class AbstractMTree<O extends DatabaseObject,D extends Distance<D>,MkTabTreeNode<O extends DatabaseObject,D extends Distance<D>>,MkTabEntry<D extends Distance<D>>>
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
protected MkTabEntry<D> createRootEntry()
createRootEntry
in class TreeIndex<O extends DatabaseObject,MkTabTreeNode<O extends DatabaseObject,D extends Distance<D>>,MkTabEntry<D extends Distance<D>>>
|
|
||||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |