topological.sort           package:igraph           R Documentation

_T_o_p_o_l_o_g_i_c_a_l _s_o_r_t_i_n_g _o_f _v_e_r_t_i_c_e_s _i_n _a _g_r_a_p_h

_D_e_s_c_r_i_p_t_i_o_n:

     A topological sorting of a directed acyclic graph is a linear
     ordering of its nodes where each node comes before all nodes to
     which it has edges.

_U_s_a_g_e:

     topological.sort(graph, mode=c("out", "all", "in"))

_A_r_g_u_m_e_n_t_s:

   graph: The input graph, should be directed

    mode: Specifies how to use the direction of the edges. For "'out'",
          the sorting order ensures that each node comes before all
          nodes to which it has edges, so nodes with no incoming edges
          go first. For "'in'", it is quite the opposite: each node
          comes before all nodes from which it receives edges. Nodes 
          with no outgoing edges go first.

_D_e_t_a_i_l_s:

     Every DAG has at least one topological sort, and may have many.
     This function returns a possible topological sort among them. If
     the graph is not acyclic (it has at least one cycle), a partial
     topological sort is returned and a warning is issued.

_V_a_l_u_e:

     A numeric vector containing vertex ids in topologically sorted
     order.

_A_u_t_h_o_r(_s):

     Tamas Nepusz ntamas@rmki.kfki.hu and Gabor Csardi
     csardi@rmki.kfki.hu for the R interface

_E_x_a_m_p_l_e_s:

     g <- barabasi.game(100)
     topological.sort(g)

