de.cau.cs.kieler.klay.force.model
Class FruchtermanReingoldModel

java.lang.Object
  extended by de.cau.cs.kieler.core.alg.AbstractAlgorithm
      extended by de.cau.cs.kieler.klay.force.model.AbstractForceModel
          extended by de.cau.cs.kieler.klay.force.model.FruchtermanReingoldModel
All Implemented Interfaces:
IAlgorithm

public class FruchtermanReingoldModel
extends AbstractForceModel

A force model after the Fruchterman-Reingold approach.

Rating red

Constructor Summary
FruchtermanReingoldModel()
           
 
Method Summary
static double attractive(double d, double k)
          Calculates the amount of attracting force along a distance.
protected  KVector calcDisplacement(FParticle forcer, FParticle forcee)
          Calculate a displacement for the given particles.
protected  void initialize(FGraph graph)
          Initialize the force model with the given graph.
protected  void iterationDone()
          Perform all necessary calculations after a full iteration.
protected  boolean moreIterations(int count)
          Determine whether more iterations need to be performed.
 
Methods inherited from class de.cau.cs.kieler.klay.force.model.AbstractForceModel
avoidSamePosition, getGraph, getRandom, layout
 
Methods inherited from class de.cau.cs.kieler.core.alg.AbstractAlgorithm
getMonitor, reset, reset, setProgressMonitor
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FruchtermanReingoldModel

public FruchtermanReingoldModel()
Method Detail

initialize

protected void initialize(FGraph graph)
Initialize the force model with the given graph. Subclasses that override this must call the superclass method first.

Overrides:
initialize in class AbstractForceModel
Parameters:
graph - a force graph

moreIterations

protected boolean moreIterations(int count)
Determine whether more iterations need to be performed.

Specified by:
moreIterations in class AbstractForceModel
Parameters:
count - the current iterations count
Returns:
true if more iterations shall be done

calcDisplacement

protected KVector calcDisplacement(FParticle forcer,
                                   FParticle forcee)
Calculate a displacement for the given particles.

Specified by:
calcDisplacement in class AbstractForceModel
Parameters:
forcer - the particle that is causing the force
forcee - the particle that is affected by the force
Returns:
a displacement vector for the forcee, or null if no force is applied

iterationDone

protected void iterationDone()
Perform all necessary calculations after a full iteration. Subclasses must call the superclass method first.

Overrides:
iterationDone in class AbstractForceModel

attractive

public static double attractive(double d,
                                double k)
Calculates the amount of attracting force along a distance.

Parameters:
d - the distance over which the force exerts
k - the space-parameter, depending on the available area
Returns:
the amount of the attracting force