|
Search this API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object y.layout.hierarchic.incremental.DefaultLayerSequencer
public class DefaultLayerSequencer
This class is a Sequencer
implementation that performs the second phase of the Sugiyama algorithm.
It minimizes the crossings in the diagram by using either the barycentric or median heuristic.
Field Summary | |
---|---|
static byte |
BARYCENTER_HEURISTIC
A weight assignment specifier based on a barycenter heuristic. |
static byte |
MEDIAN_HEURISTIC
A weight assignment specifier based on a median heuristic. |
Constructor Summary | |
---|---|
DefaultLayerSequencer()
Creates a new instance of DefaultLayerSequencer . |
Method Summary | |
---|---|
protected double |
getCrossingCost(Edge edge1,
Edge edge2,
LayoutDataProvider layoutDataProvider)
Returns the cost of an edge crossing between the two given edges. |
long |
getMaximalDuration()
Returns the time limit (in milliseconds) set for this sequencer per execution. |
int |
getRandomizationRounds()
Returns the number of randomized rounds that this algorithm performs, if there was no optimal solution. |
byte |
getWeightHeuristic()
Returns the weight heuristic that should be used. |
boolean |
isGroupTranspositionEnabled()
Returns whether or not an additional crossing minimization heuristic should be used in the presence of grouped graphs. |
boolean |
isTranspositionEnabled()
Returns whether or not to apply an additional crossing minimization heuristic. |
void |
sequenceNodeLayers(LayoutGraph graph,
Layers glayers,
LayoutDataProvider ldp,
ItemFactory itemFactory)
Calculates the sequence of the nodes within each layer . |
void |
setGroupTranspositionEnabled(boolean b)
Specifies whether or not an additional crossing minimization heuristic should be used in the presence of grouped graphs. |
void |
setMaximalDuration(long msec)
Specifies the time limit (in milliseconds) set for this sequencer per execution. |
void |
setRandomizationRounds(int randomizationRounds)
Specifies the number of randomized rounds that this algorithm performs, if there was no optimal solution. |
void |
setTranspositionEnabled(boolean b)
Specifies whether or not to apply an additional crossing minimization heuristic. |
void |
setWeightHeuristic(byte h)
Specifying the weight heuristic that should be used. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final byte BARYCENTER_HEURISTIC
The position of a node within a layer will be determined by the barycenter of its successor (downward pass) and predecessor (upward pass) nodes.
public static final byte MEDIAN_HEURISTIC
The position of a node within a layer will be determined by the median position of its successor (downward pass) and predecessor (upward pass) nodes.
Constructor Detail |
---|
public DefaultLayerSequencer()
DefaultLayerSequencer
.
Method Detail |
---|
public void setTranspositionEnabled(boolean b)
Activating this heuristic can reduce the overall number of edge crossings. On the other hand, it may increase the running time.
public boolean isTranspositionEnabled()
Activating this heuristic can reduce the overall number of edge crossings. On the other hand, it may increase the running time.
true
if the crossing minimization heuristic is applied, false
otherwisesetTranspositionEnabled(boolean)
public void setGroupTranspositionEnabled(boolean b)
Activating this heuristic can reduce the overall number of edge crossings in grouped graphs. On the other hand, it may increase running time.
public boolean isGroupTranspositionEnabled()
Activating this heuristic can reduce the overall number of edge crossings in grouped graphs. On the other hand, it may increase running time.
true
if the crossing minimization heuristic should be applied, false
otherwisesetGroupTranspositionEnabled(boolean)
public void setWeightHeuristic(byte h)
BARYCENTER_HEURISTIC
. A barycenter heuristic is used.h
- one of the predefined weight heuristics
java.lang.IllegalArgumentException
- if the constant is unknownpublic byte getWeightHeuristic()
setWeightHeuristic(byte)
public long getMaximalDuration()
Values have to be greater than or equal to 0
.
public int getRandomizationRounds()
Values have to be greater than or equal to 0
.
setRandomizationRounds(int)
public void setRandomizationRounds(int randomizationRounds)
Values have to be greater than or equal to 0
.
50
, if the maximum duration
hasn't been reduced below its default value. Otherwise, 14
rounds are performed.randomizationRounds
- the given number of additional rounds
java.lang.IllegalArgumentException
- if a negative value is givenpublic void setMaximalDuration(long msec)
Values have to be greater than or equal to 0
.
msec
- a non-negative value that specifies the time limit
java.lang.IllegalArgumentException
- if the maximum duration is negative.protected double getCrossingCost(Edge edge1, Edge edge2, LayoutDataProvider layoutDataProvider)
The default implementation defines the crossing cost of two edges as the product of the individual crossing
costs which are retrieved from the DataProvider
registered with the graph with
key IncrementalHierarchicLayouter.EDGE_CROSSING_COST_DPKEY
. If no individual crossing
costs are defined, all edges have a cost of 1
, hence, this method also returns 1
.
This method may be overridden to specify costs for a specific pair of edges. The given
LayoutDataProvider
is helpful to determine the type of the edges by using method
LayoutDataProvider.getEdgeData(Edge)
. Furthermore, using the original edge to decide what
a crossing costs might be helpful, see
IncrementalHierarchicLayouter.getOriginalEdge(Edge, LayoutDataProvider)
.
edge1
- the first edge involved in the crossingedge2
- the second edge involved in the crossinglayoutDataProvider
- the LayoutDataProvider
containing information about the edges and nodes
public void sequenceNodeLayers(LayoutGraph graph, Layers glayers, LayoutDataProvider ldp, ItemFactory itemFactory)
Sequencer
layer
.
This method is called by HierarchicLayouter
during the second phase and finally writes back the
calculated sequence using the Layer.setNodeOrder(y.base.YList)
method.
sequenceNodeLayers
in interface Sequencer
graph
- the input graphglayers
- the given Layers
instance containing the elements in the layeringldp
- the LayoutDataProvider
implementation which provides access to the NodeData
and
EdgeData
instancesitemFactory
- the ItemFactory
used temporarily for modifying the graph instance
|
© Copyright 2000-2022, yWorks GmbH. All rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |