There is a small change to the networkx
package which makes it behave how I want, as per this answer.
I.e. I just need to add this code to one of the files in the package code.
# ADD THIS LINE - prevent things from flying off into infinity if not connected
displacement = displacement - pos / ( k * np.sqrt(nnodes))
Is there a way to do this programatically without actually modifying the source code? Would this be a case of "monkey patching"? If it's possible, how do I do it please?