GraphDistanceMatrix
GraphDistanceMatrix[g] gives the matrix of distances between vertices for the graph g.
GraphDistanceMatrix[g,d] gives the matrix of distances between vertices of maximal distance d in the graph g.
GraphDistanceMatrix[{v->w,…},…] uses rules v->w to specify the graph g.
Please visit the official Wolfram Language Reference for more details and examples on core symbols.