Graph Diameter

DOWNLOAD Mathematica Notebook GraphDiameter

The graph diameter of a graph is the length max_(u,v)d(u,v) of the "longest shortest path" (i.e., the longest graph geodesic) between any two graph vertices (u,v), where d(u,v) is a graph distance. In other words, a graph's diameter is the largest number of vertices which must be traversed in order to travel from one vertex to another when paths which backtrack, detour, or loop are excluded from consideration. It is therefore equal to the maximum of all values in the graph distance matrix. The above random graphs on 10 vertices have diameters 3, 4, 5, and 7, respectively.

A disconnected graph has infinite diameter (West 2000, p. 71).

The diameter of a graph may be computed in the Wolfram Language using GraphDiameter[g], and a fast approximation to the diameter by GraphDiameter[g, Method -> "PseudoDiameter"]. Precomputed diameters for many named graphs can be obtained using GraphData[graph, "Diameter"].

Wolfram Web Resources

Mathematica »

The #1 tool for creating Demonstrations and anything technical.

Wolfram|Alpha »

Explore anything with the first computational knowledge engine.

Wolfram Demonstrations Project »

Explore thousands of free applications across science, mathematics, engineering, technology, business, art, finance, social sciences, and more.

Computerbasedmath.org »

Join the initiative for modernizing math education.

Online Integral Calculator »

Solve integrals with Wolfram|Alpha.

Step-by-step Solutions »

Walk through homework problems step-by-step from beginning to end. Hints help you try the next step on your own.

Wolfram Problem Generator »

Unlimited random practice problems and answers with built-in Step-by-step solutions. Practice online or make a printable study sheet.

Wolfram Education Portal »

Collection of teaching and learning tools built by Wolfram education experts: dynamic textbook, lesson plans, widgets, interactive Demonstrations, and more.

Wolfram Language »

Knowledge-based programming for everyone.