Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Mail Systems
Eclipse Documentation

How To Guides
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Problem Solutions
Privacy Policy




Eclipse Draw2d

Class DirectedGraphLayout

  extended by
Direct Known Subclasses:

public class DirectedGraphLayout
extends java.lang.Object

Performs a graph layout of a DirectedGraph. The directed graph must meet the following conditions:

  • The graph must be connected.
  • All edge's must be added to the graph's edges list exactly once.
  • All nodes must be added to the graph's nodes list exactly once.
This algorithm will:
  • break cycles by inverting a set of feedback edges. Feedback edges will have the flag Edge.isFeedback set to true. The following statements are true with respect to the inverted edge. When the algorithm completes, it will invert the edges again, but will leave the feedback flags set.
  • for each node n, assign n to a "rank" R(n), such that: for each edge (m, n) in n.incoming, R(m)<=R(n)-(m,n).delta. The total weighted edge lengths shall be no greater than is necessary to meet this requirement for all edges in the graph.
  • attempt to order the nodes in their ranks as to minimize crossings.
  • assign y coordinates to each node based on its rank. The spacing between ranks is the sum of the bottom padding of the previous rank, and the top padding of the next rank.
  • assign x coordinates such that the graph is easily readable. The exact behavior is undefined, but will favor edge's with higher Edge.weights. The minimum x value assigned to a node or bendpoint will be 0.
  • assign bendpoints to all edge's which span more than 1 rank.

For each NODE:

  • The x coordinate will be assigned a value >= 0
  • The y coordinate will be assigned a value >= 0
  • The rank will be assigned a value >=0
  • The height will be set to the height of the tallest node on the same row

For each EDGE:

  • If an edge spans more than 1 row, it will have a list of virtual nodes. The virtual nodes will be assigned an x coordinate indicating the routing path for that edge.
  • If an edge is a feedback edge, it's isFeedback flag will be set, and if it has virtual nodes, they will be in reverse order (bottom-up).

This class is not guaranteed to produce the same results for each invocation.


Constructor Summary
DirectedGraphLayout ()
Method Summary
 void visit ( DirectedGraph graph)
          Lays out the given graph
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail


public DirectedGraphLayout()
Method Detail


public void visit(
DirectedGraph graph)
Lays out the given graph

graph - the graph to layout

Eclipse Draw2d

Copyright (c) IBM Corp. and others 2000, 2007. All Rights Reserved.

  Published under the terms of the Eclipse Public License Version 1.0 ("EPL") Design by Interspire