edu.uci.ics.jung.visualization
Class FRLayout

java.lang.Object
  extended by edu.uci.ics.jung.visualization.AbstractLayout
      extended by edu.uci.ics.jung.visualization.FRLayout
All Implemented Interfaces:
ChangeEventSupport, Layout, LayoutMutable, VertexLocationFunction

public class FRLayout
extends AbstractLayout
implements LayoutMutable

Implements the Fruchterman-Reingold algorithm for node layout.

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

Nested Class Summary
static class FRLayout.FRVertexData
           
 
Field Summary
 
Fields inherited from class edu.uci.ics.jung.visualization.AbstractLayout
changeSupport, vertex_locations
 
Constructor Summary
FRLayout(Graph g)
           
 
Method Summary
 void advancePositions()
          Moves the iteration forward one notch, calculation attraction and repulsion between vertices and edges and cooling the temperature.
 void calcAttraction(Edge e)
           
 void calcPositions(Vertex v)
           
 void calcRepulsion(Vertex v1)
           
 void forceMove(Vertex picked, double x, double y)
          Forcibly moves a vertex to the (x,y) location by setting its x and y locations to the inputted location.
 FRLayout.FRVertexData getFRData(Vertex v)
           
 Object getKey()
          Returns a visualization-specific key (that is, specific both to this instance and AbstractLayout) that can be used to access UserData related to the AbstractLayout.
 String getStatus()
          Returns the current temperature and number of iterations elapsed, as a string.
 boolean incrementsAreDone()
          Returns true once the current iteration has passed the maximum count, MAX_ITERATIONS.
protected  void initialize_local_vertex(Vertex 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.
 void setAttractionMultiplier(double attraction)
           
 void setMaxIterations(int maxIterations)
           
 void setRepulsionMultiplier(double repulsion)
           
 void update()
           
 
Methods inherited from class edu.uci.ics.jung.visualization.AbstractLayout
addChangeListener, applyFilter, dontMove, fireStateChanged, getAVertex, getBaseKey, getChangeListeners, getCoordinates, getCurrentSize, getEdge, getEdge, getGraph, getLocation, getVertex, getVertex, getVertexIterator, getVisibleEdges, getVisibleGraph, getVisibleVertices, getX, getY, initialize, initialize, initializeLocation, initializeLocations, isLocked, lockVertex, offsetVertex, postInitialize, removeChangeListener, resize, restart, unlockVertex
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface edu.uci.ics.jung.visualization.Layout
applyFilter, getCurrentSize, getGraph, getLocation, getVertex, getVertex, getVisibleEdges, getVisibleVertices, getX, getY, initialize, isLocked, lockVertex, resize, restart, unlockVertex
 
Methods inherited from interface edu.uci.ics.jung.visualization.VertexLocationFunction
getVertexIterator
 

Constructor Detail

FRLayout

public FRLayout(Graph g)
Method Detail

setAttractionMultiplier

public void setAttractionMultiplier(double attraction)

setRepulsionMultiplier

public void setRepulsionMultiplier(double repulsion)

update

public void update()
Specified by:
update in interface LayoutMutable

getStatus

public String getStatus()
Returns the current temperature and number of iterations elapsed, as a string.

Specified by:
getStatus in interface Layout
Overrides:
getStatus in class AbstractLayout
Returns:
the status, as a string

forceMove

public void forceMove(Vertex picked,
                      double x,
                      double y)
Description copied from class: AbstractLayout
Forcibly moves a vertex to the (x,y) location by setting its x and y locations to the inputted location. Does not add the vertex to the "dontmove" list, and (in the default implementation) does not make any adjustments to the rest of the graph.

Specified by:
forceMove in interface Layout
Overrides:
forceMove in class AbstractLayout

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.

Overrides:
initialize_local in class AbstractLayout

getKey

public Object getKey()
Returns a visualization-specific key (that is, specific both to this instance and AbstractLayout) that can be used to access UserData related to the AbstractLayout.


initialize_local_vertex

protected void initialize_local_vertex(Vertex 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_vertex in class AbstractLayout

advancePositions

public void advancePositions()
Moves the iteration forward one notch, calculation attraction and repulsion between vertices and edges and cooling the temperature.

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

calcPositions

public void calcPositions(Vertex v)

calcAttraction

public void calcAttraction(Edge e)

calcRepulsion

public void calcRepulsion(Vertex v1)

setMaxIterations

public void setMaxIterations(int maxIterations)

getFRData

public FRLayout.FRVertexData getFRData(Vertex v)

isIncremental

public boolean isIncremental()
This one is an incremental visualization.

Specified by:
isIncremental in interface Layout

incrementsAreDone

public boolean incrementsAreDone()
Returns true once the current iteration has passed the maximum count, MAX_ITERATIONS.

Specified by:
incrementsAreDone in interface Layout