is.multiple              package:igraph              R Documentation

_F_i_n_d _t_h_e _m_u_l_t_i_p_l_e _o_r _l_o_o_p _e_d_g_e_s _i_n _a _g_r_a_p_h

_D_e_s_c_r_i_p_t_i_o_n:

     A loop edge is an edge from a vertex to itself. An edge is a
     multiple edge if it has exactly the same head and tail vertices as
     another edge. A graph without multiple and loop edges is called a
     simple graph.

_U_s_a_g_e:

     is.loop(graph, eids=E(graph))
     is.multiple(graph, eids=E(graph))
     count.multiple(graph, eids=E(graph))

_A_r_g_u_m_e_n_t_s:

   graph: The input graph.

    eids: The edges to which the query is restricted. By default this
          is all edges in the graph.

_D_e_t_a_i_l_s:

     Note that the semantics for 'is.multiple' and 'count.multiple' is
     different. 'is.multiple' gives 'TRUE' for all occurences of a
     multiple edge except for one. Ie. if there are three 'i-j' edges
     in the graph then 'is.multiple' returns 'TRUE' for only two of
     them while 'count.multiple' returns '3' for all three.

     See the examples for getting rid of multiple edges while keeping
     their original multiplicity as an edge attribute.

_V_a_l_u_e:

     'is.loop' and 'is.multiple' return a logical vector.
     'count.multiple' returns a numeric vector.

_A_u_t_h_o_r(_s):

     Gabor Csardi csardi@rmki.kfki.hu

_S_e_e _A_l_s_o:

     'simplify' to eliminate loop and multiple edges.

_E_x_a_m_p_l_e_s:

     # Loops
     g <- graph( c(0,0,1,1,2,2,3,4) )
     is.loop(g)

     # Multiple edges
     g <- barabasi.game(10, m=3)
     is.multiple(g)
     count.multiple(g)
     is.multiple(simplify(g))
     all(count.multiple(simplify(g)) == 1)

     # Direction of the edge is important
     is.multiple(graph( c(0,1, 1,0) ))
     is.multiple(graph( c(0,1, 1,0), dir=FALSE ))

     # Remove multiple edges but keep multiplicity
     g <- barabasi.game(10, m=3)
     E(g)$weight <- count.multiple(g)
     g <- simplify(g)
     any(is.multiple(g))
     E(g)$weight

