Learn R Programming

networkDynamic (version 0.4.1)

add.vertices.active: add.verticies.active, add.edges.active

Description

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

Usage

add.vertices.active(x, nv, onset = NULL, terminus = NULL, length = NULL, at = NULL)

add.edges.active(x, onset = NULL, terminus = NULL, length = NULL, at = NULL, tail, head)

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 timepoints that specifies the starts of the interval(s). This must be accompanied by one of terminus or length.
terminus
an optional vector of timepoints 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.

Value

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

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.

See Also

See Also as activate.vertices, activate.edges,add.vertices,add.edges

Examples

Run this code
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