GraphDiameter

GraphDiameter[g]

gives the greatest distance between any pair of vertices in the graph g.

GraphDiameter[{vw,}]

uses rules vw to specify the graph g.

Details and Options

  • The following options can be given:
  • EdgeWeightAutomaticweight for each edge
    MethodAutomaticmethod to use
  • With the default setting EdgeWeight->Automatic, the edge weight of an edge is taken to be the EdgeWeight of the graph g if available; otherwise, it is 1.
  • Possible Method settings include "Dijkstra", "FloydWarshall", "Johnson", and "PseudoDiameter".

Examples

open allclose all

Basic Examples  (1)

Give the graph diameter for a complete graph:

In[1]:=
Click for copyable input
Out[1]=

Scope  (7)

Applications  (1)

Properties & Relations  (4)

See Also

VertexEccentricity  GraphRadius  GraphPeriphery  GraphCenter  GraphDistanceMatrix

Introduced in 2010
(8.0)
| Updated in 2015
(10.3)