giny.util
Class SpringEmbeddedLayouter

java.lang.Object
  extended byginy.util.SpringEmbeddedLayouter

public class SpringEmbeddedLayouter
extends java.lang.Object

An implementation of Kamada and Kawai's spring embedded layout algorithm.


Field Summary
protected  double[] anticollisionSpringScalars
           
protected  double anticollisionSpringStrength
           
protected  double averageIterationsPerNode
           
static double[] DEFAULT_ANTICOLLISION_SPRING_SCALARS
           
static double DEFAULT_ANTICOLLISION_SPRING_STRENGTH
           
static double DEFAULT_AVERAGE_ITERATIONS_PER_NODE
           
static double DEFAULT_DISCONNECTED_NODE_DISTANCE_SPRING_REST_LENGTH
           
static double DEFAULT_DISCONNECTED_NODE_DISTANCE_SPRING_STRENGTH
           
static double DEFAULT_NODE_DISTANCE_REST_LENGTH_CONSTANT
           
static double[] DEFAULT_NODE_DISTANCE_SPRING_SCALARS
           
static double DEFAULT_NODE_DISTANCE_STRENGTH_CONSTANT
           
static int DEFAULT_NUM_LAYOUT_PASSES
           
protected  double disconnectedNodeDistanceSpringRestLength
           
protected  double disconnectedNodeDistanceSpringStrength
           
protected  int edgeCount
           
protected  GraphView graphView
           
protected  int layoutPass
           
protected  java.util.TreeMap matrixIndexToNodeIndexMap
           
protected  int nodeCount
           
protected  double nodeDistanceRestLengthConstant
           
protected  double[][] nodeDistanceSpringRestLengths
           
protected  double[] nodeDistanceSpringScalars
           
protected  double[][] nodeDistanceSpringStrengths
           
protected  double nodeDistanceStrengthConstant
           
protected  java.util.HashMap nodeIndexToMatrixIndexMap
           
protected  int numLayoutPasses
           
 
Constructor Summary
SpringEmbeddedLayouter(GraphView graph_view)
           
 
Method Summary
protected  giny.util.SpringEmbeddedLayouter.PartialDerivatives calculatePartials(giny.util.SpringEmbeddedLayouter.PartialDerivatives partials, java.util.List partials_list, giny.util.SpringEmbeddedLayouter.PotentialEnergy potential_energy, boolean reversed)
          If partials_list is given, adjust all partials (bidirectional) for the current location of the given partials and return the new furthest node's partials.
protected  java.util.List createPartialsList()
           
 void doLayout()
           
 GraphView getGraphView()
           
protected  void initializeSpringEmbeddedLayouter()
           
protected  giny.util.SpringEmbeddedLayouter.PartialDerivatives moveNode(giny.util.SpringEmbeddedLayouter.PartialDerivatives partials, java.util.List partials_list, giny.util.SpringEmbeddedLayouter.PotentialEnergy potential_energy)
          Move the node with the given partials and adjust all partials in the given List to reflect that move, and adjust the potential energy too.
 void setGraphView(GraphView new_graph_view)
           
protected  void setupForLayoutPass()
          Called at the beginning of each layoutPass iteration.
protected  void setupNodeDistanceSprings()
           
protected  void simpleMoveNode(giny.util.SpringEmbeddedLayouter.PartialDerivatives partials)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_NUM_LAYOUT_PASSES

public static final int DEFAULT_NUM_LAYOUT_PASSES
See Also:
Constant Field Values

DEFAULT_AVERAGE_ITERATIONS_PER_NODE

public static final double DEFAULT_AVERAGE_ITERATIONS_PER_NODE
See Also:
Constant Field Values

DEFAULT_NODE_DISTANCE_SPRING_SCALARS

public static final double[] DEFAULT_NODE_DISTANCE_SPRING_SCALARS

DEFAULT_NODE_DISTANCE_STRENGTH_CONSTANT

public static final double DEFAULT_NODE_DISTANCE_STRENGTH_CONSTANT
See Also:
Constant Field Values

DEFAULT_NODE_DISTANCE_REST_LENGTH_CONSTANT

