Graphs from adjacency lists      package:igraph      R Documentation

_C_r_e_a_t_e _g_r_a_p_h_s _f_r_o_m _a_d_j_a_c_e_n_c_y _l_i_s_t_s

_D_e_s_c_r_i_p_t_i_o_n:

     An adjacency list is a list of numeric vectors, containing the
     neighbor vertices for each vertex. This function creates an igraph
     graph object from such a list.

_U_s_a_g_e:

     graph.adjlist(adjlist, directed = TRUE, duplicate = TRUE)

_A_r_g_u_m_e_n_t_s:

 adjlist: The adjacency list. It should be consistent, i.e. the maximum
          throughout all vectors in the list must be less than the
          number of vectors (=the number of vertices in the graph).
          Note that the list is expected to be 0-indexed.

directed: Logical scalar, whether or not to create a directed graph.

duplicate: Logical scalar. For undirected graphs it gives whether edges
          are included in the list twice. E.g. if it is 'TRUE' then for
          an undirected '{A,B}' edge 'graph.adjlist' expects 'A'
          included in the neighbors of 'B' and 'B' to be included in
          the neighbors of 'A'.

          This argument is ignored if 'directed' is 'TRUE'. 

_D_e_t_a_i_l_s:

     Adjacency lists are handy if you intend to do many (small)
     modifications to a graph. In this case adjacency lists are more
     efficient than igraph graphs.

     The idea is that you convert your graph to an adjacency list by
     'get.adjlist', do your modifications to the graphs and finally
     create again an igraph graph by calling 'graph.adjlist'.

_V_a_l_u_e:

     An igraph graph object.

_A_u_t_h_o_r(_s):

     Gabor Csardi csardi@rmki.kfki.hu

_S_e_e _A_l_s_o:

     'get.edgelist'

_E_x_a_m_p_l_e_s:

     ## Directed
     g <- graph.ring(10, dir=TRUE)
     al <- get.adjlist(g, mode="out")
     g2 <- graph.adjlist(al)
     graph.isomorphic(g, g2)

     ## Undirected
     g <- graph.ring(10)
     al <- get.adjlist(g)
     g2 <- graph.adjlist(al, dir=FALSE)
     graph.isomorphic(g, g2)
     ecount(g2)
     g3 <- graph.adjlist(al, dir=FALSE, duplicate=FALSE)
     ecount(g3)
     is.multiple(g3)

