Search in sources :

Example 1 with DeLiCluDirectoryEntry

use of de.lmu.ifi.dbs.elki.index.tree.spatial.rstarvariants.deliclu.DeLiCluDirectoryEntry 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);
        }
    }
}
Also used : DeLiCluEntry(de.lmu.ifi.dbs.elki.index.tree.spatial.rstarvariants.deliclu.DeLiCluEntry) LeafEntry(de.lmu.ifi.dbs.elki.index.tree.LeafEntry) IntSet(it.unimi.dsi.fastutil.ints.IntSet) DeLiCluDirectoryEntry(de.lmu.ifi.dbs.elki.index.tree.spatial.rstarvariants.deliclu.DeLiCluDirectoryEntry) DeLiCluNode(de.lmu.ifi.dbs.elki.index.tree.spatial.rstarvariants.deliclu.DeLiCluNode) SpatialEntry(de.lmu.ifi.dbs.elki.index.tree.spatial.SpatialEntry)

Aggregations

LeafEntry (de.lmu.ifi.dbs.elki.index.tree.LeafEntry)1 SpatialEntry (de.lmu.ifi.dbs.elki.index.tree.spatial.SpatialEntry)1 DeLiCluDirectoryEntry (de.lmu.ifi.dbs.elki.index.tree.spatial.rstarvariants.deliclu.DeLiCluDirectoryEntry)1 DeLiCluEntry (de.lmu.ifi.dbs.elki.index.tree.spatial.rstarvariants.deliclu.DeLiCluEntry)1 DeLiCluNode (de.lmu.ifi.dbs.elki.index.tree.spatial.rstarvariants.deliclu.DeLiCluNode)1 IntSet (it.unimi.dsi.fastutil.ints.IntSet)1