calcSumProb              package:graph              R Documentation

_C_a_l_c_u_l_a_t_e _t_h_e _p_r_o_b_a_b_i_l_i_t_y _t_h_a_t _a _s_u_b_g_r_a_p_h _h_a_s _a_n _u_n_u_s_u_a_l _n_u_m_b_e_r
_o_f _e_d_g_e_s.

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

     For any graph a set of nodes can be used to obtain an induced
     subgraph (see 'subGraph'). An interesting question is whether that
     subgraph has an unusually large number of edges. This function
     computes the probability that a _random_ subgraph with the same
     number of nodes has more edges than the number observed in the
     presented subgraph. The appropriate probability distribution is
     the hypergeometric.

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

     calcSumProb(sg, g)

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

      sg: subgraph made from the original graph 

       g: original graph object from which the subgraph was made 

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

     The computation is based on the following argument. In the
     original graph there are n nodes and hence N=n*(n-1)/2 edges in
     the complete graph. If we consider these N nodes to be of two
     types, corresponding to those that are either in our graph, 'g',
     or not in it. Then we think of the subgraph which has say m nodes
     and M=m*(m-1)/2 possible edges as representing M draws from an urn
     containing N balls of which some are white (those in 'g') and some
     are black. We count the number of edges in the subgraph and use a
     Hypergeomtric distribution to ask whether our subgraph is
     particularly dense.

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

     The probability of having greater than or equal to the subgraph's 
     number of edges is returned.

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

     Elizabeth Whalen

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

     'calcProb'

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

       set.seed(123)
       V <- letters[14:22]
       g1 <- randomEGraph(V, .2)

       sg1 <- subGraph(letters[c(15,17,20,21,22)], g1)
       calcSumProb(sg1, g1)

