How to save block states to reproduce later?
I've been looking for a while now, and I just can't find how to save a block state. If it is in the documentation, I apologize for missing it but I don't think it is. Basically, What I do is : open or create a graph, use minimize_blockmodel_dl on it, and then draw it. Blocks are there and I can query the graph for every node in each state. After saving the graph, as the blockstate model is not an internal property (and I can't find a way to make it one) and reloading it, obviously the block state is gone. If I do minimize_blockmodel_dl again on the new (but same) graph as before, I might get different results (this is a stochastic process after all, so that is expected). So How can I save the blockstate of the first algorithm, so that I can reproduce it after saving and reloading a graph (or in a different computer, or python instance)? Any and all help is greatly appreciated. -- Sent from: http://main-discussion-list-for-the-graph-tool-project.982480.n3.nabble.com/
Am 01.10.19 um 19:10 schrieb JuanEcheverria:
So How can I save the blockstate of the first algorithm, so that I can reproduce it after saving and reloading a graph (or in a different computer, or python instance)?
You can use pickle to save a BlockState to disk: https://docs.python.org/3/library/pickle.html You can also get the group memberships as a property map (via BlockState.get_blocks()) and store that as an internal property map. Best, Tiago -- Tiago de Paula Peixoto <t.peixoto@bath.ac.uk> -- Tiago de Paula Peixoto <tiago@skewed.de>
participants (2)
-
JuanEcheverria -
Tiago de Paula Peixoto