Note similarity to matrix multiplication:
In fact, our algorithm for computing D involves ``multiplying'' the adjacency matrix by itself n-1 times.