`diameter(g, dist = NULL)`

g

a graph as a graphNEL object.

dist

the distance matrix of the graph. If the parameter is empty the distance matrix will be calculated within the function.

library(RBGL) set.seed(123) g <- randomGraph(1:8, 1:5, 0.36, weights=FALSE) diameter(g)