D3 Force layout
Broadly speaking there are 4 steps to setting up a force simulation:
- create an array of objects
- call
forceSimulation, passing in the array of objects - add one or more force functions (e.g.
forceManyBody,forceCenter,forceCollide) to the system - set up a callback function to update the element positions after each tick