public static final double DEFAULT_NODE_DISTANCE_REST_LENGTH_CONSTANT
See Also:
Constant Field Values

DEFAULT_DISCONNECTED_NODE_DISTANCE_SPRING_STRENGTH

public static final double DEFAULT_DISCONNECTED_NODE_DISTANCE_SPRING_STRENGTH
See Also:
Constant Field Values

DEFAULT_DISCONNECTED_NODE_DISTANCE_SPRING_REST_LENGTH

public static final double DEFAULT_DISCONNECTED_NODE_DISTANCE_SPRING_REST_LENGTH
See Also:
Constant Field Values

DEFAULT_ANTICOLLISION_SPRING_SCALARS

public static final double[] DEFAULT_ANTICOLLISION_SPRING_SCALARS

DEFAULT_ANTICOLLISION_SPRING_STRENGTH

public static final double DEFAULT_ANTICOLLISION_SPRING_STRENGTH
See Also:
Constant Field Values

numLayoutPasses

protected int numLayoutPasses

averageIterationsPerNode

protected double averageIterationsPerNode

nodeDistanceSpringScalars

protected double[] nodeDistanceSpringScalars

nodeDistanceStrengthConstant

protected double nodeDistanceStrengthConstant

nodeDistanceRestLengthConstant

protected double nodeDistanceRestLengthConstant

disconnectedNodeDistanceSpringStrength

protected double disconnectedNodeDistanceSpringStrength

disconnectedNodeDistanceSpringRestLength

protected double disconnectedNodeDistanceSpringRestLength

nodeDistanceSpringStrengths

protected double[][] nodeDistanceSpringStrengths

nodeDistanceSpringRestLengths

protected double[][] nodeDistanceSpringRestLengths

anticollisionSpringScalars

protected double[] anticollisionSpringScalars

anticollisionSpringStrength

protected double anticollisionSpringStrength

graphView

protected GraphView graphView

nodeCount

protected int nodeCount

edgeCount

protected int edgeCount

layoutPass

protected int layoutPass

nodeIndexToMatrixIndexMap

protected java.util.HashMap nodeIndexToMatrixIndexMap

matrixIndexToNodeIndexMap

protected java.util.TreeMap matrixIndexToNodeIndexMap
Constructor Detail

SpringEmbeddedLayouter

public SpringEmbeddedLayouter(GraphView graph_view)
Method Detail

setGraphView

public void setGraphView(GraphView new_graph_view)

getGraphView

public GraphView getGraphView()

initializeSpringEmbeddedLayouter

protected void initializeSpringEmbeddedLayouter()

doLayout

public void doLayout()

setupForLayoutPass

protected void setupForLayoutPass()
Called at the beginning of each layoutPass iteration.


setupNodeDistanceSprings

protected void setupNodeDistanceSprings()

calculatePartials

protected giny.util.SpringEmbeddedLayouter.PartialDerivatives calculatePartials(giny.util.SpringEmbeddedLayouter.PartialDerivatives partials,
                                                                                java.util.List partials_list,
                                                                                giny.util.SpringEmbeddedLayouter.PotentialEnergy potential_energy,
                                                                                boolean reversed)
If partials_list is given, adjust all partials (bidirectional) for the current location of the given partials and return the new furthest node's partials. Otherwise, just adjust the given partials (using the graphView's nodeViewsIterator), and return it. If reversed is true then partials_list must be provided and all adjustments made by a non-reversed call (with the same partials with the same graphNodeView at the same location) will be undone. Complexity is O( #Nodes ).


moveNode

protected giny.util.SpringEmbeddedLayouter.PartialDerivatives moveNode(giny.util.SpringEmbeddedLayouter.PartialDerivatives partials,
                                                                       java.util.List partials_list,
                                                                       giny.util.SpringEmbeddedLayouter.PotentialEnergy potential_energy)
Move the node with the given partials and adjust all partials in the given List to reflect that move, and adjust the potential energy too.

Returns:
the PartialDerivatives of the furthest node after the move.

simpleMoveNode

protected void simpleMoveNode(giny.util.SpringEmbeddedLayouter.PartialDerivatives partials)

createPartialsList

protected java.util.List createPartialsList()