Learn R Programming

networkDynamic (version 0.11.4)

get.networks: Obtain a list of collapsed networks sampled periodically from a networkDynamic object

Description

Given a start time, end time, and increment (or vectors of onsets and termini) to express sampling intervals, return a list of collapsed networks from a networkDynamic object.

Usage

get.networks(dnet, start = NULL, end = NULL, time.increment = NULL, 
               onsets=NULL, termini=NULL,...)

Value

A list of static network objects corresponding to the specified sampling intervals of the networkDynamic

Arguments

dnet

A networkDynamic object with possible vertex, edge, network, and attribute spell information.

start

numeric value giving the start of the sampling interval

end

numeric value giving the end of the sampling interval

time.increment

value for the offset (and duration) between sucessive samples. Will default to 1 if not otherwise specified

onsets

A numeric vector containing the onset times of the networks to be extracted. This must be accompanied by termini of the same length.

termini

A numeric vector containing the terminus times of the networks to be extracted. This must be accompanied by onsets of the same length.

...

Additional arguments to network.collapse (such as rule,active.default,retain.all.vertices)

Author

Kirk Li, Skye Bender-deMoll

Details

The sampling ("slicing") intervals may be defined using either the start, end, and time.increment parameters, or by providing parallel vectors of onsets and termini. If values are not specefied but a net.obs.period attribute exists to describe the 'natural' sampling parameters, start and end will defult to the max an min of the observations element, with time.increment set to its corresponding value in the net.obs.period.

See Also

See Also as network.collapse for obtaining a slice of static network, network.extract for extracting sub-ranges of a networkDynamic, get.vertex.attribute.active for more on TEA attributes, and as.network.networkDynamic for stripping the the networkDynamic class from an object.

Examples

Run this code
# create a networkDynamic with some basic activity and time extended attributes (TEA)
test <- network.initialize(5)
add.edges.active(test, tail=c(1,2,3), head=c(2,3,4),onset=0,terminus=1)
activate.edges(test,onset=3,terminus=5)
activate.edges(test,onset=-2,terminus=-1)
activate.edge.attribute(test,'weight',5,onset=3,terminus=4)
activate.edge.attribute(test,'weight',3,onset=4,terminus=5,e=1:2)

# obtain the list of networks
list <- get.networks(test,start=0, end=5)

# aggregate over a longer time period with specified rule
list <- get.networks(test,start=0, end=6,time.increment=2,rule='latest')

# use 'at' style extraction of momentary slices via onsets & termini
list <- get.networks(test,onsets=0:5,termini=0:5)

# ensure that all networks returned will be the same size
list <- get.networks(test,onsets=0:5,termini=0:5,retain.all.vertices=TRUE)


# find out how many edges in each sampling point with apply
sapply(get.networks(test,start=0,end=5),network.edgecount)

# generate a list of matrices
lapply(get.networks(test,start=0,end=5),as.matrix)


Run the code above in your browser using DataLab