addEdge                package:graph                R Documentation

_a_d_d_E_d_g_e

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

     A function to add an edge to a graph.

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

     addEdge(from, to, graph, weights)

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

    from: The node the edge starts at 

      to: The node the edge goes to. 

   graph: The graph that the edge is being added to. 

 weights: A vector of weights, one for each edge. 

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

     Both 'from' and 'to' can be vectors. They need not be the same
     length (if not the standard rules for replicating the shorter one
     are used). Edges are added to the graph between the supplied
     nodes.

     The 'weights' are given for each edge.

     The implementation is a bit too oriented towards the 'graphNEL'
     class and will likely change in the next release to accomodate
     more general graph classes.

     If the graph is undirected then the edge is bidirectional (and
     only needs to be added once). For directed graphs the edge is
     directional.

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

     A new instance of a graph object with the same class as 'graph'
     but with the indicated edges added.

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

     R. Gentleman

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

     'addNode','removeEdge', 'removeNode'

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

     V <- LETTERS[1:4]
     edL2 <- vector("list", length=4)
     names(edL2) <- V
     for(i in 1:4)
       edL2[[i]] <- list(edges=c(2,1,2,1)[i], weights=sqrt(i))
     gR2 <- new("graphNEL", nodes=V, edgeL=edL2, edgemode="directed")

     gX <- addEdge("A", "C", gR2, 1)

     gR3 <- randomEGraph(letters[10:14], .4)
     gY <- addEdge("n", "l", gR3, 1)

