Learn R Programming

networkDynamic (version 0.4.1)

is.active: Determine Activation State of Edges and Vertices

Description

Query the activity state of one or more network elements (edges or vertices) for either a single time point or an extended interval.

Usage

is.active(x, onset = NULL, terminus = NULL, length = NULL, at = NULL, e = NULL, v = NULL, 
    rule = c("any", "all"), active.default = TRUE)

Arguments

x
an object of class network.
onset
an optional vector of timepoints that specifies the start of the queried interval(s). This must be accompanied by one of terminus or length.
terminus
an optional vector of timepoints that specifies the end of the queried interval(s). This must be accompanied by one of onset or length.
length
an optional vector of interval lengths for the queried interval(s). This must be accompanied by one of onset or terminus.
at
an optional vector of single time point(s) to query.
e
a vector of edge IDs to evaluate.
v
a vector of vertex IDs to evaluate.
rule
a character string indicating the definition of "active" for this query: any (default) to define active as any active spell during the interval, or all to define active as being active over the entire interval.
active.default
logical; should elements without an activity attribute be regarded as active by default?

Value

  • A logical vector indicating the activity states.

Details

This function can be used to query the activity status of an element at single time point, or over an interval. The specification of timepoints and intervals is the same as for the activate function. The general rules are discussed in activity.attribute. To query status at a single time point, use one of the following:
  • theatargument, or
  • setonset=terminus.
To query status over a particular interval, one of the following valid combinations of onset, terminus and length is required:
  • onsetandterminus.
  • onsetandlength.
  • terminusandlength.
  • or, you can specify no information.
If the query is specified with no timing information the spell is defined as (-Inf,Inf). The query interval spans the period from the onset (inclusive) to the terminus (exclusive), so [onset,terminus). There are some special behaviors associated with the arguments Inf and -Inf.
  • The open-ended intervalc(-Inf,x)includes-Inf. For consistency, we also allow the open-ended intervalc(x, Inf)to includeInf. Thus [onset, terminus) will be interpreted as [onset, terminus] when terminus =Inf.
  • Queries for intervals specified byc(Inf, Inf)orc(-Inf, -Inf)are ignored.

See Also

activity.attribute, activate

Examples

Run this code
triangle <- network.initialize(3)  # create a toy network
add.edge(triangle,1,2)    # add an edge between vertices 1 and 2
add.edge(triangle,2,3)    # add more edges
add.edge(triangle,3,1)

# turn on all edges at time 1 only (0 length spell)
activate.edges(triangle,at=1) 
# activate edge (1,2) from t=2 to t=3
activate.edges(triangle,onset=2, terminus=3,
               e=get.edgeIDs(triangle,v=1,alter=2))
# activate edge (2,3) from t=4 for 2 time lengths
activate.edges(triangle,onset=4, length=2, 
               e=get.edgeIDs(triangle,v=2,alter=3))

# are the edges active at a particular time?
is.active(triangle, at=1, e=1:3)
is.active(triangle, at=4, e=1:3)

Run the code above in your browser using DataLab