implementation of diameter