edgeMatrix               package:graph               R Documentation

_C_o_m_p_u_t_e _a_n _E_d_g_e _M_a_t_r_i_x _f_o_r _a _G_r_a_p_h

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

     For our purposes an _edge matrix_ is a matrix with two rows and as
     many columns as there are edges. The entries in the first row are
     the index of the node the edge is _from_, those in the second row
     indicate the node the edge is _to_.

     If the graph is "undirected" then the 'duplicates' option can be
     used to indicate whether reciprocal edges are wanted. The default
     is to leave them out. In this case the notions of _from_ and _to_
     are not relevant.

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

     edgeMatrix(object, duplicates=FALSE)
     edgeWeightVector(g, ...)

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

  object: An object that inherits from 'graph'. 

       g: An object that inherits from 'graph'. 

duplicates: Whether or not duplicate edges should be produced for
          "undirected" graphs. 

     ...: arguments passed to 'edgeMatrix'.

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

     Implementations for both 'graphNEL' and 'clusterGraph' are
     available.

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

     A matrix with two rows, _from_ and _to_, and as many columns as
     there are edges. Entries indicate the index in the node vector
     that corresponds to the appropriate end of the edge.

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

     R. Gentleman

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

     'edges'

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

       set.seed(123)
       g1 <- randomGraph(letters[1:10], 1:4, p=.3)
       edgeMatrix(g1)
       g2 <- new("clusterGraph", clusters=list(a=c(1,2,3), b=c(4,5,6)))
       edgeMatrix(g2)
       edgeWeightVector(g2)

