code: def synteny_scan(points, xdist, ydist, N):
      
      clusters = Grouper()
      n = len(points)
      points.sort()
      for i in range(n):
          for j in range(i - 1, -1, -1):
              # x-axis distance
              del_x = points[i][0] - points[j][0]
              if del_x > xdist:
                  break
              # y-axis distance
              del_y = points[i][1] - points[j][1]
              if abs(del_y) > ydist:
                  continue
              # otherwise join
              clusters.join(points[i], points[j])
  
      # select clusters that are at least >=N
      clusters = [sorted(cluster) for cluster in list(clusters) \
              if _score(cluster) >= N]
  
      return clusters
docs: This is the core single linkage algorithm which behaves in O(n):
      iterate through the pairs, foreach pair we look back on the
      adjacent pairs to find links