The core of the program is essentially the following iteration loop. Nodes are added, forces calculated, and node positions updated as shown: