def number_of_links(neighbors, datapoints, x, y)
      (0..datapoints.size-1).map do |i|
        neighbors.lookup(x,i) * neighbors.lookup(i,y)
      end.inject(0) {|m,v| m+v}
    end
def number_of_links(neighbors, datapoints, x, y)
      (0..datapoints.size-1).map do |i|
        neighbors.lookup(x,i) * neighbors.lookup(i,y)
      end.inject(0) {|m,v| m+v}
    end
0  1  2  3
   ------------
 0 | Y  -  Y  -
 1 | -  Y  -  -
 2 | -  -  -  -
 3 | -  Y  -  -