private static <M extends Model> void findDepth(Hierarchy<Cluster<M>> hier, Cluster<M> cluster, int[] size) {
    if(hier.numChildren(cluster) > 0) {
      for(It<Cluster<M>> iter = hier.iterChildren(cluster); iter.valid(); iter.advance()) {
        findDepth(hier, iter.get(), size);
      }
      size[0] += 1; // Depth
    }
    else {
      size[1] += 1; // Leaves
    }
  }
private static < M extends Model > void findDepth ( Hierarchy < Cluster < M > > hier , Cluster < M > cluster , int [ ] size ) { if ( hier . numChildren ( cluster ) > 0 ) { for ( It < Cluster < M > > iter = hier . iterChildren ( cluster ) ; iter . valid ( ) ; iter . advance ( ) ) { findDepth ( hier , iter . get ( ) , size ) ; } size [ 0 ] += 1 ; } else { size [ 1 ] += 1 ; } }
Recursive depth computation.

@param hier Hierarchy
@param cluster Current cluster
@param size Counting array.