Add basic version of diameter computation.

Warning: does not currently work.