GraphDiameter
GraphDiameter[g] gives the greatest distance between any pair of vertices in the graph g.
GraphDiameter[{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.