public class FruchtermanReingoldLayout extends Layout
Layout instance implementing the Fruchterman-Reingold algorithm for force-directed placement of graph nodes. The computational complexity of this algorithm is quadratic [O(n^2)] in the number of nodes, so should only be applied for relatively small graphs, particularly in interactive situations.
This implementation was ported from the implementation in the JUNG framework.
Modifier and Type | Class and Description |
---|---|
static class |
FruchtermanReingoldLayout.Params
Wrapper class holding parameters used for each node in this layout.
|
Modifier and Type | Field and Description |
---|---|
protected java.lang.String |
m_edgeGroup |
protected int |
m_fidx |
protected java.lang.String |
m_nodeGroup |
static java.lang.String |
PARAMS
The data field in which the parameters used by this layout are stored.
|
static Schema |
PARAMS_SCHEMA
The schema for the parameters used by this layout.
|
m_anchor, m_bounds, m_bpts, m_insets, m_margin, m_tmpa, m_tmpb
m_group
DEFAULT_STEP_TIME, INFINITY
Constructor and Description |
---|
FruchtermanReingoldLayout(java.lang.String graph)
Create a new FruchtermanReingoldLayout.
|
FruchtermanReingoldLayout(java.lang.String graph,
int maxIter)
Create a new FruchtermanReingoldLayout
|
Modifier and Type | Method and Description |
---|---|
void |
calcAttraction(EdgeItem e) |
void |
calcPositions(NodeItem n,
java.awt.geom.Rectangle2D b) |
void |
calcRepulsion(Graph g,
NodeItem n1) |
int |
getMaxIterations()
Get the maximum number of iterations to run of this algorithm.
|
protected void |
initSchema(TupleSet ts) |
void |
run(double frac)
Runs this Action, triggering whatever processing this Action performs.
|
void |
setMaxIterations(int maxIter)
Set the maximum number of iterations to run of this algorithm.
|
getLayoutAnchor, getLayoutBounds, setLayoutAnchor, setLayoutBounds, setMargin, setX, setY
getGroup, setGroup
getVisualization, run, setVisualization
addActivityListener, alwaysRunAfter, cancel, fireActivityCancelled, fireActivityFinished, fireActivityScheduled, fireActivityStarted, fireActivityStepped, getDuration, getNextTime, getPace, getPacingFunction, getStartTime, getStepTime, getStopTime, isEnabled, isRunning, isScheduled, removeActivityListener, run, runAfter, runAt, setDuration, setEnabled, setPacingFunction, setStartTime, setStepTime
protected java.lang.String m_nodeGroup
protected java.lang.String m_edgeGroup
protected int m_fidx
public static final java.lang.String PARAMS
public static final Schema PARAMS_SCHEMA
public FruchtermanReingoldLayout(java.lang.String graph)
graph
- the data field to layout. Must resolve to a Graph instance.public FruchtermanReingoldLayout(java.lang.String graph, int maxIter)
graph
- the data field to layout. Must resolve to a Graph instance.maxIter
- the maximum number of iterations of the algorithm to runpublic int getMaxIterations()
public void setMaxIterations(int maxIter)
maxIter
- the maximum number of iterations to usepublic void run(double frac)
Action
run
in class GroupAction
frac
- the fraction of this Action's duration that has elapsed.Action.run(double)
public void calcPositions(NodeItem n, java.awt.geom.Rectangle2D b)
public void calcAttraction(EdgeItem e)
protected void initSchema(TupleSet ts)
Copyright ? 2013 Regents of the University of California