|
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.WeightedLayerer
public class WeightedLayerer
This class implements the first phase of the hierarchic layouter. It first makes the directed graph acyclic. Then it assigns the layers such that edge weights are respected A weight defines a minimal distance between the two end points of an edge.
Field Summary | |
---|---|
protected Object |
key
The key to access the weights. |
protected DataProvider |
weight
Provides the edge weights. |
Constructor Summary | |
---|---|
WeightedLayerer()
Creates a new weighted layerer. |
|
WeightedLayerer(Object k)
Creates a new weighted layerer. |
Method Summary | |
---|---|
int |
assignLayers(Graph g,
NodeMap layer)
Assigns the layers to the nodes. |
void |
assignLayers(LayoutGraph graph,
Layers layers,
LayoutDataProvider ldp)
This method assigns all nodes in the graph to layers and registers them in the Layers instance. |
int |
assignLayersFast(Graph g,
NodeMap layer)
Assign the layers to the nodes. |
int |
assignNodeLayer(Graph g,
NodeMap layer,
EdgeList reversedEdges,
DataProvider w)
Deprecated. Use assignNodeLayer(y.layout.LayoutGraph, y.base.NodeMap, y.base.EdgeList, y.base.DataProvider)
instead. This method does not support graphs that have several disjoint
graph components nor the edge weight based cycle removal heuristic. |
int |
assignNodeLayer(LayoutGraph g,
NodeMap layer,
EdgeList reversedEdges)
This method assigns the nodes in the graph to layers. |
int |
assignNodeLayer(LayoutGraph g,
NodeMap layer,
EdgeList reversedEdges,
DataProvider w)
This method assigns the nodes in the graph to layers. |
protected void |
downShiftNodes(Graph g,
NodeMap LAYER_KEY,
int maxLayer)
Pushes the nodes down, drawings seems then to be nicer. |
long |
getMaximalDuration()
Returns the time limit (in milliseconds) set for the algorithm. |
protected double |
getWeight(Edge edge)
Returns the edge weight of the specified edge for use with the weight based cycle removal heuristic. |
boolean |
isWeightedCycleRemovalEnabled()
Returns true if the edges that need to be reversed are
determined using an edge weight based heuristic
and false if a Depth First Search based approach should be
used. |
void |
makeDFSAcyclic(Graph g,
EdgeList reversedEdges)
Uses dfs to remove cycles from the graph. |
void |
makeDFSAcyclic(LayoutGraph g,
EdgeList reversedEdges)
Uses dfs to remove cycles from the graph. |
void |
setMaximalDuration(long maximalDuration)
Sets a preferred time limit (in milliseconds) for the algorithm. |
void |
setWeightedCycleRemovalEnabled(boolean enabled)
Specifies if the edges that need to be reversed are determined using an edge weight based heuristic or using a Depth First Search based approach. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected DataProvider weight
protected Object key
Constructor Detail |
---|
public WeightedLayerer()
public WeightedLayerer(Object k)
k
- the key to access the weights.Method Detail |
---|
public boolean isWeightedCycleRemovalEnabled()
true
if the edges that need to be reversed are
determined using an edge weight based heuristic
and false
if a Depth First Search based approach should be
used. The weight based approach may result in fewer reversed edges
(especially for cases with many multi edges) whereas the DFS based
approach is likely to be faster.
Defaults to false
.
true
if the edges that need to be reversed are
determined using an edge weight based heuristic
and false
if a Depth First Search based approach should be
used.setWeightedCycleRemovalEnabled(boolean)
public void setWeightedCycleRemovalEnabled(boolean enabled)
By default, the DFS based approach is used.
enabled
- if true
an edge weight based heuristic is used;
else a Depth First Search based approach is used.isWeightedCycleRemovalEnabled()
public long getMaximalDuration()
setMaximalDuration(long)
public void setMaximalDuration(long maximalDuration)
maximalDuration
- the time limit.getMaximalDuration()
public int assignNodeLayer(LayoutGraph g, NodeMap layer, EdgeList reversedEdges)
g
- the graph for which the layers are determined.layer
- here the layers are storedreversedEdges
- here the edges are stored which had been reversed.
public int assignNodeLayer(LayoutGraph g, NodeMap layer, EdgeList reversedEdges, DataProvider w)
g
- the graph for which the layers are determined.layer
- here the layers are storedreversedEdges
- here the edges are stored which had been reversed.
protected double getWeight(Edge edge)
By default, all edges are considered to have weight 1.0
.
edge
- the edge whose weight is returned.
isWeightedCycleRemovalEnabled()
,
setWeightedCycleRemovalEnabled(boolean)
public int assignNodeLayer(Graph g, NodeMap layer, EdgeList reversedEdges, DataProvider w)
assignNodeLayer(y.layout.LayoutGraph, y.base.NodeMap, y.base.EdgeList, y.base.DataProvider)
instead. This method does not support graphs that have several disjoint
graph components nor the edge weight based cycle removal heuristic.
g
- the graph for which the layers are determined.layer
- here the layers are storedreversedEdges
- here the edges are stored which had been reversed.
public void makeDFSAcyclic(LayoutGraph g, EdgeList reversedEdges)
public void makeDFSAcyclic(Graph g, EdgeList reversedEdges)
public int assignLayers(Graph g, NodeMap layer)
public int assignLayersFast(Graph g, NodeMap layer)
protected void downShiftNodes(Graph g, NodeMap LAYER_KEY, int maxLayer)
public void assignLayers(LayoutGraph graph, Layers layers, LayoutDataProvider ldp)
Layerer
Layers
instance. In order to create new layers, the factory
method Layers.insert(byte, int)
must be used.
assignLayers
in interface Layerer
graph
- the graph that contains the nodes that should be distributed
into the layerslayers
- the object that will be filled with the results of the
calculationldp
- LayoutDataProvider that can be used to query information about
the nodes - note that positional information
(see NodeData.getPosition()
and NodeData.getLayer()
) cannot
be available at any time.Layers.insert(byte, int)
,
Layer.add(y.base.Node)
|
© Copyright 2000-2013, yWorks GmbH. All rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |