Warning

This documents an unmaintained version of NetworkX. Please upgrade to a maintained version and see the current NetworkX documentation.

networkx.algorithms.distance_measures.diameter

diameter(G, e=None, usebounds=False)[source]

Return the diameter of the graph G.

The diameter is the maximum eccentricity.

Parameters:
  • G (NetworkX graph) – A graph
  • e (eccentricity dictionary, optional) – A precomputed dictionary of eccentricities.
Returns:

d – Diameter of graph

Return type:

integer

See also

eccentricity()