randomGraph              package:graph              R Documentation

_R_a_n_d_o_m _G_r_a_p_h

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

     This function generates a random graph according to a model that
     involves a latent variable.  The construction is to randomly
     assign members of the set 'M' to the nodes, 'V'. An edge is
     assigned between two elements of 'V' when they both have the same
     element of 'M' assigned to them. An object of class 'graphNEL' is
     returned.

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

     randomGraph(V, M, p, weights=TRUE)

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

       V: The nodes of the graph. 

       M: A set of values used to generate the graph. 

       p: A value between 0 and 1 that indicates the probability of
          selecting an element of 'M'

 weights: A logical indicating whether to use the number of shared
          elements of 'M' as weights. 

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

     The model is quite simple. To generate a graph, 'G', the user
     supplies the list of nodes, 'V' and a set of values 'M' which will
     be used to create the graph. For each node in 'V' a logical vector
     with length equal to the length of 'M' is generated. The
     probability of a 'TRUE' at any position is determined by 'p'. Once
     valus from 'M' have been assigned to each node in 'V' the result
     is processed into a graph. This is done by creating an edge
     between any two elements of 'V' that share an element of 'M' (as
     chosen by the selection process).

     The sizes of 'V' and 'M' and the values of 'p' determine how dense
     the graph will be.

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

     An object of class 'graphNEL-class' is returned.

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

     R. Gentleman

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

     'randomEGraph', 'randomNodeGraph'

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

      set.seed(123)
      V <- letters[1:10]
      M <- 1:4
      g1 <- randomGraph(V, M, 0.2)
      numEdges(g1) # 16, in this case
      edgeNames(g1)# "<from> ~ <to>"  since undirected

