Module imp2d

Class ForceBasedLayout

All Implemented Interfaces:
Manageable, Shareable
Direct Known Subclasses:
DavidsonHarelLayout, EadesLayout, FruchtermanReingoldLayout, SpringLayout

public abstract class ForceBasedLayout extends Layout
A ForceBasedLayout computes a graph layout based on a force model. The concrete force model has to be implemented in subclasses.
Author:
Ole Kniemeyer
  • Field Details

    • connectedNodesSize

      public int connectedNodesSize
    • nodesSize

      public int nodesSize
    • $TYPE

      public static final ForceBasedLayout.Type $TYPE
    • relaxation$FIELD

      public static final SCOType.Field relaxation$FIELD
    • displayTransformation$FIELD

      public static final SCOType.Field displayTransformation$FIELD
    • accuracy$FIELD

      public static final SCOType.Field accuracy$FIELD
    • count$FIELD

      public static final SCOType.Field count$FIELD
    • startWithRandom$FIELD

      public static final SCOType.Field startWithRandom$FIELD
  • Constructor Details

    • ForceBasedLayout

      public ForceBasedLayout()
  • Method Details

    • setStartWithRandom

      public void setStartWithRandom(boolean value)
    • createAlgorithm

      protected Layout.Algorithm createAlgorithm()
      Description copied from class: Layout
      Creates an algorithm for this layout.
      Specified by:
      createAlgorithm in class Layout
      Returns:
      a new Algorithm instance
    • computeForce

      protected abstract void computeForce(Node s, Node t, Vector2f force)
      Computes the force contribution of a pair of nodes. This method is invoked for every pair of nodes, whether they are connected or not. The computed force should be anti-symmetric with respect to s and t, i.e., if these parameters are exchanged, the resulting force should be the negative of the original force.
      Parameters:
      s - the source node
      t - the target node
      force - the force in the direction from s to t has to be placed in here
    • computeForce

      protected abstract void computeForce(Edge e, Vector2f force)
      Computes the force contribution of an edge. This method is invoked for every edge of the graph.
      Parameters:
      e - an edge
      force - the force in the direction from edge.source to edge.target has to be placed in here
    • setRandomPosition

      protected abstract void setRandomPosition(Node nodeTemp, Random rnd)