bfs                   package:RBGL                   R Documentation

_B_r_e_a_d_t_h _a_n_d _D_e_p_t_h-_f_i_r_s_t _s_e_a_r_c_h

_D_e_s_c_r_i_p_t_i_o_n:

     These functions return information on graph traversal by breadth
     and depth first search using routines from the BOOST library.

_U_s_a_g_e:

     bfs(object, node, checkConn=TRUE)
     dfs(object, node, checkConn=TRUE)

_A_r_g_u_m_e_n_t_s:

  object: instance of class graph from Bioconductor graph class

    node: node name where search starts; defaults to the node in first
          position in the node vector.

checkConn: logical for backwards compatibility; this parameter has no
          effect as of RBGL 1.7.9 and will be removed in future
          versions.

_D_e_t_a_i_l_s:

     These two functions are interfaces to the BOOST graph library
     functions for breadth first and depth first search. Both methods
     handle unconnected graphs by applying the algorithms over the
     connected components. 

     Cormen et al note (p 542) that `results of depth-first search may
     depend upon the order in which the vertices are examined ... These
     different visitation orders tend not to cause problems in
     practice, as any DFS result can usually be used effectively, with
     essentially equivalent results'.

_V_a_l_u_e:

     For 'bfs' a vector of node indices in order of BFS visit.

     For 'dfs' a list of two vectors of nodes, with elements 'discover'
     (order of DFS discovery), and 'finish' (order of DFS completion).

_A_u_t_h_o_r(_s):

     VJ Carey <stvjc@channing.harvard.edu>

_E_x_a_m_p_l_e_s:

     dd <- fromGXL(file(system.file("XML/bfsex.gxl",package="RBGL"), open="r"))
     bfs(dd, "r", FALSE)
     bfs(dd, "s", TRUE)

     dd2 <- fromGXL(file(system.file("XML/dfsex.gxl",package="RBGL"), open="r"))
     dfs(dd2, "u", FALSE)

