|
1 | 1 | sigma.layout.forceAtlas2
|
2 | 2 | ========================
|
3 | 3 |
|
4 |
| -Plugin developed by [Mathieu Jacomy](https://github.com/jacomyma). |
| 4 | +Algorithm by [Mathieu Jacomy](https://github.com/jacomyma). |
| 5 | +Plugin by [Guillaume Plique](https://github.com/Yomguithereal). |
5 | 6 |
|
6 | 7 | ---
|
7 | 8 |
|
8 |
| -This plugin adds two methods to every sigma instances, `startForceAtlas2` and `stopForceAtlas2`. It implements [ForceAtlas2](http://webatlas.fr/tempshare/ForceAtlas2_Paper.pdf), a force-directed layout algorithm. |
| 9 | +This plugin implements [ForceAtlas2](http://www.medialab.sciences-po.fr/publications/Jacomy_Heymann_Venturini-Force_Atlas2.pdf), a force-directed layout algorithm. |
9 | 10 |
|
10 |
| -Basically, `myInstance.startForceAtlas2()` will start running the layout: It will spawn an atomic job in [conrad](http://jacomyal.github.io/conrad.js/) that will compute the next step. When the job is done, the `refresh` method of the instance will be called, and everything starts again. |
| 11 | +For optimization purposes, the algorithm's computations are delegated to a web worker. |
11 | 12 |
|
12 |
| -The layout will not stop by itself, and it is necessary to call `myInstance.stopForceAtlas2()`. |
| 13 | +## Methods |
| 14 | + |
| 15 | +**sigma.startForceAtlas2** |
| 16 | +Start or unpause the layout. It is possible to pass a configuration if this is the first time you start the layout. |
| 17 | + |
| 18 | +```js |
| 19 | +sigmaInstance.startForceAtlas2(config); |
| 20 | +``` |
| 21 | + |
| 22 | +**sigma.stopForceAtlas2** |
| 23 | +Pause the layout. |
| 24 | + |
| 25 | +```js |
| 26 | +sigmaInstance.stopForceAtlas2(); |
| 27 | +``` |
| 28 | + |
| 29 | +**sigma.configForceAtlas2** |
| 30 | +Change the layout's configuration after this one has started or is paused. |
| 31 | + |
| 32 | +```js |
| 33 | +sigmaInstance.configForceAtlas2(config); |
| 34 | +``` |
| 35 | + |
| 36 | +**sigma.killForceAtlas2** |
| 37 | +Completely stop the layout and terminate the assiociated worker. You can still restart it later, but a new worker will have to initialize. |
| 38 | + |
| 39 | +```js |
| 40 | +sigmaInstance.killForceAtlas2(); |
| 41 | +``` |
| 42 | + |
| 43 | +## Configuration |
| 44 | + |
| 45 | +* **linLogMode**: *boolean* `false` |
| 46 | +* **outboundAttractionDistribution** *boolean* `false` |
| 47 | +* **adjustSizes** *boolean* `false` |
| 48 | +* **edgeWeightInfluence** *number* `0` |
| 49 | +* **scalingRatio** *number* `1` |
| 50 | +* **strongGravityMode** *boolean* `false` |
| 51 | +* **gravity** *number* `1` |
| 52 | + |
| 53 | +## Notes |
| 54 | +1. *Barnes-Hut* optimizations are disabled for the time being. We need time to develop a low-level version of the optimization in order to scale efficiently. |
| 55 | + |
| 56 | +2. The layout won't stop by itself, so I you want it to stop, you have to trigger it explicitely. |
0 commit comments