These functions return logical vectors the length of the nodes in a network identifying which hold certain properties or positions in the network.

  • node_is_infected() marks nodes that are infected by a particular time point.

  • node_is_exposed() marks nodes that are exposed to a given (other) mark.

  • node_is_latent() marks nodes that are latent at a particular time point.

  • node_is_recovered() marks nodes that are recovered at a particular time point.

node_is_latent(diff_model, time = 0)

node_is_infected(diff_model, time = 0)

node_is_recovered(diff_model, time = 0)

node_is_exposed(.data, mark)

Arguments

diff_model

A diff_model object, created either by play_diffusion() or as_diffusion().

time

A time step at which nodes are identified.

.data

An object of a manynet-consistent class:

  • matrix (adjacency or incidence) from {base} R

  • edgelist, a data frame from {base} R or tibble from {tibble}

  • igraph, from the {igraph} package

  • network, from the {network} package

  • tbl_graph, from the {tidygraph} package

mark

vector denoting which nodes are infected

Exposed

node_is_exposed() is similar to node_exposure(), but returns a mark (TRUE/FALSE) vector indicating which nodes are currently exposed to the diffusion content. This diffusion content can be expressed in the 'mark' argument. If no 'mark' argument is provided, and '.data' is a diff_model object, then the function will return nodes exposure to the seed nodes in that diffusion.

See also

Examples

  # To mark nodes that are latent by a particular time point
  node_is_latent(play_diffusion(create_tree(6), latency = 1), time = 1)
#>   V1    V2    V3    V4    V5    V6   
#> 1 FALSE TRUE  TRUE  FALSE FALSE FALSE
  # To mark nodes that are infected by a particular time point
  node_is_infected(play_diffusion(create_tree(6)), time = 1)
#>   V1    V2    V3    V4    V5    V6   
#> 1 TRUE  TRUE  TRUE  FALSE FALSE FALSE
  # To mark nodes that are recovered by a particular time point
  node_is_recovered(play_diffusion(create_tree(6), recovery = 0.5), time = 3)
#>   V1    V2    V3    V4    V5    V6   
#> 1 TRUE  FALSE TRUE  FALSE TRUE  FALSE
  # To mark which nodes are currently exposed
  (expos <- node_is_exposed(manynet::create_tree(14), mark = c(1,3)))
#>   V1    V2    V3    V4    V5    V6    V7    V8    V9    V10   V11   V12   V13  
#> 1 FALSE TRUE  FALSE FALSE FALSE TRUE  TRUE  FALSE FALSE FALSE FALSE FALSE FALSE
#> # ... with 1 more values from this nodeset unprinted. Use `print(..., n = Inf)` to print all values.
  which(expos)
#> [1] 2 6 7