public class JGraphFastOrganicLayout extends java.lang.Object implements JGraphLayout, JGraphLayout.Stoppable
forceConstant
,initialTemp
and
maxIteration
.forceConstant
is the constant k
in the paper and affects the radius around each node around which other nodes
would be in equilibrium. initialTemp
sets the start
temperature of the layout, lower values limit the displacement of each node
on each iteration. maxIteration
sets the total number of
iterations of the layout that occur.JGraphLayout.Stoppable
Modifier and Type | Field and Description |
---|---|
protected double[][] |
cellLocation
An array of locally stored co-ordinate positions for the vertices
|
protected double[] |
dispX
An array of locally stored X co-ordinate displacements for the vertices
|
protected double[] |
dispY
An array of locally stored Y co-ordinate displacements for the vertices
|
protected double |
forceConstant
The force constant by which the attractive forces are divided and the
replusive forces are multiple by the square of.
|
protected double |
forceConstantSquared
Cache of
forceConstant ^2 for performance |
protected double |
initialTemp
Start value of temperature
|
protected boolean[] |
isMoveable
Local copy of isMoveable
|
protected int |
iteration
Current iteration count
|
protected int |
maxIterations
Total number of iterations to run the layout though
|
protected double |
minDistanceLimit
prevents from dividing with zero
|
protected double |
minDistanceLimitSquared
cached version of
minDistanceLimit squared |
protected int[][] |
neighbours
Local copy of cell neighbours
|
protected JGraphLayoutProgress |
progress
An object to monitor and control progress.
|
protected double[] |
radius
The approximate radius of each cell, nodes only
|
protected double[] |
radiusSquared
The approximate radius squared of each cell, nodes only
|
protected double |
temperature
Temperature to limit displacement at later stages of layout
|
protected java.lang.Object[] |
vertexArray
An array of all vertices to be laid out
|
VERSION
Constructor and Description |
---|
JGraphFastOrganicLayout() |
Modifier and Type | Method and Description |
---|---|
void |
calcAttraction()
Calculates the attractive forces between all laid out nodes linked by
edges
|
void |
calcPositions()
Takes the displacements calculated for each cell and applies them to the
local cache of cell positions.
|
void |
calcRepulsion()
Calculates the repulsive forces between all laid out nodes
|
double |
getForceConstant() |
double |
getInitialTemp() |
int |
getMaxIterations() |
JGraphLayoutProgress |
getProgress()
Returns the progress object that represents the progress of the
current layout run.
|
void |
run(JGraphFacade graph)
Executes the Fruchterman-Reingold layout using the graph description from
the specified facade
|
void |
setForceConstant(double forceConstant) |
void |
setInitialTemp(double initialTemp) |
void |
setMaxIterations(int maxIterations) |
java.lang.String |
toString()
Returns
Fast Organic , the name of this algorithm. |
protected double forceConstant
protected double forceConstantSquared
forceConstant
^2 for performanceprotected double temperature
protected double initialTemp
protected int iteration
protected int maxIterations
protected java.lang.Object[] vertexArray
protected double[] dispX
protected double[] dispY
protected double[][] cellLocation
protected double[] radius
protected double[] radiusSquared
protected boolean[] isMoveable
protected int[][] neighbours
protected JGraphLayoutProgress progress
protected double minDistanceLimit
protected double minDistanceLimitSquared
minDistanceLimit
squaredpublic JGraphLayoutProgress getProgress()
JGraphLayout.Stoppable
By convention, the layout must check the isStopped method in its
inner-most loops and return immediately if the method returns
true
.
getProgress
in interface JGraphLayout.Stoppable
public void run(JGraphFacade graph)
run
in interface JGraphLayout
graph
- the facade describing the graph to be acted uponpublic void calcPositions()
public void calcAttraction()
public void calcRepulsion()
public double getForceConstant()
public void setForceConstant(double forceConstant)
forceConstant
- The forceConstant to set.public int getMaxIterations()
public void setMaxIterations(int maxIterations)
maxIterations
- The maxIterations to set.public double getInitialTemp()
public void setInitialTemp(double initialTemp)
initialTemp
- The initialTemp to set.public java.lang.String toString()
Fast Organic
, the name of this algorithm.toString
in class java.lang.Object
Copyright (C) 2001-2009 JGraph Ltd. All rights reserved.