You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the current form, the function networkDynamic() is prohibitively slow for converting a list of panel networks of moderate to large size to a dynamicNetwork object (for example, a list of 2 networks with ~8000 nodes and 16k edges is taking on the order of hours). As far as I can tell, this issue stems from the implementation of a for-loop through all edges of the network here:
Based on the comments in the code, I am wondering if tergm or anything else already has a different way of taking on this task that is more efficient. I'm having trouble figuring out where exactly tergm does this, but I think it must do something similar when simulating. Perhaps an operation performed on a stack of sparse sociomatrices would be applicable here?
I would be surprised if tergmLite really required storing a network list (in typical use cases).
Looping over (a large number of) inputs and growing the output at each iteration can be slow as growing often means copying (in R). It is sometimes possible to rewrite the code in such a way that repeated copying is avoided.
tergm applies changes to the networkDynamic using this function:
I am using networkDynamic outside of the tergm context, specifically working with a list of networks that are output from EpiModel simulations with duration = 1 (which unlike longer durations does not store a networkDynamic object). Converting to networkDynamic class is useful both for creating movies with ndtv as well as analyzing distributions of tie duration and other dynamic network properties.
From the link @chad-klumb sent, I see now why the tergm case is different than the post-hoc conversion of the list of networks. So it seems like I'd need to tweak the networkDynamic code originally linked for it to be more efficient?
Activity
martinamorris commentedon Jul 19, 2021
@chad-klumb given your recent work on
tergmandtergmLitedo you have any thoughts on this?chad-klumb commentedon Jul 20, 2021
I would be surprised if tergmLite really required storing a network list (in typical use cases).
Looping over (a large number of) inputs and growing the output at each iteration can be slow as growing often means copying (in R). It is sometimes possible to rewrite the code in such a way that repeated copying is avoided.
tergm applies changes to the networkDynamic using this function:
https://github.com/statnet/tergm/blob/b13a3a47c778eb325233073be62795fa5dd14309/R/stergm.utils.R#L153-L232
martinamorris commentedon Jul 21, 2021
@ThomasKraft are you using
networkDynamicoutside of thetergmortergmLitecontexts? e.g. for network movies viandtv?ThomasKraft commentedon Jul 21, 2021
I am using
networkDynamicoutside of thetergmcontext, specifically working with a list of networks that are output fromEpiModelsimulations with duration = 1 (which unlike longer durations does not store a networkDynamic object). Converting tonetworkDynamicclass is useful both for creating movies withndtvas well as analyzing distributions of tie duration and other dynamic network properties.From the link @chad-klumb sent, I see now why the
tergmcase is different than the post-hoc conversion of the list of networks. So it seems like I'd need to tweak thenetworkDynamiccode originally linked for it to be more efficient?