Learn R Programming

network (version 1.0-1)

add.vertices: Add Vertices to an Existing Network

Description

add.vertices adds a specified number of vertices to an existing network; if desired, attributes for the new vertices may be specified as well.

Usage

add.vertices(x, nv, vattr = NULL)

Arguments

x
an object of class network
nv
the number of vertices to add
vattr
optionally, a list of attributes with one entry per new vertex

Value

  • Invisibly, a pointer to the updated network object; add.vertices modifies its argument in place.

Details

Note that the attribute format used here is based on the internal (vertex-wise) storage method, as opposed to the attribute-wise format used by network.

References

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

See Also

network, get.vertex.attribute, set.vertex.attribute

Examples

Run this code
#Initialize a network object
g<-network.initialize(5)
g

#Add five more vertices
add.vertices(g,5)
g

Run the code above in your browser using DataLab