graphNEL-class             package:graph             R Documentation

_C_l_a_s_s "_g_r_a_p_h_N_E_L"

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

     This is a class of graphs that are represented in terms of nodes
     and an edge list. This is a suitable representation for a graph
     with a large number of nodes and relatively few edges.

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

     The 'graphNEL' class provides a very general structure for
     representing graphs. It will be reasonably efficient for lists
     with relatively more nodes than edges. The class is currently able
     to handle multi-edges and edges of any type.

     The 'edgeL' is a named 'list' of the same length as the node
     vector. The names are the names of the nodes. Each element of
     'edgeL' is itself a list. Each element of this (sub)list is a
     vector (all must be the same length) and each element represents
     an edge to another node. The sublist named 'edges' holds index
     values into the node vector. And each such entry represents an
     edge from the node which has the same name as the component of
     'edgeL' to the node with index provided. Another component that is
     often used is named 'weights'. It represents edge weights. The
     user can specify any other edge attributes (such as types etc).
     They are responsible for any special handling that these might
     require.

     Multi-edges are represented by multiple entries. For an
     'undirected' instance all edges are reciprocated (there is an edge
     from A to B and from B to A).

     Note that the reason for using indices to represent the 'to' end
     of a node is so that we can easily support permutation of the node
     labels as a way to generate randomizations of the graph.

_O_b_j_e_c_t_s _f_r_o_m _t_h_e _C_l_a_s_s:

     Objects can be created by calls of the form 'new("graphNEL",...)'.

_S_l_o_t_s:

     '_n_o_d_e_s': Object of class '"vector"'.

     '_e_d_g_e_L': Object of class '"list"'. The 'edgeL' must be the same
          length as 'nodes'. The elements of this vector correspond to
          the same element in 'nodes'. The elements are themselves
          lists. If the node has any edges then this list will have an
          element named 'edges'. If edge weights are used then there
          must be an element named 'weights' and it must be the same
          length as the 'edges' element.

_E_x_t_e_n_d_s:

     Class '"graph"', directly.

_M_e_t_h_o_d_s:

     _a_d_j 'signature(object = "graphNEL")': A method for finding nodes
          adjacent to the suplied node.

     _e_d_g_e_L 'signature(graph = "graphNEL")': A mehtod for obtaining the
          edge list.

     _e_d_g_e_W_e_i_g_h_t_s 'signature(object = "graphNEL")': A method for
          obtaining the edge weights. 

     _e_d_g_e_s 'signature(object = "graphNEL")': A method for obtaining the
          edges.

     _i_n_E_d_g_e_s 'signature(node = "character", object = "graphNEL")':
          Return the incoming edges for the specified nodes.  See
          'inEdges'.

     _n_o_d_e_s 'signature(object = "graphNEL")': A method for obtaining the
          nodes. 

     _n_u_m_N_o_d_e_s 'signature(object = "graphNEL")':A method for determining
          how many nodes are in the graph. 

     _s_u_b_G_r_a_p_h 'signature(subgraph="character", graph = "graphNEL")':A
          method for obtaining the induced subgraph based on the set of
          supplied nodes and the supplied graph.

     _p_l_o_t Please see the help page for 'plot.graphNEL' in the
          'Rgraphviz' package

     _g_r_a_p_h_2_g_r_a_p_h_v_i_z 'signature(object = "graphNEL")': A method that
          will convert a 'graphNEL' object into a matrix suitable for
          interaction with 'Rgraphviz'.  Not intended to be called
          directly.  This function will insure that no NA's (or other
          undesired values) are in the graph, or created by coersion.

     _n_o_d_e_s<- 'signature(object="graphNEL", value="character")': A
          method for replacing the nodes in a graph object. It checks
          to be sure the values are the right length and unique. 

     _c_o_e_r_c_e 'signature(from = "graphNEL", to = "graphAM")': Called via
          'as', the method converts to an adjacency matrix
          representation.  See 'graphAM-class'. 

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

     R. Gentleman

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

     'graphAM-class', 'distGraph-class', 'clusterGraph-class'

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

        set.seed(123)
        V <- LETTERS[1:4]
        edL <- vector("list", length=4)
        names(edL) <- V
        for(i in 1:4)
           edL[[i]] <- list(edges=5-i, weights=runif(1))
        gR <- new("graphNEL", nodes=V, edgeL=edL)
        edges(gR)
        edgeWeights(gR)

