diameter

0th

Percentile

Diameter of a graph

The diameter of a graph is the length of the longest geodesic.

Keywords
graphs
Usage
diameter(graph, directed = TRUE, unconnected = TRUE)
Arguments
graph
The graph to analyize.
directed
Logical, whether directed or undirected paths are to be considered. This is ignored for undirected graphs.
unconnected
Logical, what to do if the graph is unconnected. If FALSE, the function will return the largest possible diameter which is the number of vertices. If TRUE, the diameters of the connected components will be calculated and the largest one will b
Details

The diameter is calculated by using a breadth-first search like method.

Value

  • A numeric constant.

See Also

shortest.paths

Aliases
  • diameter
Examples
g <- graph.ring(10)
g2 <- delete.edges(g, c(0,1,0,9))
diameter(g2, unconnected=TRUE)
diameter(g2, unconnected=FALSE)
Documentation reproduced from package igraph, version 0.1.2, License: GPL version 2 or later (June, 1991)

Community examples

Looks like there are no examples yet.