giny.util
Class ForceDirectedLayout

java.lang.Object
  extended byginy.util.AbstractLayout
      extended byginy.util.ForceDirectedLayout

public class ForceDirectedLayout
extends AbstractLayout

An implementation of a directed-force layout using logarithmic springs and electrical forces, as discussed in Chapter 10 of the book "Graph Drawing".

However, note that the implementation is a bit different to the equation 10.2 in the book such that:

I am not a mathematician, but the above adjustments to the equation greatly improved the force-directed layout.

Author:
Jesus M. Salvo Jr., Rowan H Christmas

Field Summary
 
Fields inherited from class giny.util.AbstractLayout
currentSize, graphView, staticNodes
 
Constructor Summary
ForceDirectedLayout(GraphView g)
           
 
Method Summary
 void advancePositions()
          Relaxation step.
 void doLayout()
           
 boolean incrementsAreDone()
          For now, we pretend it never finishes.
protected  void initialize_local_node_view(NodeView v)
          Initializes the local information on a single vertex.
protected  void initialize_local()
          Initializes all local information, and is called immediately within the initialize() process.
 boolean isIncremental()
          This one is an incremental visualization
 
Methods inherited from class giny.util.AbstractLayout
dontMove, forceMove, getCurrentSize, getNodeView, getStatus, initialize, initializeLocation, initializeLocations, lockNodes, lockVertex, resize, restart, unlockVertex
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ForceDirectedLayout

public ForceDirectedLayout(GraphView g)
Method Detail

initialize_local

protected void initialize_local()
Description copied from class: AbstractLayout
Initializes all local information, and is called immediately within the initialize() process. The user is responsible for overriding this method to do any construction that may be necessary: for example, to initialize local per-edge or graph-wide data.

Specified by:
initialize_local in class AbstractLayout

initialize_local_node_view

protected void initialize_local_node_view(NodeView v)
Description copied from class: AbstractLayout
Initializes the local information on a single vertex. The user is responsible for overriding this method to do any vertex-level construction that may be necessary: for example, to attach vertex-level information to each vertex.

Specified by:
initialize_local_node_view in class AbstractLayout

doLayout

public void doLayout()
Specified by:
doLayout in class AbstractLayout

isIncremental

public boolean isIncremental()
This one is an incremental visualization


incrementsAreDone

public boolean incrementsAreDone()
For now, we pretend it never finishes.


advancePositions

public void advancePositions()
Relaxation step. Moves all nodes a smidge.

Specified by:
advancePositions in class AbstractLayout
See Also:
Layout#advancePositions()