GraphDistance
GraphDistance[g,s,t] gives the distance from source vertex s to target vertex t in the graph g.
GraphDistance[g,s] gives the distance from s to all vertices of the graph g.
GraphDistance[{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.