added function to compute dyadic distance between all pairs over time