/** * Returns the number of objects in the subtree including the objects at the current node. Note * that objects can occur more than once and are counted as such. To get the number of distinct * objects use the getObjectsInSubtree function first and use the resulting list to calculate the * number of distinct objects. * * @return number of objects */ public int getNumberOfExamplesInSubtree() { int subtreeSum = 0; for (HierarchicalClusterNode subNode : subNodes) { subtreeSum += subNode.getNumberOfExamplesInSubtree(); } return subtreeSum; }