tsort                  package:RBGL                  R Documentation

_t_o_p_o_l_o_g_i_c_a_l _s_o_r_t _o_f _v_e_r_t_i_c_e_s _o_f _a _d_i_g_r_a_p_h

_D_e_s_c_r_i_p_t_i_o_n:

     returns vector of zero-based indices of vertices of a DAG in
     topological sort order

_U_s_a_g_e:

     tsort(x) # now x assumed to be Bioconductor graph graphNEL

_A_r_g_u_m_e_n_t_s:

       x: instance of class graphNEL from Bioconductor graph class

_D_e_t_a_i_l_s:

     calls to the topological_sort algorithm of BGL.  will check in BGL
     whether the input is a DAG and return a vector of zeroes (of
     length length(nodes(x))) if it is not.  Thus this function can be
     used to check for cycles in a digraph.

_V_a_l_u_e:

     a numerical vector enumerating vertices in the topological sort
     sequence, 0-based

_A_u_t_h_o_r(_s):

     VJ Carey <stvjc@channing.harvard.edu>

_E_x_a_m_p_l_e_s:

      data(FileDep)
      tsind <- tsort(FileDep)
      tsind
      FD2 <- FileDep
      # now introduce a cycle
      FD2 <- addEdge("bar_o", "dax_h", FD2, 1)
      tsort(FD2)
      

