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.

You can use pickle to save a BlockState to disk:

You can also get the group memberships as a property map (via
BlockState.get_blocks()) and store that as an internal property map.