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>

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

     Boost Graph Library ( www.boost.org/libs/graph/doc/index.html )

     The Boost Graph Library: User Guide and Reference Manual; by
     Jeremy G. Siek, Lie-Quan Lee, and Andrew Lumsdaine;
     (Addison-Wesley, Pearson Education Inc., 2002), xxiv+321pp. ISBN
     0-201-72914-8

_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)
      

