cytoscape/cytoscape.js — pull request #697 by rmosca (2014-10-30 09:53:18+00:00)
Title: Implemented the 'spread' layout. It is basically a force directed layout

Hi Max,
I have implemented a new layout which is called 'spread' layout. It is basically a force directed layout + a relaxation step that fixes clashes between nodes and enforce a minimum distance between them (minDist parameter).
The force directed layout is implemented by using the 'foograph' library https://code.google.com/p/foograph/), which is based on the Fruchterman-Reingold algorithm (doi:10.1002/spe.4380211102).
The relaxation step is based on Voronoi tassellation as described in Gansner and North (doi:10.1007/3-540-37623-2_28), and is implemented using the rhill-voronoi-library (https://github.com/gorhill/Javascript-Voronoi).
Finally, in order to use web workers, when available, I used the parallel.js library which actually needed a trick to find out the path of the eval.js file in order to work.

The result of the layout depends strongly on how you set the minDist parameter and is usually like the results of the arbor layout but with an additional spreading of the nodes so that they do not overlap. It can resemble a grid but with the nodes distributed based on their pattern of connections, rather than randomly.

I am not a skilled Javascript programmer so I had to make heavy used of third-party libraries. Therefore I don't know if my implementation is any good for being taken into consideration for integration inside the standard distribution.

I open this pull request in order to ask you if you have the time to give a look at the code and tell me:

- if the layout might be interesting to the other Cytoscape.js users
- if I can do anything to improve the implementation

Let me know.

Best,
Roberto