cycleMatrix               package:ggm               R Documentation

_F_u_n_d_a_m_e_n_t_a_l _c_y_c_l_e_s

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

     Finds the matrix of fundamental cycles of a connected undirected
     graph.

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

     cycleMatrix(amat)

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

    amat: a symmetric matrix with dimnames denoting the adjacency
          matrix of the undirected graph. The graph must be connected,
          otherwise the function returns an error message.

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

     All the cycles in an UG can be obtained from combination (ring
     sum) of the set of fundamental cycles. The matrix of fundamental
     cycles is a Boolean matrix having as rows the fundamental cycles
     and as columns the edges of the graph. If an entry is one then the
     edge associated to that column belongs to the cycle associated to
     the row.

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

     a Boolean matrix of the fundamental cycles of the undirected
     graph. If   there is no cycle the function returns 'NULL'.

_N_o_t_e:

     This function is used by 'isGident'. The row sum of the matrix
     gives the length of the cycles.

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

     Giovanni M. Marchetti

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

     Thulasiraman, K. & Swamy, M.N.S. (1992). _Graphs: theory and
     algorithms_. New York: Wiley.

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

     'UG', 'findPath', 'fundCycles', 'isGident', 'bfs'

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

     ## Three cycles
     cycleMatrix(UG(~a*b*d+d*e+e*a*f))
     ## No cycle
      cycleMatrix(UG(~a*b))
     ## two cycles: the first is even and the second is odd
     cm <- cycleMatrix(UG(~a*b+b*c+c*d+d*a+a*u*v))
     apply(cm, 1, sum)

