Code covered by the BSD License  

Highlights from
Matgraph

from Matgraph by Ed Scheinerman
Toolbox for working with simple, undirected graphs

Description of diam
Home > matgraph > @graph > diam.m

diam

PURPOSE ^

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)));

Generated on Thu 13-Mar-2008 14:23:52 by m2html © 2003

Contact us at files@mathworks.com