function [ d ] = diamd( D )
%DIAMD  calculates the network diameter
%
%   AVL(D)  returns the diameter (as of longest geodesic)
%       of the network given by its distance matrix D
%
%  Last change:  10/2/2005 - Florian Knorn

if nargin ~= 1
    error('Please input distance matrix !');
end
if islogical( D )
	error('How can D be of type LOGICAL ? Adjacency matrix ?');
end

d = max(max(unpenalize(D)));