Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

add.active

add.verticies.active, add.edges.active


Description

Convenience functions for adding a set of verticies (or edges) and setting them to be active in a single call

Usage

## S3 method for class 'active'
add.vertices(x, nv, vattr = NULL, last.mode = TRUE,
            onset = NULL, terminus = NULL, length = NULL, at = NULL, ...)

## S3 method for class 'active'
add.edges(x, tail, head, names.eval = NULL, vals.eval = NULL, 
         onset = NULL, terminus = NULL, length = NULL, at = NULL, ...)

Arguments

x

an object of class network or networkDynamic.

nv

the number of vertices to add

tail

a vector of vertex IDs corresponding to the tail (source, ego) of each edge to be added

head

a vector of vertex IDs corresponding to the head (target, alter) of each edge to be added

onset

an optional vector of time points that specifies the starts of the interval(s). This must be accompanied by one of terminus or length.

terminus

an optional vector of time points that specifies the ends of the interval(s). This must be accompanied by one of onset or length.

length

an optional vector of interval lengths for the interval(s). This must be accompanied by one of onset or terminus.

at

optional, one or more time points to be activated.

names.eval

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

vals.eval

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

vattr

optionally, a list of attributes with one entry per new vertex. not currently interpreted in a dynamic context, but passed directly to add.vertices

last.mode

logical; should the new vertices be added to the last (rather than the first) mode of a bipartite network?

...

possible future additional arguments

Details

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.

Value

The passed in network object with class set to networkDynamic and the specified number of new vertices or edges added and activated

Note

Order of arguments was changed in version 1.9 for S3 method consistency. Does not currently support the multiple-vertex head- and tail-sets of add.edges or add.edge.

Author(s)

Ayn Leslie-Cook aynlc3@uw.edu

See Also

Examples

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)

networkDynamic

Dynamic Extensions for Network Objects

v0.10.1
GPL-3
Authors
Carter T. Butts [aut], Ayn Leslie-Cook [aut], Pavel N. Krivitsky [aut], Skye Bender-deMoll [aut, cre], Zack Almquist [ctb], David R. Hunter [ctb], Li Wang [ctb], Kirk Li [ctb], Steven M. Goodreau [ctb], Jeffrey Horner [ctb], Martina Morris [ctb]
Initial release
2020-01-16

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.