prefuse.action.layout.graph
Class FruchtermanReingoldLayout

java.lang.Object
  extended by prefuse.activity.Activity
      extended by prefuse.action.Action
          extended by prefuse.action.GroupAction
              extended by prefuse.action.layout.Layout
                  extended by prefuse.action.layout.graph.FruchtermanReingoldLayout

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.

Author:
Scott White, Yan-Biao Boey, Danyel Fisher, jeffrey heer

Nested Class Summary
static class FruchtermanReingoldLayout.Params
          Wrapper class holding parameters used for each node in this layout.
 
Field Summary
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.
 
Fields inherited from class prefuse.action.layout.Layout
m_anchor, m_bounds, m_bpts, m_insets, m_margin, m_tmpa, m_tmpb
 
Fields inherited from class prefuse.action.GroupAction
m_group
 
Fields inherited from class prefuse.action.Action
m_vis
 
Fields inherited from class prefuse.activity.Activity
DEFAULT_STEP_TIME, INFINITY
 
Constructor Summary
FruchtermanReingoldLayout(java.lang.String graph)
          Create a new FruchtermanReingoldLayout.
FruchtermanReingoldLayout(java.lang.String graph, int maxIter)
          Create a new FruchtermanReingoldLayout
 
Method Summary
 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.
 
Methods inherited from class prefuse.action.layout.Layout
getLayoutAnchor, getLayoutBounds, setLayoutAnchor, setLayoutBounds, setMargin, setX, setY
 
Methods inherited from class prefuse.action.GroupAction
getGroup, setGroup
 
Methods inherited from class prefuse.action.Action
getVisualization, run, setVisualization
 
Methods inherited from class prefuse.activity.Activity
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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_nodeGroup

protected java.lang.String m_nodeGroup

m_edgeGroup

protected java.lang.String m_edgeGroup

m_fidx

protected int m_fidx

PARAMS

public static final java.lang.String PARAMS
The data field in which the parameters used by this layout are stored.

See Also:
Constant Field Values

PARAMS_SCHEMA

public static final Schema PARAMS_SCHEMA
The schema for the parameters used by this layout.

Constructor Detail

FruchtermanReingoldLayout

public FruchtermanReingoldLayout(java.lang.String graph)
Create a new FruchtermanReingoldLayout.

Parameters:
graph - the data field to layout. Must resolve to a Graph instance.

FruchtermanReingoldLayout

public FruchtermanReingoldLayout(java.lang.String graph,
                                 int maxIter)
Create a new FruchtermanReingoldLayout

Parameters:
graph - the data field to layout. Must resolve to a Graph instance.
maxIter - the maximum number of iterations of the algorithm to run
Method Detail

getMaxIterations

public int getMaxIterations()
Get the maximum number of iterations to run of this algorithm.

Returns:
the maximum number of iterations

setMaxIterations

public void setMaxIterations(int maxIter)
Set the maximum number of iterations to run of this algorithm.

Parameters:
maxIter - the maximum number of iterations to use

run

public void run(double frac)
Description copied from class: Action
Runs this Action, triggering whatever processing this Action performs. Subclass this method to create custom Actions.

Specified by:
run in class GroupAction
Parameters:
frac - the fraction of this Action's duration that has elapsed.
See Also:
Action.run(double)

calcPositions

public void calcPositions(NodeItem n,
                          java.awt.geom.Rectangle2D b)

calcAttraction

public void calcAttraction(EdgeItem e)

calcRepulsion

public void calcRepulsion(Graph g,
                          NodeItem n1)

initSchema

protected void initSchema(TupleSet ts)


Copyright © 2007 Regents of the University of California