diam(g) --- return the diameter of g: the length of a longest shortest
SYNOPSIS
function d = diam(g)
DESCRIPTION
diam(g) --- return the diameter of g: the length of a longest shortest
path in g, or Inf if g is not connected.
CROSS-REFERENCE INFORMATION
This function calls:
dist dist(g,v,w) and dist(g,v) --- find distance(s) between vertices
This function is called by:
SOURCE CODE
0001 function d = diam(g)
0002 % diam(g) --- return the diameter of g: the length of a longest shortest
0003 % path in g, or Inf if g is not connected.
0004
0005 d = max(max(dist(g)));