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 carry out breadth and depth first search using
     routines from the BOOST library. For 'dfs' a 'list' containing two
     'vectors' is returned. These indicate the sequence in which a node
     is first visited and last visited. For 'dfs' a single vector is
     returned indicating the order in which a node was visited.

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

     bfs(graph, init.node=1, checkConn=FALSE)
     ## S4 method for signature 'graph':
     dfs(graph)
     ## S4 method for signature 'graph':
     bfs(graph)

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

   graph: instance of class graph from Bioconductor graph class

init.node: index (1 based) of where to start search

checkConn: logical indicating whether connectivity of input graph
          should be checked 

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

     calls to boost bfs or dfs procedures

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

     for bfs: vector of indices in order of BFS visit

     for dfs: list of two vectors of nodes, order of DFS discovery, and
     order of DFS completion (finish)

_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")))
     dd@edgemode <- "undirected"
     bfs(dd)
     bfs(dd,2)

     dd <- fromGXL(file(system.file("XML/dfsex.gxl",package="RBGL")))
     dfs(dd)

