|
Search this API | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objecty.layout.hierarchic.WeightedLayerer
public class WeightedLayerer
This class implements the layering phase of the IncrementalHierarchicLayouter
(i.e., the assignment of the nodes to layers).
It first makes the directed graph acyclic. Then, it assigns the layers such that edge weights are respected. A weight defines a minimum distance between the two end points of an edge.
IncrementalHierarchicLayouter as well as HierarchicLayouter and
HierarchicGroupLayouter.![]() |
![]() |
| Field Summary | |
|---|---|
protected java.lang.Object |
key
The key to access the DataProvider that holds the edge weights. |
protected DataProvider |
weight
This is a DataProvider that holds for each Edge an integer value representing its weight. |
| Constructor Summary | |
|---|---|
WeightedLayerer()
Creates an instance of WeightedLayerer with default settings. |
|
WeightedLayerer(java.lang.Object key)
Creates an instance of WeightedLayerer with the given key that provides access to the DataProvider
that holds the edge weights and unlimited maximum duration for the WeightedLayerer. |
|
| Method Summary | |
|---|---|
int |
assignLayers(Graph graph,
NodeMap layerID)
Assigns all nodes of the graph to layers. |
void |
assignLayers(LayoutGraph graph,
Layers layers,
LayoutDataProvider ldp)
Assigns all nodes of the graph to layers and adds them to the Layers instance. |
int |
assignLayersFast(Graph graph,
NodeMap layerID)
Assigns all nodes of the graph to layers. |
int |
assignNodeLayer(Graph graph,
NodeMap layerID,
EdgeList reversedEdges,
DataProvider weight)
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 graph,
NodeMap layerID,
EdgeList reversedEdges)
Assigns all nodes of the graph to layers. |
int |
assignNodeLayer(LayoutGraph graph,
NodeMap layerID,
EdgeList reversedEdges,
DataProvider weight)
Assigns all nodes of the graph to layers. |
protected void |
downShiftNodes(Graph graph,
NodeMap layerID,
int maxLayer)
Deprecated. This method is not used any more. ?? The drawings seem to be nicer in this way. |
long |
getMaximalDuration()
Returns the time limit in milliseconds set for the layout algorithm. |
protected double |
getWeight(Edge edge)
Returns the edge weight of the given edge using the weight based cycle removal heuristic. |
boolean |
isWeightedCycleRemovalEnabled()
Returns whether or not the edges that need to be reversed are determined using an edge weight based heuristic or using a depth first search based approach. |
void |
makeDFSAcyclic(Graph graph,
EdgeList reversedEdges)
Removes cycles from the graph using a depth first search. |
void |
makeDFSAcyclic(LayoutGraph graph,
EdgeList reversedEdges)
Removes cycles from the graph using a depth first search. |
void |
setMaximalDuration(long maximalDuration)
Specifies the time limit in milliseconds set for the layout algorithm. |
void |
setWeightedCycleRemovalEnabled(boolean enabled)
Specifies whether or not 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
DataProvider that holds for each Edge an integer value representing its weight.
protected java.lang.Object key
DataProvider that holds the edge weights.
More precisely, the corresponding DataProvider maps each edge of the input graph
to an integer value representing the edge's weight.
| Constructor Detail |
|---|
public WeightedLayerer()
WeightedLayerer with default settings.
With this constructor, there exists no key to access the DataProvider that holds the edge weights. This
means that the edges will be considered to have uniform weights of value 1.0.
public WeightedLayerer(java.lang.Object key)
WeightedLayerer with the given key that provides access to the DataProvider
that holds the edge weights and unlimited maximum duration for the WeightedLayerer.
key - the key to access the DataProvider that holds the edge weights| Method Detail |
|---|
public boolean isWeightedCycleRemovalEnabled()
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.
true if an edge weight based heuristic is used; false if a DFS based
approach is usedsetWeightedCycleRemovalEnabled(boolean),
isWeightedCycleRemovalEnabled()public void setWeightedCycleRemovalEnabled(boolean enabled)
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.
enabled - true if an edge weight based heuristic is used; false if a DFS based
approach is usedisWeightedCycleRemovalEnabled()public long getMaximalDuration()
Values have to be greater than or equal to 0.
setMaximalDuration(long)public void setMaximalDuration(long maximalDuration)
Values have to be greater than or equal to 0.
Long.MAX_VALUE. The layout algorithm runs unrestricted.maximalDuration - a non-negative value that specifies the time limit
java.lang.IllegalArgumentException - if the maximum duration is negative
public int assignNodeLayer(LayoutGraph graph,
NodeMap layerID,
EdgeList reversedEdges)
(v,w) in E: layer(v) < layer(w)graph - the graph for which the layers are determinedlayerID - the NodeMap that will be filled by the layout algorithm and returns the zero-based index
of the layer to which each node belongsreversedEdges - an EdgeList containing the edges which had been reversed
public int assignNodeLayer(LayoutGraph graph,
NodeMap layerID,
EdgeList reversedEdges,
DataProvider weight)
(v,w) in E: layer(v) < layer(w)graph - the graph for which the layers are determinedlayerID - the NodeMap that will be filled by the layout algorithm and returns a zero-based layer
index for each nodereversedEdges - an EdgeList containing the edges which had been reversedweight - the DataProvider that returns an integer value (weight) for each edge
protected double getWeight(Edge edge)
By default, all edges are considered to have weight 1.0.
It may be overridden if non-uniform weights are desired.
edge - given edge
isWeightedCycleRemovalEnabled(),
setWeightedCycleRemovalEnabled(boolean)
public int assignNodeLayer(Graph graph,
NodeMap layerID,
EdgeList reversedEdges,
DataProvider weight)
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.
(v,w) in E: layer(v) < layer(w)graph - the graph for which the layers are determinedlayerID - the NodeMap that will be filled by the layout algorithm and returns the zero-based index
of the layer to which each node belongsreversedEdges - an EdgeList containing the edges which had been reversedweight - the DataProvider that returns an integer value (weight) for each edge
public void makeDFSAcyclic(LayoutGraph graph,
EdgeList reversedEdges)
graph - the graphreversedEdges - an EdgeList containing the edges which will be reversed
public void makeDFSAcyclic(Graph graph,
EdgeList reversedEdges)
graph - the graphreversedEdges - an EdgeList containing the edges which will be reversed
public int assignLayers(Graph graph,
NodeMap layerID)
(v,w) in E: layer(v) < layer(w)graph - the graph for which the layers are determinedlayerID - the NodeMap that will be filled by the layout algorithm and returns the zero-based index
of the layer to which each node belongs
public int assignLayersFast(Graph graph,
NodeMap layerID)
(v,w) in E: layer(v) < layer(w)graph - the graph for which the layers are determinedlayerID - the NodeMap that will be filled by the layout algorithm and returns a zero-based layer index
for each node
protected void downShiftNodes(Graph graph,
NodeMap layerID,
int maxLayer)
The drawings seem to be nicer in this way.
graph - the input graphlayerID - the NodeMap that returns the zero-based index of the layer to which each node belongsmaxLayer - the number of layers
public void assignLayers(LayoutGraph graph,
Layers layers,
LayoutDataProvider ldp)
Layers instance.
assignLayers in interface Layerergraph - the input graphlayers - the Layers instance that will be filled with the results of the calculationldp - the LayoutDataProvider used for querying information about the nodes and edgesLayers.insert(byte, int),
Layer.add(y.base.Node)
|
© Copyright 2000-2025, yWorks GmbH. All rights reserved. |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||