MATLAB: Calculating a Network’s Diameter

MATLABneural networkstatistics

Hi everyone,
I have a graph, G on which I have a applied the distances function such that
d=distances(G);
to get the matrix of shortest path distances between every node pair.
I would like someone to verify that the network diameter can be calculated as
max(d);
and the mean path length of the network as
mean(mean(d));

Best Answer

mean(d(:))
Hope this helps
Thank you for formally accepting my answer
Greg