So, does this untangle snake maps as well? Those are one of the things that are trivially to untangle and the one thing I always wished was that they would make some sort of design without crossing over on each other.
But I happy settle for a simple grid layout or a large spiral when untangled.
The force-directed method is actually not good at getting the snake to overlap, though it does do a good job at shortening the map-crossing links.
I added an additional rule that increases the repulsive force between two planets based on the number of hops between those two planets, and that caused the snakes to no longer overlap but also caused it to compress large chunks of planets very close together because it really makes no effort to use all available space, etc. So I only left a very mild version of that rule in because overlapping snakes are better than snakes where 30 planets all occupy a contiguous bright ball
But I'm testing a small alteration to the routine that, just for snake maps, lays all the planets out in a sort of spiral before actually doing the untangling, so that the untangling can then just make it look more natural.