예제 #1
0
 /**
  * Add the point <code>p</code> to the cluster and expand the cluster using the neighbors of
  * MatchPoint <code>p</code>
  *
  * @param p the MatchPoint to expand upon
  * @param clust
  */
 private void expandClusters(MatchPoint p, Set<MatchPoint> clust) {
   clust.add(p);
   p.setAssigned();
   Vector<MatchPoint> neighbors = new Vector<MatchPoint>(p.getNeighbors());
   int i = 0;
   while (i < neighbors.size()) {
     MatchPoint tmp = neighbors.get(i);
     if (!tmp.isVisited()) {
       tmp.setVisited();
       if (tmp.size() >= MIN_PTS) neighbors.addAll(tmp.getNeighbors());
     }
     if (!tmp.isAssigned()) {
       clust.add(tmp);
       tmp.setAssigned();
     }
     i++;
   }
 }
예제 #2
0
 /** Run the DBSCAN algorithm */
 private void runDBSCAN() {
   Iterator<MatchPoint> it = currPoints.iterator();
   Set<MatchPoint> currClust = null;
   MatchPoint tmp = null;
   while (it.hasNext()) {
     tmp = it.next();
     if (tmp.isVisited()) continue;
     if (tmp.size() < MIN_PTS) {
       tmp.setNoise();
       tmp.setAssigned();
     } else {
       currClust = new TreeSet<MatchPoint>(xSort);
       expandClusters(tmp, currClust);
       readPairClusters.add(new ReadCluster(currClust));
     }
     tmp.setVisited();
   }
 }