info.aduna.linkmap.layout
Class LinkSubgraphLayoutManager

java.lang.Object
  extended by info.aduna.linkmap.layout.GraphLayoutManager
      extended by info.aduna.linkmap.layout.IteratingLayoutManager
          extended by info.aduna.linkmap.layout.SpringLayoutManager
              extended by info.aduna.linkmap.layout.AdaptiveSpringLayoutManager
                  extended by info.aduna.linkmap.layout.LinkSubgraphLayoutManager
All Implemented Interfaces:
Runnable

public class LinkSubgraphLayoutManager
extends AdaptiveSpringLayoutManager

A LinkSubgraphLayoutManager is a specialization of a SpringLayoutManager. Besides some differences in its initial parameter settings, this class differs from its super class in that it distinguishes between a "core graph" and its border. The core graph consists of all ModelObjectVertices that have two or more neighbours. Consequently, the border graph consists of all vertices with exactly one neighbour. (We ignore here some special cases, e.g. when the graph consists of only two nodes and a single edge between them.)

The first phase of the layout algorithm consists of calculating a layout only for this core graph. After that the border vertices are put back in the graph and their position is initialized to the position close to their only neighbour. Finally, a few iterations are performed in order to give these vertices a reasonable layout.

This mechanism significantly speeds up the calculation of the layout of large graphs (whose complexity is roughly quadratic to the number of vertices) and also prohibits certain local minima in the produced layout.

LinkSubgraphLayoutManager is meant to be used in conjunction with a LinkGraphLayoutManager. It can also directly be used on the total LinkGraph, provided that it is a connected Graph. Unconnected LinkGraphs may lead to a layout that never stabilizes.


Nested Class Summary
 
Nested classes/interfaces inherited from class info.aduna.linkmap.layout.AdaptiveSpringLayoutManager
AdaptiveSpringLayoutManager.AdaptiveVertexAttribute
 
Nested classes/interfaces inherited from class info.aduna.linkmap.layout.SpringLayoutManager
SpringLayoutManager.EdgeAttribute, SpringLayoutManager.VertexAttribute
 
Field Summary
static int CORE_ITERATIONS
           
static boolean CORE_STAGE_ENABLED
           
static int GLOBAL_ITERATIONS
           
static boolean GLOBAL_STAGE_ENABLED
           
 
Fields inherited from class info.aduna.linkmap.layout.AdaptiveSpringLayoutManager
DEFAULT_ADAPTATION, DEFAULT_DECREASE_FACTOR, DEFAULT_DECREASE_THRESHOLD, DEFAULT_INCREASE_FACTOR, DEFAULT_INCREASE_THRESHOLD
 
Fields inherited from class info.aduna.linkmap.layout.SpringLayoutManager
DEFAULT_ATTRACTION, DEFAULT_AVERAGE_MOVEMENT_THRESHOLD, DEFAULT_CHARGE, DEFAULT_MASS, DEFAULT_MAXIMUM_ALLOWED_MOVEMENT, DEFAULT_MAXIMUM_OBSERVED_MOVEMENT_THRESHOLD, DEFAULT_MOMENTUM, DEFAULT_REPULSION, DEFAULT_SPRING_CONSTANT, DEFAULT_SPRING_LENGTH, DEFAULT_TRANSLATION_INTERVAL
 
Fields inherited from class info.aduna.linkmap.layout.IteratingLayoutManager
UNDEFINED_MAX_ITERATION
 
Constructor Summary
LinkSubgraphLayoutManager()
           
 
Method Summary
 void doLayout()
          Calculates a new layout for the link graph.
 int getCoreIterations()
           
 int getGlobalIterations()
           
 int getTotalIterations()
           
 void initLayoutParameters()
          Initializes the layout parameters of the layout algorithm.
 boolean isCoreStageEnabled()
           
 boolean isGlobalStageEnabled()
           
 void randomizeCoordinates(Graph graph, long seed)
          Overrides SpringEdgeAttribute and additionally sets the _needsCoreLayout to 'true'.
 void reset(SpringLayoutManager.EdgeAttribute attribute)
          Overrides SpringLayoutManager and additionally scales the spring constant of the EdgeAttribute with the weight of the represented Link.
 void setCoreIterations(int coreIterations)
           
 void setCoreStageEnabled(boolean coreStageEnabled)
           
 void setGlobalIterations(int globalIterations)
           
 void setGlobalStageEnabled(boolean globalStageEnabled)
           
 
