Learn R Programming

QuACN (version 1.8.0)

diameter: Diameter

Description

This method calculates the diameter of a given graph.

Usage

diameter(g, dist = NULL)

Arguments

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.

Value

References

F. Harary, Graph Theory, Addison-Wesley series in mathematics, Perseus Books, 1994.

Examples

Run this code

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

diameter(g)

Run the code above in your browser using DataLab