Network - layout

Acts as the camera that looks on the canvas. Does the animation, zooming and focusing.


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

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

When enabling the hierarchical layout, it overrules some of the other options. The physics is set to the hierarchical repulsion solver and dynamic smooth edges are converted to static smooth edges.

Name Type Default Description
randomSeed Number or String undefined When NOT using the hierarchical layout, the nodes are randomly positioned initially. This means that the settled result is different every time. If you provide a random seed manually, the layout will be the same every time. Ideally you try with an undefined seed, reload until you are happy with the layout and use the getSeed() method to ascertain the seed.
improvedLayout Boolean true When enabled, the network will use the Kamada Kawai algorithm for initial layout. For networks larger than 100 nodes, clustering will be performed automatically to reduce the amount of nodes. This can greatly improve the stabilization times. If the network is very interconnected (no or few leaf nodes), this may not work and it will revert back to the old method. Performance will be improved in the future.
clusterThreshold Number 150 Cluster threshold to which improvedLayout applies.
hierarchical Object or Boolean Object When true, the layout engine positions the nodes in a hierarchical fashion using default settings. For customization you can supply an object.

Third party docs: