@amsi as I mentioned earlier, I think this seem to be a networkx question, not a Bokeh one, This line:
graph_renderer = from_networkx(Gg, nx.spring_layout, scale=1, center=(0, 0))
configures networkx to use the “spring layout”. That is part of networkx, not part of Bokeh. AFAIK it will generate a new random spring layout every time it is used. There are other layouts provided by networkx:
https://networkx.github.io/documentation/stable/reference/drawing.html#layout
It’s possible some of those are more stable / will generate the same layout reliably. I am afraid I don’t know, you will have to try / investigate on your own. If not, or if you really want a spring layout, you would need to compute your layout once, I think you can just call nx,spring_layout yourself:
layout = nx.spring_layout(Gg)
And then you can pass this layout to from_networkx. But again, AFAIK nx.spring_layout will return a different layout every time it is called. So if you really want this to be the same in between different processs, you will have to find a way to persist the returned layout outside the process and re-load it. (Maybe a simple pickle woudl suffice, I don’t know) And of course: that can only possibly be expected work if the input graph is the same in every process.