bfs                   package:ggm                   R Documentation

_B_r_e_a_d_t_h _f_i_r_s_t _s_e_a_r_c_h

_D_e_s_c_r_i_p_t_i_o_n:

     Breadth-first search of a connected undirected graph.

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

     bfs(amat, v = 1)

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

    amat: a symmetric matrix with dimnames specifying the adjacency
          matrix of the undirected graph

       v: an integer, indicating the starting node of the search.
          Defaults to the first node. 

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

     Breadth-first search is a systematic method for exploring a graph.
     The algorithm is taken from Aho, Hopcroft & Ullman (1983).

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

    tree: the edge matrix of the resulting spanning tree

branches: a matrix with two columns, giving the indices of the branches
          of the spanning tree

  chords: a matrix with two columns, giving the indices of the chords
          of the spanning tree

_A_u_t_h_o_r(_s):

     Giovanni M. Marchetti

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

     Aho, A.V., Hopcrtoft, J.E. & Ullman, J.D. (1983). _Data structures
     and algorithms._ Reading: Addison-Wesley.

     Thulasiraman, K. & Swamy, M.N.S. (1992). _Graphs: theory and
     algorithms_. New York: Wiley.

_S_e_e _A_l_s_o:

     'UG', 'findPath', 'cycleMatrix'

_E_x_a_m_p_l_e_s:

     ## Finding a spanning tree of the butterfly graph
     bfs(UG(~ a*b*o + o*u*j))
     ## Starting from another node
     bfs(UG(~ a*b*o + o*u*j), v=3)

