giny.util
Class JUNGSpringLayout

java.lang.Object
  extended byginy.util.AbstractLayout
      extended byginy.util.JUNGSpringLayout

public class JUNGSpringLayout
extends AbstractLayout

The SpringLayout package represents a visualization of a set of nodes. The SpringLayout, which is initialized with a Graph, assigns X/Y locations to each node. When called relax(), the SpringLayout moves the visualization forward one step.


Nested Class Summary
static interface JUNGSpringLayout.LengthFunction
          If the edge is weighted, then override this method to show what the visualized length is.
 class JUNGSpringLayout.SpringDimensionChecker
           
 
Field Summary
static int RANGE
           
static int STRETCH
           
static JUNGSpringLayout.LengthFunction UNITLENGTHFUNCTION
           
 
Fields inherited from class giny.util.AbstractLayout
currentSize, graphView, staticNodes
 
Constructor Summary
JUNGSpringLayout(GraphView g)
          Constructor for a SpringLayout for a raw graph with associated dimension--the input knows how big the graph is.
JUNGSpringLayout(GraphView g, JUNGSpringLayout.LengthFunction f)
          Constructor for a SpringLayout for a raw graph with associated component.
 
Method Summary
 void advancePositions()
          Relaxation step.
protected  void calcEdgeLength(giny.util.JUNGSpringLayout.SpringEdgeData sed, JUNGSpringLayout.LengthFunction f)
           
 void doLayout()
           
 double getLength(EdgeView e)
           
 giny.util.JUNGSpringLayout.SpringEdgeData getSpringData(EdgeView e)
           
 giny.util.JUNGSpringLayout.SpringVertexData getSpringData(int v)
           
 giny.util.JUNGSpringLayout.SpringVertexData getSpringData(NodeView v)
           
 boolean incrementsAreDone()
          For now, we pretend it never finishes.
protected  void initialize_local_node_view(NodeView 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
protected  void moveNodes()
           
 
Methods inherited from class giny.util.AbstractLayout
dontMove, forceMove, getCurrentSize, getNodeView, getStatus, initialize, initializeLocation, initializeLocations, lockNodes, lockVertex, resize, restart, unlockVertex
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RANGE

public static int RANGE

STRETCH

public static int STRETCH

UNITLENGTHFUNCTION

public static final JUNGSpringLayout.LengthFunction UNITLENGTHFUNCTION
Constructor Detail

JUNGSpringLayout

public JUNGSpringLayout(GraphView g)
Constructor for a SpringLayout for a raw graph with associated dimension--the input knows how big the graph is. Defaults to the unit length function.


JUNGSpringLayout

public JUNGSpringLayout(GraphView g,
                        JUNGSpringLayout.LengthFunction f)
Constructor for a SpringLayout for a raw graph with associated component.

Parameters:
g - the input Graph
f - the length function
Method Detail

doLayout

public void doLayout()
Specified by:
doLayout 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.

Specified by:
initialize_local in class AbstractLayout

initialize_local_node_view

protected void initialize_local_node_view(NodeView 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_node_view in class AbstractLayout

calcEdgeLength

protected void calcEdgeLength(giny.util.JUNGSpringLayout.SpringEdgeData sed,
                              JUNGSpringLayout.LengthFunction f)

advancePositions

public void advancePositions()
Relaxation step. Moves all nodes a smidge.

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

moveNodes

protected void moveNodes()

getSpringData

public giny.util.JUNGSpringLayout.SpringVertexData getSpringData(NodeView v)

getSpringData

public giny.util.JUNGSpringLayout.SpringVertexData getSpringData(int v)

getSpringData

public giny.util.JUNGSpringLayout.SpringEdgeData getSpringData(EdgeView e)

getLength

public double getLength(EdgeView e)

isIncremental

public boolean isIncremental()
This one is an incremental visualization


incrementsAreDone

public boolean incrementsAreDone()
For now, we pretend it never finishes.