use of de.lmu.ifi.dbs.elki.index.tree.spatial.rstarvariants.deliclu.DeLiCluNode in project elki by elki-project.
the class DeLiClu method expandNodes.
/**
* Expands the spatial nodes of the specified pair.
*
* @param index the index storing the objects
* @param distFunction the spatial distance function of this algorithm
* @param nodePair the pair of nodes to be expanded
* @param knns the knn list
*/
private void expandNodes(DeLiCluTree index, SpatialPrimitiveDistanceFunction<NV> distFunction, SpatialObjectPair nodePair, Relation<KNNList> knns) {
DeLiCluNode node1 = index.getNode(((SpatialDirectoryEntry) nodePair.entry1).getPageID());
DeLiCluNode node2 = index.getNode(((SpatialDirectoryEntry) nodePair.entry2).getPageID());
if (node1.isLeaf()) {
expandLeafNodes(distFunction, node1, node2, knns);
} else {
expandDirNodes(distFunction, node1, node2);
}
index.setExpanded(nodePair.entry2, nodePair.entry1);
}
use of de.lmu.ifi.dbs.elki.index.tree.spatial.rstarvariants.deliclu.DeLiCluNode in project elki by elki-project.
the class DeLiClu method reinsertExpanded.
private void reinsertExpanded(SpatialPrimitiveDistanceFunction<NV> distFunction, DeLiCluTree index, List<IndexTreePath<DeLiCluEntry>> path, int pos, DeLiCluEntry parentEntry, Relation<KNNList> knns) {
DeLiCluNode parentNode = index.getNode(parentEntry);
SpatialEntry entry2 = path.get(pos).getEntry();
if (entry2 instanceof LeafEntry) {
assert (pos == 0);
for (int i = 0; i < parentNode.getNumEntries(); i++) {
DeLiCluEntry entry1 = parentNode.getEntry(i);
if (entry1.hasHandled()) {
continue;
}
double distance = distFunction.minDist(entry1, entry2);
double reach = MathUtil.max(distance, knns.get(((LeafEntry) entry2).getDBID()).getKNNDistance());
SpatialObjectPair dataPair = new SpatialObjectPair(reach, entry1, entry2, false);
heap.add(dataPair);
}
return;
}
IntSet expanded = index.getExpanded(entry2);
for (int i = 0; i < parentNode.getNumEntries(); i++) {
DeLiCluDirectoryEntry entry1 = (DeLiCluDirectoryEntry) parentNode.getEntry(i);
// not yet expanded
if (!expanded.contains(entry1.getPageID())) {
double distance = distFunction.minDist(entry1, entry2);
SpatialObjectPair nodePair = new SpatialObjectPair(distance, entry1, entry2, true);
heap.add(nodePair);
} else // already expanded
{
reinsertExpanded(distFunction, index, path, pos - 1, entry1, knns);
}
}
}
Aggregations