protected ArrayList<ArrayList<DBIDs>> buildRanges(Relation<V> relation){
  final int dim=RelationUtil.dimensionality(relation);
  final int size=relation.size();
  final ArrayList<ArrayList<DBIDs>> ranges=new ArrayList<>();
  ArrayModifiableDBIDs ids=DBIDUtil.newArray(relation.getDBIDs());
  SortDBIDsBySingleDimension sorter=new SortDBIDsBySingleDimension(relation);
  final double part=size * 1.0 / phi;
  for (int d=0; d < dim; d++) {
    sorter.setDimension(d);
    ids.sort(sorter);
    ArrayList<DBIDs> dimranges=new ArrayList<>(phi + 1);
    int start=0;
    DBIDArrayIter iter=ids.iter();
    for (int r=1; r <= phi; r++) {
      int end=(r < phi) ? (int)(part * r) : size;
      ArrayModifiableDBIDs currange=DBIDUtil.newArray(end - start);
      for (iter.seek(start); iter.getOffset() < end; iter.advance()) {
        currange.add(iter);
      }
      start=end;
      dimranges.add(currange);
    }
    ranges.add(dimranges);
  }
  return ranges;
}

protected ArrayList < ArrayList < DBIDs > > buildRanges ( Relation < V > relation ) { final int dim = RelationUtil . dimensionality ( relation ) ; final int size = relation . size ( ) ; final ArrayList < ArrayList < DBIDs > > ranges = new ArrayList < > ( ) ; ArrayModifiableDBIDs ids = DBIDUtil . newArray ( relation . getDBIDs ( ) ) ; SortDBIDsBySingleDimension sorter = new SortDBIDsBySingleDimension ( relation ) ; final double part = size * 1.0 / phi ; for ( int d = 0 ; d < dim ; d ++ ) { sorter . setDimension ( d ) ; ids . sort ( sorter ) ; ArrayList < DBIDs > dimranges = new ArrayList < > ( phi + 1 ) ; int start = 0 ; DBIDArrayIter iter = ids . iter ( ) ; for ( int r = 1 ; r <= phi ; r ++ ) { int end = ( r < phi ) ? ( int ) ( part * r ) : size ; ArrayModifiableDBIDs currange = DBIDUtil . newArray ( end - start ) ; for ( iter . seek ( start ) ; iter . getOffset ( ) < end ; iter . advance ( ) ) { currange . add ( iter ) ; } start = end ; dimranges . add ( currange ) ; } ranges . add ( dimranges ) ; } return ranges ; }
grid discretization of the data : < br / > each attribute of data is divided into phi equi - depth ranges . < br / > each range contains a fraction f = 1 / phi of the records .
