This example allows you add, move, or remove robots from the network (left-click, drag and drop, and right-click, respectively).
Robots exchange their coordinates and move incrementally to a proper location based on virtual forces that combine spring forces, to regulate the distance between nodes, and angular forces, to regulate the angles between nodes in absence of triangle. The latter has the effect of biconnecting the network, thereby making it tolerant to the failure of any single node. More details in this paper.
You can test the algorithm yourself by downloading angularforces.jar, which includes source code + JBotSim 1.0-prealpha19. The JAR can be executed by typing java -jar angularforces.jar in a terminal (or by setting the file as executable in your explorer).