numperm                 package:sna                 R Documentation

_G_e_t _t_h_e _n_t_h _P_e_r_m_u_t_a_t_i_o_n _V_e_c_t_o_r _b_y _P_e_r_i_o_d_i_c _P_l_a_c_e_m_e_n_t

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

     `numperm' implicitly numbers all permutations of length `olength',
     returning the `permnum'th of these.

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

     numperm(olength, permnum)

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

 olength: The number of items to permute 

 permnum: The number of the permutation to use (in `1:olength!') 

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

     The n! permutations on n items can be deterministically ordered
     via a factorization process in which there are n slots for the
     first element, n-1 for the second, and n-i for the ith.  This fact
     is quite handy if you want to visit each permutation in turn, or
     if you wish to sample without replacement from the set of
     permutations on some number of elements: one just enumerates or
     samples from the integers on [1,n!], and then find the associated
     permutation.  `numperm' performs exactly this last operation,
     returning the `permnum'th permutation on `olength' items.

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

     A permutation vector

_N_o_t_e:

     Permutation search is central to the estimation of structural
     distances, correlations, and covariances on partially labeled
     graphs.  `numperm' is hence used by `structdist', `gscor',
     `gscov', etc.

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

     Carter T. Butts ctb@andrew.cmu.edu

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

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

     `rperm', `rmperm'

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

     #Draw a graph
     g<-rgraph(5)

     #Permute the rows and columns
     p.1<-numperm(5,1)
     p.2<-numperm(5,2)
     p.3<-numperm(5,3)
     g[p.1,p.1]
     g[p.2,p.2]
     g[p.3,p.3]

