add.vertices {network} | R Documentation |
add.vertices
adds a specified number of vertices to an existing network; if desired, attributes for the new vertices may be specified as well.
add.vertices(x, nv, vattr = NULL, last.mode = TRUE)
x |
an object of class |
nv |
the number of vertices to add |
vattr |
optionally, a list of attributes with one entry per new vertex |
last.mode |
logical; should the new vertices be added to the last (rather than the first) mode of a bipartite network? |
New vertices are generally appended to the end of the network (i.e., their vertex IDs begin with network.size(x)
an count upward). The one exception to this rule is when x
is bipartite and last.mode==FALSE
. In this case, new vertices are added to the end of the first mode, with existing second-mode vertices being permuted upward in ID. (x
's bipartite
attribute is adjusted accordingly.)
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
.
Invisibly, a pointer to the updated network
object; add.vertices
modifies its argument in place.
Carter T. Butts buttsc@uci.edu
Butts, C. T. (2008). “network: a Package for Managing Relational Data in R.” Journal of Statistical Software, 24(2). http://www.jstatsoft.org/v24/i02/
network
, get.vertex.attribute
, set.vertex.attribute
#Initialize a network object g<-network.initialize(5) g #Add five more vertices add.vertices(g,5) g