reverseEdgeDirections         package:graph         R Documentation

_R_e_v_e_r_s_e _t_h_e _e_d_g_e_s _o_f _a _d_i_r_e_c_t_e_d _g_r_a_p_h

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

     Return a new directed graph instance with each edge oriented in
     the opposite direction relative to the corresponding edge in the
     input graph.

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

     reverseEdgeDirections(g)

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

       g: A 'graph' subclass that can be coerced to 'graphAM'

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

     WARNING: this doesn't handle edge attributes properly.  It is a
     preliminary implementation and subject to change.

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

     A 'graphNEL' instance

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

     S. Falcon

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

     g <- new("graphNEL", nodes=c("a", "b", "c"),
              edgeL=list(a=c("b", "c"), b=character(0), c=character(0)),
              edgemode="directed")

     stopifnot(isAdjacent(g, "a", "b"))
     stopifnot(!isAdjacent(g, "b", "a"))

     grev <- reverseEdgeDirections(g)
     stopifnot(!isAdjacent(grev, "a", "b"))
     stopifnot(isAdjacent(grev, "b", "a"))

