graph.density             package:igraph             R Documentation

_G_r_a_p_h _d_e_n_s_i_t_y

_D_e_s_c_r_i_p_t_i_o_n:

     The density of a graph is the ratio of the number of edges and the
     number of possible edges.

_U_s_a_g_e:

     graph.density(graph, loops=FALSE)

_A_r_g_u_m_e_n_t_s:

   graph: The input graph.

   loops: Logical constant, whether to allow loop edges in the graph.
          If this is TRUE then self loops are considered to be
          possible. If this is FALSE then we assume that the graph does
          not contain any loop edges and that loop edges are not
          meaningful.

_D_e_t_a_i_l_s:

     Note that this function may return strange results for graph with
     multiple edges, density is ill-defined for graphs with multiple
     edges.

_V_a_l_u_e:

     A real constant. This function returns 'NaN' (=0.0/0.0) for an
     empty graph with zero vertices.

_A_u_t_h_o_r(_s):

     Gabor Csardi csardi@rmki.kfki.hu

_R_e_f_e_r_e_n_c_e_s:

     Wasserman, S., and Faust, K.  (1994).  Social Network Analysis:
     Methods and Applications.  Cambridge: Cambridge University Press.

_S_e_e _A_l_s_o:

     'vcount', 'ecount', 'simplify' to get rid of the multiple and/or
     loop edges.

_E_x_a_m_p_l_e_s:

     g1 <- graph.empty(n=10)
     g2 <- graph.full(n=10)
     g3 <- erdos.renyi.game(n=10, 0.4)

     # loop edges
     g <- graph( c(0,1, 1,1, 1,2) )
     graph.density(g, loops=FALSE)              # this is wrong!!!
     graph.density(g, loops=TRUE)               # this is right!!!
     graph.density(simplify(g), loops=FALSE)    # this is also right, but different

