private Cluster<T> expandCluster(final Cluster<T> cluster,final T point,final List<T> neighbors,final Collection<T> points,final Map<Clusterable,PointStatus> visited){
  cluster.addPoint(point);
  visited.put(point,PointStatus.PART_OF_CLUSTER);
  List<T> seeds=new ArrayList<T>(neighbors);
  int index=0;
  while (index < seeds.size()) {
    final T current=seeds.get(index);
    PointStatus pStatus=visited.get(current);
    if (pStatus == null) {
      final List<T> currentNeighbors=getNeighbors(current,points);
      if (currentNeighbors.size() >= minPts) {
        seeds=merge(seeds,currentNeighbors);
      }
    }
    if (pStatus != PointStatus.PART_OF_CLUSTER) {
      visited.put(current,PointStatus.PART_OF_CLUSTER);
      cluster.addPoint(current);
    }
    index++;
  }
  return cluster;
}

private Cluster < T > expandCluster ( final Cluster < T > cluster , final T point , final List < T > neighbors , final Collection < T > points , final Map < Clusterable , PointStatus > visited ) { cluster . addPoint ( point ) ; visited . put ( point , PointStatus . PART_OF_CLUSTER ) ; List < T > seeds = new ArrayList < T > ( neighbors ) ; int index = 0 ; while ( index < seeds . size ( ) ) { final T current = seeds . get ( index ) ; PointStatus pStatus = visited . get ( current ) ; if ( pStatus == null ) { final List < T > currentNeighbors = getNeighbors ( current , points ) ; if ( currentNeighbors . size ( ) >= minPts ) { seeds = merge ( seeds , currentNeighbors ) ; } } if ( pStatus != PointStatus . PART_OF_CLUSTER ) { visited . put ( current , PointStatus . PART_OF_CLUSTER ) ; cluster . addPoint ( current ) ; } index ++ ; } return cluster ; }
expands the cluster to include density - reachable items .
