Standard labeling of edges with integerspackage:graphR Documentation

_S_t_a_n_d_a_r_d _l_a_b_e_l_i_n_g _o_f _e_d_g_e_s _w_i_t_h _i_n_t_e_g_e_r_s

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

     Functions to convert between from-to representation and standard
     labeling of the edges for undirected graphs with no self-loops.

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

     ftM2int(ft)
     int2ftM(i)

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

       i: Numeric vector.

      ft: Numeric nx2 or 2xn matrix.

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

     A standard 1-based node labeling of a graph G=(V,E) is a
     one-to-one mapping between the integers from 1 to |V| and the
     nodes in V. A standard 1-based edge labeling of an undirected
     graph G=(V,E) with no self-loops is _the_ one-to-one mapping
     between the integers from 1 to |V| choose 2 = |V|*(|V|-1)/2 such
     that the edge labeled 1 is between nodes 2 and 1, the edge labeled
     2 is between nodes 3 and 1, the edge labeled 3 is between nodes 3
     and 2, and so on.

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

     For 'ftM2int', a numeric vector of length n.  For 'int2ftM', a
     'length(i) x 2' matrix.

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

     Wolfgang Huber

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

      nNodes <- 200
      nEdges <- choose(nNodes, 2)
      i <- 1:nEdges
      ft <- int2ftM(i)
      ft[1:6,]
      stopifnot(all(ft[,1]>ft[,2])) ## always from higher to lower
      stopifnot(!any(duplicated(paste(ft[,1], ft[,2]))))
      stopifnot(ft[nEdges, 1]==nNodes, ft[nEdges, 2]==nNodes-1) 

      j <- ftM2int(ft)
      stopifnot(all(i==j))

