use of de.lmu.ifi.dbs.elki.index.tree.BreadthFirstEnumeration in project elki by elki-project.
the class AbstractXTree method toString.
/**
* Returns a string representation of this XTree.
*
* @return a string representation of this XTree
*/
@Override
public String toString() {
long dirNodes = 0;
long superNodes = 0;
long leafNodes = 0;
long objects = 0;
long maxSuperCapacity = -1;
long minSuperCapacity = Long.MAX_VALUE;
BigInteger totalCapacity = BigInteger.ZERO;
int levels = 0;
N node = getRoot();
while (!node.isLeaf()) {
if (node.getNumEntries() > 0) {
SpatialEntry entry = node.getEntry(0);
node = getNode(entry);
levels++;
}
}
BreadthFirstEnumeration<N, SpatialEntry> enumeration = new BreadthFirstEnumeration<>(this, getRootPath());
while (enumeration.hasNext()) {
IndexTreePath<SpatialEntry> indexPath = enumeration.next();
SpatialEntry entry = indexPath.getEntry();
if (entry instanceof LeafEntry) {
objects++;
} else {
node = getNode(entry);
if (node.isLeaf()) {
leafNodes++;
} else {
if (node.isSuperNode()) {
superNodes++;
if (node.getCapacity() > maxSuperCapacity) {
maxSuperCapacity = node.getCapacity();
}
if (node.getCapacity() < minSuperCapacity) {
minSuperCapacity = node.getCapacity();
}
} else {
dirNodes++;
}
}
totalCapacity = totalCapacity.add(BigInteger.valueOf(node.getCapacity()));
}
}
assert objects == num_elements : "objects=" + objects + ", size=" + num_elements;
return //
new StringBuilder(10000).append(getClass().getName()).append(" has ").append((levels + 1)).append(" levels.\n").append(dirNodes).append(" Directory Nodes (max = ").append(dirCapacity - 1).append(", min = ").append(dirMinimum).append(//
")\n").append(superNodes).append(" Supernodes (max = ").append(maxSuperCapacity - 1).append(", min = ").append(minSuperCapacity - 1).append(//
")\n").append(leafNodes).append(" Data Nodes (max = ").append(leafCapacity - 1).append(", min = ").append(leafMinimum).append(//
")\n").append(objects).append(' ').append(dimensionality).append(//
"-dim. points in the tree \n").append("min_fanout = ").append(settings.min_fanout).append(", max_overlap = ").append(settings.max_overlap).append((settings.overlap_type == Overlap.DATA_OVERLAP ? " data overlap" : " volume overlap")).append(//
", \n").append("Storage Quota ").append(BigInteger.valueOf(objects + dirNodes + superNodes + leafNodes).multiply(BigInteger.valueOf(100)).divide(totalCapacity).toString()).append(//
"%\n").toString();
}
Aggregations