Convenience functions for adding a set of verticies (or edges) and setting them to be active in a single call
# S3 method for active
add.vertices(x, nv, vattr = NULL, last.mode = TRUE,
onset = NULL, terminus = NULL, length = NULL, at = NULL, ...)# S3 method for active
add.edges(x, tail, head, names.eval = NULL, vals.eval = NULL,
onset = NULL, terminus = NULL, length = NULL, at = NULL, ...)
an object of class network
or networkDynamic
.
the number of vertices to add
a vector of vertex IDs corresponding to the tail (source, ego) of each edge to be added
a vector of vertex IDs corresponding to the head (target, alter) of each edge to be added
an optional vector of time points that specifies the starts of the interval(s). This must be accompanied by one of terminus
or length
.
an optional vector of time points that specifies the ends of the interval(s). This must be accompanied by one of onset
or length
.
an optional vector of interval lengths for the interval(s). This must be accompanied by one of onset
or terminus
.
optional, one or more time points to be activated.
optional list of length equal to the number of edges, with each element containing a list of names for the attributes of the corresponding edge. not currently interpreted in a dynamic context, but passed directly to add.edges
an optional list of lists of edge attribute values (matching names.eval
). Not currently interpreted in a dynamic context, but passed directly to add.edges
optionally, a list of attributes with one entry per new vertex. not currently interpreted in a dynamic context, but passed directly to add.vertices
logical; should the new vertices be added to the last (rather than the first) mode of a bipartite network?
possible future additional arguments
The passed in network object with class set to networkDynamic
and the specified number of new vertices or edges added and activated
Essentially a wrapper for a call to add.vertices
and activate.vertices
or add.edges
and activate.edges
when setting up a network object. These are not the S3 methods that their name appears to imply, since there is no "active" class. See add.edges.networkDynamic
, etc.
See Also as activate.vertices
, activate.edges
,add.vertices
,add.edges
# NOT RUN {
nw <- network.initialize(5)
activate.vertices(nw,onset=0,terminus=10)
network.size(nw) # just 5 nodes
# add some new nodes with times
add.vertices.active(nw,2,onset=10,terminus=12)
network.size(nw) # now we have 7 nodes
# add 2 edges edges, and activate them
add.edges(nw, tail=c(1,2),head=c(2,3))
activate.edges(nw,onset=0,terminus=10,e=1:2)
# instead add and activate at the same time
add.edges.active(nw, tail=c(3,4),head=c(4,5),onset=10,terminus=12)
# }
Run the code above in your browser using DataLab