y.layout.hierarchic
Class WeightedLayerer

java.lang.Object
  |
  +--y.layout.hierarchic.WeightedLayerer
All Implemented Interfaces:
Layerer

public class WeightedLayerer
extends Object
implements Layerer

This class implements the first phase of the hierarchic layouter. It first makes the directed graph acyclic by topological sorting. It then assigns the layers such that edge weights are respected A weight defines a minimal distance between the two endpoints of an edge.


Field Summary
protected  Object key
           
protected  DataProvider weight
           
 
Constructor Summary
WeightedLayerer()
          Creates a new weighted layerer.
WeightedLayerer(Object k)
          Creates a new weighted layerer.
 
Method Summary
 int assignLayers(Graph g, NodeMap layer)
           
 int assignLayersFast(Graph g, NodeMap layer)
          Assign the layers to the nodes.
 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.
 void makeDFSAcyclic(LayoutGraph g, EdgeList reversedEdges)
          Uses dfs to remove cycles from the graph.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

weight

protected DataProvider weight

key

protected Object key
Constructor Detail

WeightedLayerer

public WeightedLayerer()
Creates a new weighted layerer.


WeightedLayerer

public WeightedLayerer(Object k)
Creates a new weighted layerer.

Parameters:
k - the key to access the weights.
Method Detail

assignNodeLayer

public int assignNodeLayer(LayoutGraph g,
                           NodeMap layer,
                           EdgeList reversedEdges)
This method assigns the nodes in the graph to layers.
POSTCONDITION: Forall (v,w) in E: layer(v) < layer(w) !

Specified by:
assignNodeLayer in interface Layerer
Parameters:
g - the graph for which the layers are determined.
layer - here the layers are stored
reversedEdges - here the edges are stored which had been reversed.
Returns:
the number of layers

assignNodeLayer

public int assignNodeLayer(LayoutGraph g,
                           NodeMap layer,
                           EdgeList reversedEdges,
                           DataProvider w)
This method assigns the nodes in the graph to layers.
POSTCONDITION: Forall (v,w) in E: layer(v) < layer(w) !

Parameters:
g - the graph for which the layers are determined.
layer - here the layers are stored
reversedEdges - here the edges are stored which had been reversed.
Returns:
the number of layers

makeDFSAcyclic

public void makeDFSAcyclic(LayoutGraph g,
                           EdgeList reversedEdges)
Uses dfs to remove cycles from the graph.


assignLayers

public int assignLayers(Graph g,
                        NodeMap layer)

assignLayersFast

public int assignLayersFast(Graph g,
                            NodeMap layer)
Assign the layers to the nodes.


downShiftNodes

protected void downShiftNodes(Graph g,
                              NodeMap LAYER_KEY,
                              int maxLayer)
Pushes the nodes down, drawings seems then to be nicer.


© Copyright 2000-2003,
yWorks GmbH.
All rights reserved.

2003