rgnm                   package:sna                   R Documentation

_D_r_a_w _D_e_n_s_i_t_y-_C_o_n_d_i_t_i_o_n_e_d _R_a_n_d_o_m _G_r_a_p_h_s

_D_e_s_c_r_i_p_t_i_o_n:

     'rgnm' generates random draws from a density-conditioned uniform
     random graph distribution.

_U_s_a_g_e:

     rgnm(n, nv, m, mode = "digraph", diag = FALSE)

_A_r_g_u_m_e_n_t_s:

       n: the number of graphs to generate. 

      nv: the size of the vertex set (|V(G)|) for the random graphs. 

       m: the number of edges on which to condition. 

    mode: '"digraph"' for directed graphs, or '"graph"' for undirected
          graphs. 

    diag: boolean; should loops be allowed? 

_D_e_t_a_i_l_s:

     'rgnm' returns draws from the density-conditioned uniform random
     graph first popularized by the famous work of Erd\"{o}s and
     R\'{e}nyi (the G(N,M) process).  In particular, the pmf of a
     G(N,M) process is given by


                     p(G=g|N,M) = 1/Choose(E_m,M)


     where E_m is the maximum number of edges in the graph.  (E_m is
     equal to 'nv*(nv-diag)/(1+(mode=="graph"))'.)

     The G(N,M) process is one of several process which are used as
     baseline models of social structure.  Other well-known baseline
     models include the Bernoulli graph (the G(N,p) model of Erd\"{o}s
     and R\'{e}nyi) and the U|MAN model of dyadic independence.  These
     are implemented within 'sna' as 'rgraph' and 'rgnm', respectively.

_V_a_l_u_e:

     A matrix or array containing the drawn adjacency matrices

_A_u_t_h_o_r(_s):

     Carter T. Butts buttsc@uci.edu

_R_e_f_e_r_e_n_c_e_s:

     Erd\"{o}s, P. and R\'{e}nyi, A.  (1960).  ``On the Evolution of
     Random Graphs.''  _Public Mathematical Institute of Hungary
     Academy of Sciences,_ 5:17-61.

_S_e_e _A_l_s_o:

     'rgraph', 'rguman'

_E_x_a_m_p_l_e_s:

     #Draw 5 random graphs of order 10 
     all(gden(rgnm(5,10,9,mode="graph"))==0.2) #Density 0.2
     all(gden(rgnm(5,10,9))==0.1)              #Density 0.1

     #Plot a random graph
     gplot(rgnm(1,10,20))

