relatedness_mat function

Calculate a relatedness matrix