def _build_pair(c1, c2, fence)
      pair = fence.nil? ? Pair.new(c1, c2) : FencedPair.new(c1, c2, fence)

      if DENSITY_BIAS_FACTOR && (@max_density != @min_density)
        # the least dense cluster pairs have a density_bias value close to 0, the densest closer to 1
        density_bias = (c1.density + c2.density - 2 * @min_density) / (2 * (@max_density - @min_density))
        # this makes dense clusters appear closer, and vice-versa
        pair.distance = pair.distance * (1 + DENSITY_BIAS_FACTOR * (1 - density_bias) - 0.5 * DENSITY_BIAS_FACTOR)
      end
      pair
    end
def _build_pair(c1, c2, fence)
      pair = fence.nil? ? Pair.new(c1, c2) : FencedPair.new(c1, c2, fence)

      if DENSITY_BIAS_FACTOR && (@max_density != @min_density)
        # the least dense cluster pairs have a density_bias value close to 0, the densest closer to 1
        density_bias = (c1.density + c2.density - 2 * @min_density) / (2 * (@max_density - @min_density))
        # this makes dense clusters appear closer, and vice-versa
        pair.distance = pair.distance * (1 + DENSITY_BIAS_FACTOR * (1 - density_bias) - 0.5 * DENSITY_BIAS_FACTOR)
      end
      pair
    end
factory for pairs, switches between fenced/unfenced
 and conditionnaly adds density bias