These functions allow measurement of various features of a diffusion process:
node_by_adopt_time(): Measures the number of time steps until
nodes adopt/become infected
node_by_adopt_threshold(): Measures nodes' thresholds from the amount
of exposure they had when they became infected
node_by_adopt_recovery(): Measures the average length nodes that become
infected remain infected in a compartmental model with recovery
node_by_adopt_exposure(): Measures how many exposures nodes have to
a given mark
node_by_adopt_time(.data)
node_by_adopt_threshold(.data, normalized = TRUE, lag = 1)
node_by_adopt_recovery(.data)
node_by_adopt_exposure(.data, mark, time = 0)A network object of class mnet, igraph, tbl_graph, network, or similar.
For more information on the standard coercion possible,
see manynet::as_tidygraph().
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.
The number of time steps back upon which the thresholds are inferred.
A valid 'node_mark' object or logical vector (TRUE/FALSE) of length equal to the number of nodes in the network.
A time point until which infections/adoptions should be
identified. By default time = 0.
A node_measure numeric vector the length of the nodes in the network,
providing the scores for each node.
If the network is labelled,
then the scores will be labelled with the nodes' names.
node_by_adopt_time() measures the time units it took
until each node became infected.
Note that an adoption time of 0 indicates that this was a seed node.
node_by_adopt_threshold() infers nodes' thresholds based on how much
exposure they had when they were infected.
This inference is of course imperfect,
especially where there is a sudden increase in exposure,
but it can be used heuristically.
In a threshold model,
nodes activate when \(\sum_{j:\text{active}} w_{ji} \geq \theta_i\),
where \(w\) is some (potentially weighted) matrix,
\(j\) are some already activated nodes,
and \(theta\) is some pre-defined threshold value.
Where a fractional threshold is used, the equation is
\(\frac{\sum_{j:\text{active}} w_{ji}}{\sum_{j} w_{ji}} \geq \theta_i\).
That is, \(theta\) is now a proportion,
and works regardless of whether \(w\) is weighted or not.
node_by_adopt_recovery() measures the average length of time that nodes
that become infected remain infected in a compartmental model with recovery.
Infections that are not concluded by the end of the study period are
calculated as infinite.
node_exposure() calculates the number of infected/adopting nodes
to which each susceptible node is exposed.
It usually expects network data and
an index or mark (TRUE/FALSE) vector of those nodes which are currently infected,
but if a diff_model is supplied instead it will return
nodes exposure at \(t = 0\).
Other diffusion:
mark_diff,
measure_diffusion_infection,
measure_diffusion_net,
member_diffusion,
motif_exposure,
motif_hazard
Other measures:
measure_assort_net,
measure_assort_node,
measure_breadth,
measure_broker_node,
measure_broker_tie,
measure_brokerage,
measure_central_between,
measure_central_close,
measure_central_degree,
measure_central_eigen,
measure_centralisation_between,
measure_centralisation_close,
measure_centralisation_degree,
measure_centralisation_eigen,
measure_centralities_between,
measure_centralities_close,
measure_centralities_degree,
measure_centralities_eigen,
measure_closure,
measure_closure_node,
measure_cohesion,
measure_core,
measure_diffusion_infection,
measure_diffusion_net,
measure_diverse_net,
measure_diverse_node,
measure_features,
measure_fragmentation,
measure_hierarchy,
measure_periods
Other nodal:
mark_core,
mark_degree,
mark_diff,
mark_nodes,
mark_select_node,
measure_assort_node,
measure_broker_node,
measure_brokerage,
measure_central_between,
measure_central_close,
measure_central_degree,
measure_central_eigen,
measure_closure_node,
measure_core,
measure_diverse_node,
member_brokerage,
member_cliques,
member_community,
member_community_hier,
member_community_non,
member_components,
member_core,
member_diffusion,
member_equivalence,
motif_brokerage_node,
motif_exposure,
motif_node,
motif_path
smeg <- generate_smallworld(15, 0.025)
smeg_diff <- play_diffusion(smeg, recovery = 0.2)
plot(smeg_diff)
# To measure when nodes adopted a diffusion/were infected
(times <- node_by_adopt_time(smeg_diff))
#> ▃▃▃▂
#> V1 V2 V3 V4 V5 V6 V7 V8 V9 V10 V11 V12 V13
#> 1 0 1 1 2 2 3 3 4 4 3 3 2 2
#> # ... and 2 more values from this nodeset. Use `print_all(...)` to print all values.
# To infer nodes' thresholds
node_by_adopt_threshold(smeg_diff)
#> ▁▅▃▂
#> V1 V2 V3 V4 V5 V6 V7 V8 V9 V10 V11 V12 V13
#> 1 0 0.25 0.25 0.5 0.25 0.5 0.25 0.75 0.75 0.25 0.5 0.25 0.5
#> # ... and 2 more values from this nodeset. Use `print_all(...)` to print all values.
# To measure how long each node remains infected for
node_by_adopt_recovery(smeg_diff)
#> ▅▂▂▁▁▁
#> V1 V2 V3 V4 V5 V6 V7 V8 V9 V10 V11 V12 V13
#> 1 3 2 Inf 2 7 3 9 3 2 6 7 13 5
#> # ... and 2 more values from this nodeset. Use `print_all(...)` to print all values.
# To measure how much exposure nodes have to a given mark
node_by_adopt_exposure(smeg, mark = c(1,3))
#> ▆▃▁▁
#> V1 V2 V3 V4 V5 V6 V7 V8 V9 V10 V11 V12 V13
#> 1 0 2 0 1 1 0 0 0 0 0 0 0 0
#> # ... and 2 more values from this nodeset. Use `print_all(...)` to print all values.
node_by_adopt_exposure(smeg_diff)
#> ▆▁▁▁▃
#> V1 V2 V3 V4 V5 V6 V7 V8 V9 V10 V11 V12 V13
#> 1 0 1 1 0 0 0 0 0 0 0 0 0 0
#> # ... and 2 more values from this nodeset. Use `print_all(...)` to print all values.