Learn R Programming

timeordered (version 1.0.1)

applynetworkfunction: Applies a function (typically a descriptive statistic) to multiple time-aggregated networks

Description

-

Usage

applynetworkfunction(slices, fun)

Value

A list whose entries represent the function's value for each network

Arguments

slices

A list of time-aggregated networks, of class igraph

fun

The function to be applied; takes a single argument

Author

Benjamin Blonder bblonder@email.arizona.edu.

See Also

generatenetworkslices,

Examples

Run this code
data(ants)
allindivs <- c(union(as.character(ants$VertexFrom), as.character(ants$VertexTo)), "NULL1", "NULL2")
g <- generatetonetwork(ants, allindivs)
td100 <- generatetimedeltas(0,1500,100)
ns100 <- generatenetworkslices(g, td100)
md100 <- applynetworkfunction(ns100, diameter)
tl100 <- generatetimelags(0,1500,100)
nl100 <- generatenetworkslices(g, tl100)
ml100 <- applynetworkfunction(nl100, function(x){diameter(x)})
par(mfrow=c(1,2))
plot(midpoints(td100),unlist(md100),type="l",xlab="Time (window size = 100)",ylab="Diameter")
plot(maxpoints(tl100),unlist(ml100),type="l",xlab="Aggregation time",ylab="Diameter")

Run the code above in your browser using DataLab