add.edges {network}R Documentation

Add Edges to a Network Object

Description

Add one or more edges to an existing network object.

Usage

add.edge(x, tail, head, names.eval=NULL, vals.eval=NULL, 
    edge.check=FALSE, ...)
add.edges(x, tail, head, names.eval=NULL, vals.eval=NULL, ...)

Arguments

x an object of class network
tail for add.edge, a vector of vertex IDs reflecting the tail set for the edge to be added; for add.edges, a list of such vectors
head for add.edge, a vector of vertex IDs reflecting the head set for the edge to be added; for add.edges, a list of such vectors
names.eval for add.edge, an optional list of names for edge attributes; for add.edges, a list of such lists
vals.eval for add.edge, an optional list of edge attribute values (matching names.eval); for add.edges, a list of such lists
edge.check logical; should we perform (computationally expensive) tests to check for the legality of submitted edges?
... additional arguments

Details

The edge checking procedure is very slow, but should always be employed when debugging; without it, one cannot guarantee that the network state is consistent with network level variables (see network.indicators).

Value

add.edges returns the network object with the edges added.

Note

As with many routines in the network class, the iterative nature of these procedures makes them very slow within R. Eventually, such things will be handled via C backends.

Author(s)

Carter T. Butts buttsc@uci.edu

References

Butts, C.T. 2002. ``Memory Structures for Relational Data in R: Classes and Interfaces'' Working Paper.

See Also

network, add.vertices

Examples

#Initialize a small, empty network
g<-network.initialize(3)

#Add an edge
g<-add.edge(g,1,2)
g

[Package network version 0.5-4 Index]