Methods inherited from class info.aduna.linkmap.layout.AdaptiveSpringLayoutManager
createVertexAttribute, getDecreaseFactor, getDecreaseThreshold, getIncreaseFactor, getIncreaseThreshold, move, reset, setDecreaseFactor, setDecreaseThreshold, setIncreaseFactor, setIncreaseThreshold
 
Methods inherited from class info.aduna.linkmap.layout.SpringLayoutManager
createEdgeAttribute, createLayoutConverter, doLayout, doLayout, getAdaptation, getAttraction, getAverageMovementThreshold, getCharge, getEdgeAttributes, getMass, getMaximumAllowedMovement, getMaximumObservedMovement, getMaximumObservedMovementThreshold, getMomentum, getRepulsion, getSpringConstant, getSpringLength, getSummedMovement, getTranslationInterval, getVertexAttributes, initialize, initThresholds, isAverageMovementThresholdEnabled, isMaximumObservedMovementThresholdEnabled, resetAttributes, resetAttributes, setAdaptation, setAttraction, setAverageMovementThreshold, setCharge, setEdgeAttribute, setMass, setMaximumAllowedMovement, setMaximumObservedMovement, setMaximumObservedMovementThreshold, setMomentum, setRepulsion, setSpringConstant, setSpringLength, setSummedMovement, setTranslationInterval, setVertexAttribute
 
Methods inherited from class info.aduna.linkmap.layout.IteratingLayoutManager
continueLayout, getIteration, getMaxIteration, handlePauseLayout, increaseIteration, isMaxIterationReached, pauseLayout, pauseLayoutRequested, setIteration, setMaxIteration, setPauseLayout, setStopLayout, stopLayout, stopLayoutRequested
 
Methods inherited from class info.aduna.linkmap.layout.GraphLayoutManager
getGraph, run, setGraph
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CORE_STAGE_ENABLED

public static final boolean CORE_STAGE_ENABLED
See Also:
Constant Field Values

CORE_ITERATIONS

public static final int CORE_ITERATIONS
See Also:
Constant Field Values

GLOBAL_STAGE_ENABLED

public static final boolean GLOBAL_STAGE_ENABLED
See Also:
Constant Field Values

GLOBAL_ITERATIONS

public static final int GLOBAL_ITERATIONS
See Also:
Constant Field Values
Constructor Detail

LinkSubgraphLayoutManager

public LinkSubgraphLayoutManager()
Method Detail

setCoreStageEnabled

public void setCoreStageEnabled(boolean coreStageEnabled)

isCoreStageEnabled

public boolean isCoreStageEnabled()

setCoreIterations

public void setCoreIterations(int coreIterations)

getCoreIterations

public int getCoreIterations()

setGlobalStageEnabled

public void setGlobalStageEnabled(boolean globalStageEnabled)

isGlobalStageEnabled

public boolean isGlobalStageEnabled()

setGlobalIterations

public void setGlobalIterations(int globalIterations)

getGlobalIterations

public int getGlobalIterations()

getTotalIterations

public int getTotalIterations()

initLayoutParameters

public void initLayoutParameters()
Initializes the layout parameters of the layout algorithm. Overrides the same method in SpringLayoutManager.

Overrides:
initLayoutParameters in class AdaptiveSpringLayoutManager

reset

public void reset(SpringLayoutManager.EdgeAttribute attribute)
Overrides SpringLayoutManager and additionally scales the spring constant of the EdgeAttribute with the weight of the represented Link.

Overrides:
reset in class SpringLayoutManager

randomizeCoordinates

public void randomizeCoordinates(Graph graph,
                                 long seed)
Overrides SpringEdgeAttribute and additionally sets the _needsCoreLayout to 'true'.

Overrides:
randomizeCoordinates in class SpringLayoutManager

doLayout

public void doLayout()
Calculates a new layout for the link graph. See the class documentation for an explanation of the adapted layout algorithm.

The implementation of this algorithms takes care that the vertices and edges it considers are a member of the current Graph. This is important because a specific Vertex may have neighbours that are outside the current Graph, e.g. when the current Graph is a subgraph of another Graph.

Overrides:
doLayout in class SpringLayoutManager


Copyright © 1997-2008 Aduna. All Rights Reserved.