Learn R Programming

networkDynamic (version 0.11.5)

duration.matrix: Construct a edge spells list from base network and toggle list.

Description

Given a network object and a toggle list, it will construct a list of edges and activity spells and return that as a data frame. The network object does not need to have edges; it only needs to have enough vertices to cover all the edges specified in the toggle list.

The toggle list should be a three column matrix or data frame, where the first column is the toggle time, the second column is the tail vertex id of the edge, and the third column is the head vertex id of the edge. A toggle represents a switch from active state to inactive, or vice-versa.

Usage

duration.matrix(nw0, changes, start, end)

Value

Returns a data frame that lists the edge spells specified by the toggles. The columns in the data frame are

start end tail head left.censored right.censored duration. Left and right censoring and duration are calculated automatically from the toggle list and the start and end times.

Arguments

nw0

an object of class network

changes

a matrix or data frame, listing the toggles for edges as specified in the above description

start

integer, specifies the starting time of the network's dynamic activity

end

integer, specifies the ending time of the network's dynamic activity

Author

Ayn Leslie-Cook aynlc3@uw.edu, Carter T. Butts buttsc@uci.edu

See Also

as.networkDynamic

Examples

Run this code
  library(networkDynamic)
  # duration matrix test
  net <-network.initialize(3)
  net[1,2]<-1;
  net[2,3]<-1;
  net[1,3]<-1;
  class(net)
  # toggle list: time, tail, head
  tog=matrix(c(1,1,2, 1,2,3, 2,1,2, 4,1,3, 4,1,2), ncol=3, byrow=TRUE)
  networkDynamic:::duration.matrix(net, tog, 0, 5)

Run the code above in your browser using DataLab