Am2Al                  package:RBGL                  R Documentation

_C_o_n_v_e_r_t _a_d_j_a_c_e_n_c_y _m_a_t_r_i_x _t_o _a_d_j_a_c_e_n_c_y '_l_i_s_t' _i_n _2_x_N_E _f_o_r_m_a_t

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

     Let NV be the number of nodes of a graph and NE be the number of
     edges. This function converts such an NVxNV adjacency matrix B to
     a 2 X NE matrix L where NE = sum(B). The kth column of the matrix
     represents the edge L[1,k]->L[2,k]

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

     Am2Al(mat)

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

     mat: a binary square matrix with nc cols representing a graph with
          nc vertices

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

     Note that the resulting matrix has zero-based entries for
     convenient use in the Boost library edgelist representation.

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

     2 x NE matrix

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

     set.seed(223)
     V <- 1:10
     M <- 1:4
     Gm <- randomGraph(V,M,.3)
     cat("as adjacency matrix:\n")
     print(GmM <- adjMat(Gm))
     Gl <- Am2Al(GmM)
     cat("as edge list:\n")
     print(Gl)

