These functions allow measurement of various features of a diffusion process at the network level:

  • net_by_infection_complete() measures the number of time steps until (the first instance of) complete infection. For diffusions that are not observed to complete, this function returns the value of Inf (infinity). This makes sure that at least ordinality is respected.

  • net_by_infection_total() measures the proportion or total number of nodes that are infected/activated at some time by the end of the diffusion process. This includes nodes that subsequently recover. Where reinfection is possible, the proportion may be higher than 1.

  • net_by_infection_peak() measures the number of time steps until the highest infection rate is observed.

net_by_infection_complete(.data)

net_by_infection_total(.data, normalized = TRUE)

net_by_infection_peak(.data)

Arguments

.data

Network data with nodal changes, as created by play_diffusion(), or a valid network diffusion model, as created by as_diffusion().

normalized

Logical scalar, whether scores are normalized. Different denominators may be used depending on the measure, whether the object is one-mode or two-mode, and other arguments. By default TRUE.

Value

A network_measure numeric score.

The object also carries the measure it computed, the range its values can fall within, and whether and how those values were normalized. These are shown as a one-line header when the object is printed. Where a measure offers a choice between several ways of counting the same thing, it also carries the variant it used. All can be retrieved with attr().

Examples

  smeg <- generate_smallworld(15, 0.025)
  smeg_diff <- play_diffusion(smeg)
  net_by_infection_complete(smeg_diff)
#> # Time to complete infection [1, Inf)
#> [1] Inf
  net_by_infection_total(smeg_diff)
#> # Total infections, normalized [0, Inf)
#> [1] 1
  net_by_infection_peak(smeg_diff)
#> # Time to peak infection [1, Inf)
#> [1] 3