neighborhood            package:KEGGgraph            R Documentation

_R_e_t_u_r_n _t_h_e _n_e_i_g_h_b_o_r_h_o_o_d _s_e_t _o_f _g_i_v_e_n _v_e_r_t_i_c_e_s

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

     The function returns the neighborhood set of given vertices in the
     form of list. Optionally user can choose to include the given
     vertices in the list, too.

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

     neighborhood(graph, index, return.self = FALSE)

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

   graph: An object of 'graphNEL'

   index: Names of nodes, whose neighborhood set should be returned 

return.self: logical, should the vertex itself also be returned?

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

     Let v be a vertex in a (di)graph, the out-neighborhood or
     successor set (N+(v), x belongs to V(G) and v->x) and the
     in-neighborhood or predecessor set (N-(v), x belongs to V(G) and
     x->v) are jointly returned.

     The returned list is indexed by the given node indices, 'NULL' is
     returned in case of non-existing node.

     The nodes are unique, that is, duplicated nodes are removed in
     results.

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

     A list indexed by the given node indices, each entry containing
     the neighborhood set of that node (or furthermore including that
     node).

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

     Jitao David Zhang <j.zhang@dkfz.de>

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

     D.B. West. Introduction to Graph Theory, Second Edition. Prentice
     Hall, 2001

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

       V <- c("Hamburg","Stuttgart","Berlin","Paris","Bremen")
       E <- list("Hamburg"=c("Berlin","Bremen"),
                 "Stuttgart"=c("Berlin","Paris"),
                 "Berlin"=c("Stuttgart","Bremen"),
                 "Paris"=c("Stuttgart"),
                 "Bremen"=c("Hamburg","Berlin"))
       g <- new("graphNEL", nodes=V, edgeL=E, edgemode="directed")
       if(require(Rgraphviz) & interactive()) {
         plot(g, "neato")
       }

       ## simple uses
       neighborhood(g, "Hamburg")
       neighborhood(g, c("Hamburg", "Berlin","Paris"))

       ## in case of non-existing nodes
       neighborhood(g, c("Stuttgart","Ulm"))

       ## also applicable to non-directed graphs
       neighborhood(ugraph(g), c("Stuttgart","Berlin"))

