EpiModel / EpiModelHPC

High-Performance Computing Extensions for EpiModel
http://epimodel.github.io/EpiModelHPC/
6 stars 2 forks source link

Equivalent function to deactivate.edges #11

Open thednainus opened 3 years ago

thednainus commented 3 years ago

I have just started to have a look at the tergmLite package to see if I can make my simulations faster and mayeb use less memory (?) as I am mainly interested in the transmission matrix. My test simulations in the cluster are very slow and using a lot of memory and maybe using tergmLite = TRUE would make it faster. Is there an equivalent function to deactivate.edges in the tergmLite package? Should I just remove the line below in the delete_vertices function?

https://github.com/statnet/tergmLite/blob/b5a7ccfe054fed7709b0cb6b6e3c93a346ca0342/R/update.R#L128

I don't quite understand what the function shiftVec is doing.

Thanks!

smjenness commented 3 years ago

It is likely that tergmLite will make your simulations much faster. No, there is no equivalent function for deactivate.edges because tergmLite works only with the cross-sectional edgelist, you can just delete any edges as needed. For example:

edges.to.delete <- XXX
el <- el[-edges.to.delete, , drop = FALSE]

A specialized function for vertices is needed because deleting vertices identified by a positional ID requires shifting the positional IDs of the remaining vertices in the edgelist with a prior higher ID number downward (e.g., node 3 dies, then node 4 becomes node 3, and all of node 4's edges have to updated accordingly). That's what shiftVec does.

thednainus commented 3 years ago

The meaning of el is list of edges (edges ID)? Or Are actually IDs of vertices?

smjenness commented 3 years ago

el is the edgelist, which is a two-column matrix of edges in the cross section