## ----echo = FALSE, include = FALSE-------------------------------------------- knitr::opts_chunk$set( collapse = TRUE, comment = "#>" ) ## ----setup, echo = FALSE, include = FALSE------------------------------------- library(EpiModel) ## ----eval = FALSE------------------------------------------------------------- # # Get the network for layer 1 # nw <- get_network(dat, network = 1) # # # After modifying a network, set it back # dat <- set_network(dat, network = 1, nw = nw) ## ----eval = FALSE------------------------------------------------------------- # sim <- netsim(est, param, init, control) # # # Extract the network from simulation 1, network layer 1 # nw <- get_network(sim, sim = 1, network = 1) # # # Collapse to a static cross-section at time step 50 (full mode only) # nw_at_50 <- get_network(sim, sim = 1, collapse = TRUE, at = 50) ## ----eval = FALSE------------------------------------------------------------- # transmat <- get_transmat(sim, sim = 1) ## ----eval = FALSE------------------------------------------------------------- # el <- get_edgelist(dat, network = 1) ## ----eval = FALSE------------------------------------------------------------- # # All networks # el_all <- get_edgelists_df(dat, networks = NULL) # # # Specific networks # el_12 <- get_edgelists_df(dat, networks = c(1, 2)) ## ----eval = FALSE------------------------------------------------------------- # disc_el <- get_discordant_edgelist( # dat, # status.attr = "status", # head.status = "i", # tail.status = "s" # ) ## ----eval = FALSE------------------------------------------------------------- # control <- control.net( # type = "SI", # nsims = 1, # nsteps = 100, # cumulative.edgelist = TRUE, # Enable tracking during simulation # save.cumulative.edgelist = TRUE, # Save in output after simulation # verbose = FALSE # ) ## ----eval = FALSE------------------------------------------------------------- # dat <- update_cumulative_edgelist(dat, network = 1, truncate = Inf) ## ----eval = FALSE------------------------------------------------------------- # for (n_network in seq_len(dat$num.nw)) { # dat <- update_cumulative_edgelist(dat, n_network, truncate = 100) # } ## ----eval = FALSE------------------------------------------------------------- # el_cuml <- get_cumulative_edgelist(dat, network = 1) ## ----eval = FALSE------------------------------------------------------------- # el_cumls <- get_cumulative_edgelists_df(dat, networks = NULL) ## ----eval = FALSE------------------------------------------------------------- # partner_list <- get_partners( # dat, # index_posit_ids, # networks = NULL, # truncate = Inf, # only.active.nodes = FALSE # ) ## ----eval = FALSE------------------------------------------------------------- # cum_degree <- get_cumulative_degree( # dat, # index_posit_ids = 1:50, # networks = NULL, # truncate = Inf, # only.active.nodes = FALSE # ) ## ----eval = FALSE------------------------------------------------------------- # el_cuml <- get_cumulative_edgelist(dat, network = 1) # # fwd <- get_forward_reachable( # el_cuml, # from_step = 1, # to_step = 52, # nodes = c(10, 25, 42), # NULL for all nodes with edges # dense_optim = "auto" # ) ## ----eval = FALSE------------------------------------------------------------- # bkwd <- get_backward_reachable( # el_cuml, # from_step = 1, # to_step = 52, # nodes = c(10, 25, 42) # ) ## ----eval = FALSE------------------------------------------------------------- # progressr::with_progress({ # fwd <- get_forward_reachable(el_cuml, from_step = 1, to_step = 260) # })