Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.port80.graph.dot.impl
Class Position  view Position download Position.java

java.lang.Object
  extended bycom.port80.graph.dot.impl.Position

public class Position
extends java.lang.Object

position(g): set n.coord (x and y) for all nodes n of g, using g.rank. (the graph may be modified by merging certain edges with a common endpoint.) the coordinates are computed by constructing and ranking an auxiliary graph. then leaf nodes are inserted in the fast graph. cluster boundary nodes are created and correctly separated.


Field Summary
private static boolean DEBUG
           
private  VirtualEdge fDummy
           
(package private)  java.util.Map fVertexMap
           
private  int fWEIGHT_VIRTUALFACTOR
           
private  int fXDIV_EDGES
           
private  int fXDIV_XEDGE
           
private  int fXMargin
           
private  int fYMargin
           
private  int fYSPACING_BUSBUS
           
private  int fYSPACING_XBUS
           
private static java.lang.String NAME
           
private static boolean VERBOSE
           
 
Constructor Summary
Position()
           
 
Method Summary
private  void appendAttr(java.lang.StringBuffer ret, com.port80.graph.IEdge e, java.lang.String name)
           
private  void appendAttr(java.lang.StringBuffer ret, com.port80.graph.IVertex v, java.lang.String name)
           
private  void aspectRatio(VirtualGraph g)
          Adjust for desired aspect ration.
private  void cleanupGraph(VirtualGraph g)
          Remove auxillary vertices and edges added for x-ranking, ...
private  DotEdge createDotEdge(DotVertex head, DotVertex tail, int minlen, int weight)
           
private  DotVertex createDotVertex(VirtualEdge e)
          Auxillary vertex that split the given VirtualEdge.
private  DotVertex createDotVertex(VirtualVertex v)
           
static int dotPosition(VirtualGraph g)
           
private  void expandGraph(VirtualGraph g)
          Expand subgraph and clusters to vertices.
private  DotGraph initGraph(VirtualGraph g)
          Create a DotGraph for x-position ranking.
 int position(VirtualGraph g)
           
static void printPositionGraph(VirtualGraph g)
          Print Position() result for viewing with ide.plugins.plotGraph.
private  void printXPositionGraph(DotGraph g)
          Print x-position rank result graph for debugging.
static void saveResult(VirtualGraph g)
           
private  void sprintXPositionEdge(java.lang.StringBuffer ret, DotEdge e)
           
private  int xPosition(VirtualGraph g)
          Determine x coordinates of each vertex.
private  void yPosition(VirtualGraph g)
          Determine y coordinates for each vertex.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NAME

private static final java.lang.String NAME
See Also:
Constant Field Values

DEBUG

private static final boolean DEBUG
See Also:
Constant Field Values

VERBOSE

private static final boolean VERBOSE

fXMargin

private int fXMargin

fYMargin

private int fYMargin

fDummy

private VirtualEdge fDummy

fVertexMap

java.util.Map fVertexMap

fXDIV_EDGES

private int fXDIV_EDGES

fXDIV_XEDGE

private int fXDIV_XEDGE

fYSPACING_BUSBUS

private int fYSPACING_BUSBUS

fYSPACING_XBUS

private int fYSPACING_XBUS

fWEIGHT_VIRTUALFACTOR

private int fWEIGHT_VIRTUALFACTOR
Constructor Detail

Position

public Position()
Method Detail

dotPosition

public static int dotPosition(VirtualGraph g)

saveResult

public static void saveResult(VirtualGraph g)

printPositionGraph

public static void printPositionGraph(VirtualGraph g)
Print Position() result for viewing with ide.plugins.plotGraph.


position

public int position(VirtualGraph g)

expandGraph

private void expandGraph(VirtualGraph g)
Expand subgraph and clusters to vertices.


yPosition

private void yPosition(VirtualGraph g)
Determine y coordinates for each vertex.


xPosition

private int xPosition(VirtualGraph g)
Determine x coordinates of each vertex.


cleanupGraph

private void cleanupGraph(VirtualGraph g)
Remove auxillary vertices and edges added for x-ranking, ... etc.


aspectRatio

private void aspectRatio(VirtualGraph g)
Adjust for desired aspect ration.


initGraph

private DotGraph initGraph(VirtualGraph g)
Create a DotGraph for x-position ranking. . x coordinates are determined by running the network simplex algorithm on the x-axis just like ranking for the y-axis. . To account for the port displacements, each edge is broken into two with one of them using the difference in the port displacements as its minimium length (ie. x distance) while the other is 0. Thus when the modified graph has optimal ranking (ie. with minimium lengths), the ports would be aligned. . Auxillary flat edges are also added between vertices with same rank that are not flat connected to ensure there are proper separation between them. The minimium length of auxillary edge is the minimium vertex separation (v1.width+v2.width)/2+xspacing . Weight of edges (real,virtual/auxillary) are adjusted according to their type. 'dot' assigned 1,2,8 to real-real,real-virtual and virtual-virtual edges which give priority to align long edges that pass through several levels. . Since NetworkSimplex.dotRank() would reinit. all the ranks anyway, there is no need to init. vertex.rank here. Only need to make sure edge.minLength and edge.weight is correct. . Spacings: |v|-vs-|v|-


createDotVertex

private DotVertex createDotVertex(VirtualVertex v)

createDotVertex

private DotVertex createDotVertex(VirtualEdge e)
Auxillary vertex that split the given VirtualEdge.


createDotEdge

private DotEdge createDotEdge(DotVertex head,
                              DotVertex tail,
                              int minlen,
                              int weight)

printXPositionGraph

private void printXPositionGraph(DotGraph g)
Print x-position rank result graph for debugging.


sprintXPositionEdge

private void sprintXPositionEdge(java.lang.StringBuffer ret,
                                 DotEdge e)

appendAttr

private void appendAttr(java.lang.StringBuffer ret,
                        com.port80.graph.IVertex v,
                        java.lang.String name)

appendAttr

private void appendAttr(java.lang.StringBuffer ret,
                        com.port80.graph.IEdge e,
                        java.lang.String name)