graph.incidence            package:igraph            R Documentation

_C_r_e_a_t_e _g_r_a_p_h_s _f_r_o_m _a_n _i_n_c_i_d_e_n_c_e _m_a_t_r_i_x

_D_e_s_c_r_i_p_t_i_o_n:

     'graph.incidence' creates a bipartite igraph graph from an
     incidence matrix.

_U_s_a_g_e:

     graph.incidence(incidence, directed = FALSE, mode = c("all", "out", 
         "in", "total"), multiple = FALSE, weighted = NULL, add.names = NULL)

_A_r_g_u_m_e_n_t_s:

incidence: The input incidence matrix. It can also be a sparse matrix
          from the 'Matrix' package.

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

    mode: A character constant, defines the direction of the edges in
          directed graphs, ignored for undirected graphs. If ''out'',
          then edges go from vertices of the first kind (corresponding
          to rows in the incidence matrix) to vertices of the second
          kind (columns in the incidence matrix). If ''in'', then the
          opposite direction is used. If ''all'' or ''total'', then
          mutual edges are created. 

multiple: Logical scalar, specifies how to interpret the matrix
          elements. See details below.

weighted: This argument specifies whether to create a weighted graph
          from the incidence matrix. If it is 'NULL' then an unweighted
          graph is created and the 'multiple' argument is used to
          determine the edges of the graph. If it is a character
          constant then for every non-zero matrix entry an edge is
          created and the value of the entry is added as an edge
          attribute named by the 'weighted' argument. If it is 'TRUE'
          then a weighted graph is created and the name of the edge
          attribute will be ''weight''. 

add.names: A character constant, 'NA' or 'NULL'. 'graph.incidence' can
          add the row and column names of the incidence matrix as
          vertex attributes. If this argument is 'NULL' (the default)
          and the incidence matrix has both row and column names, then
          these are added as the ''name'' vertex attribute. If you want
          a different vertex attribute for this, then give the name of
          the attributes as a character string. If this argument is
          'NA', then no vertex attributes (other than type) will be
          added. 

_D_e_t_a_i_l_s:

     Bipartite graphs have a ''type'' vertex attribute in igraph, this
     is boolean and 'FALSE' for the vertices of the first kind and
     'TRUE' for vertices of the second kind.

     'graph.incidence' can operate in two modes, depending on the
     'multiple' argument. If it is 'FALSE' then a single edge is
     created for every non-zero element in the incidence matrix. If
     'multiple' is 'TRUE', then the matrix elements are rounded up to
     the closest non-negative integer to get the number of edges to
     create between a pair of vertices.

_V_a_l_u_e:

     A bipartite igraph graph. In other words, an igraph graph that has
     a vertex attribute 'type'.

_A_u_t_h_o_r(_s):

     Gabor Csardi csardi@rmki.kfki.hu

_S_e_e _A_l_s_o:

     'graph.bipartite' for another way to create bipartite graphs

_E_x_a_m_p_l_e_s:

     inc <- matrix(sample(0:1, 15, repl=TRUE), 3, 5)
     colnames(inc) <- letters[1:5]
     rownames(inc) <- LETTERS[1:3]
     graph.incidence(inc)

