force-directed-layout

Applies forces to a graph to produce a layout based on node and edge relationships.

Graph theory can be used in modeling outbreaks and epidemiological behaviours. One reference for more information about graphs: https://www.frontiersin.org/articles/10.3389/fbioe.2020.00034/full

Arguments

Inputs:

graph: A graph structure containing edges and nodes.

stiffness: The numeric indicator of the tendency for an element to return to its original form after being subjected to a force. Defaults to 400.0.

repulsion: How much the nodes should push each other away. Defaults to 400.0.

damping: The amount to lessen the force to be applied. Defaults to 0.5.

MinEnergyThreshold: The minimum amount of force that should be applied. Defaults to null.

maxSpeed: The maximum amount of speed that should be applied. Defaults to null.

Output:

graph: The new graph with all forces applied, now with x/y attributes applied to each node.

Last updated