Force-Directed Layout Algorithm

Force-based layout algorithms simulate a graph as a physical system by assigning forces as if the edges were springs and the nodes were electrically charged particles and finds an equilibrium state as a final result. It can achieve high-quality results that have more or less uniform edge length and uniform node distribution, and also reflect inherent symmetry.

The following tutorial helps you to understand how force-directed layout works and what are the characteristics of the supported layouts.

Click here to see the video as in the presentation format.

AllegroLayout Control Panel

Layout Setting
  • Layout Mode
    • Normal
      The conventional blocking layout mode.
      This mode consumes less CPU resources.
    • Animated
      The blocking layout mode with the layout animation.
      The network view will show how nodes move in real time.
    • Interactive
      A Network view is animated in real time and a started layout will continue processing until a user stop it.
      An active layout processing can be guided by selecting and moving nodes, showing/hiding, adding/deleting nodes & edges, changing the visual style of a network view and the layout parameters. All the changes in a graph and the parameters are applied immediately while a layout is running.
  • Selected Nodes Only
    If it is set, the selected nodes are only laid out.
    In the interactive mode, you can select a group of nodes multiple times without restarting the layout.
  • Randomize Positions Before Layout
    If it is set, nodes are randomly placed and then layout is performed.
  • Maximum Iterations (Normal & Interactive Only)
    You can set the maximum layout iterations, but it usually does not need to be changed because AllegroLayout automatically stops when layout is converged.
  • No-overlap Iterations (Normal & Interactive Only)
    If it is set, additional iterations for no-overlap will be processed after the normal iterations are completed.
    This iterations helps overlapped nodes to be placed into non-overlapped locations.

Accelerated Computing
  • OpenCL Device
    A user can see supported OpenCL devices on the system and select one of them to accelerate the layout speed.
    If No Acceleration is selected, the OpenCL acceleration is disabled and the single-threaded Java implementation is used. The No Acceleration mode is useful for a small graph having less than 256 nodes. This small graph does not benefit from the massive parallel OpenCL-acclerated implemetation in most cases.

Connected Components
  • Component Processing
    • As a whole
      All the nodes are processed as single graph and all the pairs of nodes have repulsive force. If a graph is composed of more than a connected component, you can control how closely components get together by adjusting the gravity.
    • Independently
      Each component is laid out independently. It has individual gravity toward its center and there are only repulsive forces among nodes in the same component.
  • Component Sorting
    If the sorting is enabled, the components are arranged in order of their node counts. Otherwise, they are not arranged and can be freely moved by dragging some nodes in the interactive layout mode.
    This option can be applied only in case of the independent mode for component processing.

Layout Algorithm
The selected force model of layout algorithm.

  • Allegro Spring-Electric
    Modeling nodes as electrically charged particle and edges as springs. Edges have more or less uniform length.
  • Allegro Fruchterman-Reingold
    It uses Fruchterman-Reingold force model and is similar to the Spring-Electric, but nodes have stronger repulsive force from distant nodes.
  • Allegro Weak Clustering
    Highly connected group of nodes gets closer. You can see clusters more clearly.
  • Allegro Strong Clustering
    Nodes in a cluster get much closer. It binds clustered nodes more tightly, while the distances between clusters are increased. It focuses more on showing clusters and their relationship than the weak clustering model.
  • Edge-Repulsive Layouts
    They have the same edge attraction models, but nodes having more edges repel other nodes more strongly. They are useful for a graph having densely connected nodes.

You can get more detailed information in the force-directed layout algorithm tutorial on the top.

Algorithm Tunnings
  • Scale
    The default value is 100%. As it is smaller than 100%, the distances between nodes get smaller.
  • Use Gravity
    If it is set, the gravity value is used. Otherwise, the gravity value is ignored and no gravity is used.
  • Gravity Type
    • No Gravity: no gravity is used so that the gravity value is ignored.
    • Circular: the gravity force field has a circular shape.
    • Rectangular: the gravity force field has a rectangular shape.
  • Gravity Value
    As it is bigger than 100%, nodes move closer to the center. The default value is 100%.
  • Preventing Nodes from Overlapping (Interactive Mode Only)
    If it is set, overlapped nodes are automatically placed into non-overlapped locations.
    Note that this option could make overall layout progress very slow. The common use case is to turn it on after a graph layout is almost done or converged.

Edge Weighting
  • Weight Using
    If an edge attribute is selected, the layout algorithm uses its values as edge weights.
    If (none) is selected, edge weighting is disabled. In other words, it uses 1.0 for all the edge weights.
  • Default Edge Weight
    It is used only if an edge attribute is selected but an edge has no value for the attribute.
  • Use Normalized Weights
    If it is set, the normalized weights are not used. Otherwise, the algorithm uses the original values of the selected edge attribute as edge weights.
  • Weight for Flooring
    Smaller weights than this value are set into the value before edge weights are normalized.
  • Weight for Ceiling
    Greater weights than this value are set into the value before edge weights are normalized.
  • Weight Transform
    How to normalize the weight values.
  • Normalized Min weight
    The minimum value after normalising edge weights.
  • Normalized Max weight
    The maximum value after normalising edge weights.