diameter               package:igraph               R Documentation

_D_i_a_m_e_t_e_r _o_f _a _g_r_a_p_h

_D_e_s_c_r_i_p_t_i_o_n:

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

_U_s_a_g_e:

     diameter(graph, directed = TRUE, unconnected = TRUE)
     get.diameter (graph, directed = TRUE, unconnected = TRUE) 
     farthest.nodes (graph, directed = TRUE, unconnected = TRUE) 

_A_r_g_u_m_e_n_t_s:

   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 be returned.

_D_e_t_a_i_l_s:

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

     'get.diameter' returns a path with the actual diameter. If there
     are many shortest paths of the length of the diameter, then it
     returns the first one found.

     'farthest.points' returns two vertex ids, the vertices which are
     connected by the diameter path.

_V_a_l_u_e:

     A numeric constant for 'diameter', a numeric vector for
     'get.diameter' and a numeric vector of length two for
     'farthest.nodes'.

_A_u_t_h_o_r(_s):

     Gabor Csardi csardi@rmki.kfki.hu

_S_e_e _A_l_s_o:

     'shortest.paths'

_E_x_a_m_p_l_e_s:

     g <- graph.ring(10)
     g2 <- delete.edges(g, c(0,1,0,9))
     diameter(g2, unconnected=TRUE)
     diameter(g2, unconnected=FALSE)

