as.directed              package:igraph              R Documentation

_C_o_n_v_e_r_t _b_e_t_w_e_e_n _d_i_r_e_c_t_e_d _a_n_d _u_n_d_i_r_e_c_t_e_d _g_r_a_p_h_s

_D_e_s_c_r_i_p_t_i_o_n:

     'as.directed' converts an undirected graph to directed,
     'as.undirected' is the opposite, it converts a directed graph to
     undirected.

_U_s_a_g_e:

     as.directed(graph, mode = c("mutual", "arbitrary")) 
     as.undirected(graph, mode = c("collapse", "each")) 

_A_r_g_u_m_e_n_t_s:

   graph: The graph to convert.

    mode: Character constant, defines the conversion algorithm. For
          'as.directed' it can be 'mutual' or 'arbitrary'. For
          'as.undirected' it can be 'each' or 'collapse'. See details
          below.

_D_e_t_a_i_l_s:

     Conversion algorithms for 'as.directed':

   _a_r_b_i_t_r_a_r_y The number of edges in the graph stays the same, an
        arbitrarily directed edge is created for each undirected edge.

   _m_u_t_u_a_l Two directed edges are created for each undirected edge, one
        in each direction.

     Conversion algorithms for 'as.undirected':

   _e_a_c_h The number of edges remains constant, an undirected edge is
        created for each directed one, this version might create graphs
        with multiple edges.

   _c_o_l_l_a_p_s_e One undirected edge will be created for each pair of
        vertices which are connected with at least one directed edge,
        no multiple edges will be created.

_V_a_l_u_e:

     A new graph object.

_A_u_t_h_o_r(_s):

     Gabor Csardi csardi@rmki.kfki.hu

_S_e_e _A_l_s_o:

     'simplify' for removing multiple and/or loop edges from a graph.

_E_x_a_m_p_l_e_s:

     g <- graph.ring(10)
     as.directed(g, "mutual")
     g2 <- graph.star(10)
     as.undirected(g)

