code: protected static <T> double initialWeights(WritableDoubleDataStore weights, Relation<? extends T> relation, DBIDs ids, T first, T second, DistanceQuery<? super T> distQ) {
      double weightsum = 0.;
      for(DBIDIter it = ids.iter(); it.valid(); it.advance()) {
        // distance will usually already be squared
        T v = relation.get(it);
        double weight = Math.min(distQ.distance(first, v), distQ.distance(second, v));
        weights.putDouble(it, weight);
        weightsum += weight;
      }
      return weightsum;
    }
docs: Initialize the weight list.
  
  @param weights Weight list
  @param ids IDs
  @param relation Data relation
  @param first First ID
  @param second Second ID
  @param distQ Distance query
  @return Weight sum
  @param <T> Object type