age.at: Age of active edges or vertices at a query time point

age.atR Documentation

Age of active edges or vertices at a query time point

Description

Reports the age of edges or vertices at a specific time point. More precisely, the duration of time between the query time point and the onset of the activity spell active at that point.

Usage

edges.age.at(nD, at, e = seq_along(nD$mel), active.default = TRUE)
dyads.age.at(nD, at, tails, heads, active.default=TRUE,
                    format.out = c("vector", "edgelist", "matrix"))
vertices.age.at(nD, at, v=seq_len(network.size(nD)), active.default=TRUE)

Arguments

nD

a networkDynamic object to be evaluated

at

numeric query time point which edge or vertex ages should be evaluated at

e

numeric vector of edges ids for which ages / durations should be reported

v

numeric vector of vertex ids for which ages / durations should be reported

tails

numeric vector of vertex ids incident on the 'tail' of edges for which ages / durations should be reported

heads

numeric vector of vertex ids incident on the 'head' of edges for which ages / durations should be reported

active.default

logical, if TRUE edges or vertices with no activity specified will be considered always active (see is.active)

format.out

character value indicating out the output should be structured. vector returns output as a vector, edgelist returns a 3-column matrix in which the first columns are the tail and head vertex ids of the edge and the 3rd column is the age, matrix returns an adjacency matrix with the edge ages as values.

Details

Edges or vertices that are not active at time at will return NA. For edges or vertices with multiple activity spells, this function does not report the total duration of activity across all spells, only the duration from the start of the spell with which the at point intersects.

dyads.age.at reports the age of edges corresponding to each dyad (tail,head). It cannot be used with hypergraphic or multiplex networks because a pair of vertex ids may not uniquely correspond to an edge. If tails and heads are not specified, they will default to the tails and heads of all existing (but not necessarily active) edges in the network. Ordering and index position should correspond to valid.eids.

Value

By default, a numeric vector indicating the age of the network element at the query time point, or NA if the element is not active or (in the case of edges) deleted. Elements of the vector return correspond to the values of e or v or (tails,heads) respectively.

Author(s)

skyebend

See Also

See also get.edge.activity, is.active

Examples

# set up an example network for testing
test<-network.initialize(5)
add.edges(test,tail = 1:4,head=2:5 )
activate.edges(test,onset=0:2,terminus=c(2,3,3),e=1:3)
activate.vertices(test,v = 1:4,onset=-3:0,terminus=5:8)

# how old are each of the edges at time point 2.0 ?
edges.age.at(test,at=2.0)

# how old is vertex id 2 time point 3
vertices.age.at(test,at=3, v=2)

# how old are the edges [1,2] and [3,4] at time point 2
dyads.age.at(test,at=2,tails=c(1,3),heads=c(2,4))

dyads.age.at(test,at=2,format.out='matrix')


networkDynamic documentation built on May 29, 2024, 1:16 a.m.