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(.data, time = 0)

node_is_infected(.data, time = 0)

node_is_recovered(.data, time = 0)

node_is_exposed(.data, mark, time = 0)

Arguments

.data

A network object of class stocnet, igraph, tbl_graph, network, or similar. Internally any of these will be coerced to an efficient implementation. For more information on possible coercions, see e.g. manynet::as_stocnet().

time

A time step at which nodes are identified.

mark

vector denoting which nodes are infected

Value

A node_mark logical vector the length of the nodes in the network, giving either TRUE or FALSE for each node depending on whether the condition is matched.

Cognitive social structures

A cognitive social structure records each node's report of the ties in the whole network, in a by column that names who reported each tie. Counting every report as a tie of its own would count each tie once for every perceiver who reports it. So the functions here first combine the reports into the locally aggregated structure of Krackhardt (1987), with the intersection rule: a tie exists if both of its ends report it, and a message says so. A tie that names no reporter is kept as it is.

A tie-level function still returns one value for each report, so that the result can be added back to the network it was given. Each report takes the value of the tie that it reports. A report of a tie that is not in the aggregated structure takes NA, or FALSE for a mark. tie_is_random() is the exception, and draws among the reports.

To combine the reports in a different way, do this before the function, e.g. with manynet::to_aggregated(over = "by").

Krackhardt, David. 1987. "Cognitive social structures". Social Networks 9(2): 109-134. doi:10.1016/0378-8733(87)90009-8

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.

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  TRUE  FALSE FALSE FALSE 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
#> # ... and 1 more values from this nodeset. Use `print_all(...)` to print all values.
  which(expos)
#> [1] 2 6 7