Network - physics

Handles the physics simulation, moving the nodes and edges to show them clearly.

Options

The options for the physics have to be contained in an object titled 'physics'.

Click on the full options or shorthand options to show how these options are supposed to be used.


All of the individual options are explained here:

NameTypeDefaultDescription
enabled Boolean true Toggle the physics system on or off. This property is optional. If you define any of the options below and enabled is undefined, this will be set to true.
barnesHut Object Object BarnesHut is a quadtree based gravity model. This is the fastest, default and recommended solver for non-hierarchical layouts.
forceAtlas2Based Object Object Force Atlas 2 has been developed by Jacomi et al (2014) for use with Gephi. The forceAtlas2Based solver makes use of some of the equations provided by them and makes use of the barnesHut implementation in vis. The main differences are the central gravity model, which is here distance independent, and the repulsion being linear instead of quadratic. Finally, all node masses have a multiplier based on the amount of connected edges plus one.
repulsion Object Object The repulsion model assumes nodes have a simplified repulsion field around them. It's force linearly decreases from 1 (at 0.5*nodeDistance and smaller) to 0 (at 2*nodeDistance).
hierarchicalRepulsion Object Object This model is based on the repulsion solver but the levels are taken into account and the forces are normalized.
maxVelocity Number 50 The physics module limits the maximum velocity of the nodes to increase the time to stabilization. This is the maximium value.
minVelocity Number 0.1 Once the minimum velocity is reached for all nodes, we assume the network has been stabilized and the simulation stops.
solver String 'barnesHut'You can select your own solver. Possible options: 'barnesHut', 'repulsion', 'hierarchicalRepulsion', 'forceAtlas2Based'. When setting the hierarchical layout, the hierarchical repulsion solver is automaticaly selected, regardless of what you fill in here.
stabilization Object | BooleanObject When true, the network is stabilized on load using default settings. If false, stabilization is disabled. To further customize this, you can supply an object.
timestep Number 0.5 The physics simulation is discrete. This means we take a step in time, calculate the forces, move the nodes and take another step. If you increase this number the steps will be too large and the network can get unstable. If you see a lot of jittery movement in the network, you may want to reduce this value a little.
adaptiveTimestep Boolean true If this is enabled, the timestep will intelligently be adapted (only during the stabilization stage if stabilization is enabled!) to greatly decrease stabilization times. The timestep configured above is taken as the minimum timestep. This can be further improved by using the improvedLayout algorithm.
useWorker Boolean false If this is enabled, the physics calculation will be performed in a separate thread. The file vis.physics.worker.js must be available from the same webserver hosting vis.js at the same path. If you are embedding vis into a javascript bundle, you can set the script id to "visjs" to enable path resolution. If the worker fails for any reason, the system will fall back to standard physics calculations. WorkInProgress: This has only been tested with default physics selections and does not attempt to optimize stabilization. Has not been optimized for small changes to underlying dataset, so each change will cause all data to be recopied to the worker thread.