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

Quick Search    Search Deep

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

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

public class DotGraph
extends java.lang.Object

DotGraph is an intermediate graph created for layout using the 'dot' layout algorithms. DotGraph is created from an IGraph with additional V/E added or removed to be used by the NetworkSimplex.dotRank(). . DotGraph is created by extracting the topology information from an input IGraph. Instead of overlay onto the original graph, DotDirectGraph build an independent copy of the original graph. . Layout result are patched back to the original graph attribute table ('pos','-rank') and the DotGraph can be released after each layout. . DotGraph is read only since neither the vertex nor the edges from the original IGraph can be changed.


Nested Class Summary
private  class DotGraph.AcyclicData
           
 
Field Summary
private static java.lang.String CLASSNAME
           
private static int CLUSTER
           
private static boolean DEBUG
           
private  java.util.Map fEdgeMap
           
protected  int fMaxRank
           
protected  int fMinRank
           
protected  java.lang.String fName
           
protected  com.port80.graph.IGraph fOriginal
          The original IGraph.
protected  int fType
           
protected  java.util.Map fVertexMap
          IVertex,IGraph->DotVertex mapping.
private  DotVertex[] fVertices
           
private static java.lang.String NAME
           
private static int NONE
           
private static java.lang.String PACKAGENAME
           
private static int ROOTGRAPH
           
private static int SUBGRAPH
           
private static boolean VERBOSE
           
private static int VERSION
           
private static java.lang.String VERSIONNAME
           
 
Constructor Summary
DotGraph(com.port80.graph.IGraph g)
           
DotGraph(java.lang.String name, DotVertex[] vlist)
           
 
Method Summary
private  int acyclic(DotVertex[] vts)
          Make graph acyclic by reversing edges that points back to an ancestor in a depth first search.
private  int acyclic(DotVertex[] vts, int start, boolean doreverse)
           
private  void acyclic(DotVertex start, java.util.Set visited, java.util.Set ancestors, java.util.Set reversed, DotGraph.AcyclicData data)
           
private  void anneal(DotGraph.AcyclicData data)
          Fix reversed critical edges.
 boolean checkAcyclic()
           
private  boolean checkAcyclic(DotVertex v, java.util.Set visited, java.util.Set ancestors)
          Check that graph is acyclic.
 void clear()
           
private  java.util.List decompose()
          Decompose graph into islands.
private  java.util.List decompose(DotVertex start, java.util.Set visited, java.util.List ret)
          Perform a bidirectional depth first search from the starting vertex to all vertices connected on the same island.
 java.lang.String getName()
           
 com.port80.graph.IGraph getOriginal()
           
 DotVertex[] getVertices()
           
private  void importGraphEdge(com.port80.graph.IGraph g, java.util.List in, java.util.List out)
          Only edges going from graph g to vertex external to g are used.
private  void importGraphVertex(com.port80.graph.IGraph g, java.util.List ret)
          Add subgraph, collapse cluster to single node for ranking.
private  void importVertexEdge(com.port80.graph.IVertex v, java.util.List in, java.util.List out)
           
private  void initEdges(DotVertex dotv, java.util.List in, java.util.List out)
           
private  void minMaxRanked(DotVertex[] vts)
          Reverse edges for min/max ranked vertex so ranking would put them into the right rank.
 void saveRanks()
          Adjust ranks to eliminate empty ranks and save ranks to IGraph.
private  void sprintRankDebugEdge(java.lang.StringBuffer ret, DotEdge e)
           
 java.lang.String sprintRankDebugGraph()
          Print rank result graph for debugging.
 java.lang.String toString()
          Convert this Object to a human-readable String.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NAME

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

PACKAGENAME

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

CLASSNAME

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

VERSION

private static final int VERSION
See Also:
Constant Field Values

VERSIONNAME

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

DEBUG

private static final boolean DEBUG
See Also:
Constant Field Values

VERBOSE

private static boolean VERBOSE

NONE

private static final int NONE
See Also:
Constant Field Values

ROOTGRAPH

private static final int ROOTGRAPH
See Also:
Constant Field Values

CLUSTER

private static final int CLUSTER
See Also:
Constant Field Values

SUBGRAPH

private static final int SUBGRAPH
See Also:
Constant Field Values

fName

protected java.lang.String fName

fType

protected int fType

fOriginal

protected com.port80.graph.IGraph fOriginal
The original IGraph.


fMinRank

protected int fMinRank

fMaxRank

protected int fMaxRank

fVertexMap

protected java.util.Map fVertexMap
IVertex,IGraph->DotVertex mapping.


fEdgeMap

private java.util.Map fEdgeMap

fVertices

private DotVertex[] fVertices
Constructor Detail

DotGraph

public DotGraph(java.lang.String name,
                DotVertex[] vlist)

DotGraph

public DotGraph(com.port80.graph.IGraph g)
Method Detail

initEdges

private void initEdges(DotVertex dotv,
                       java.util.List in,
                       java.util.List out)

importVertexEdge

private void importVertexEdge(com.port80.graph.IVertex v,
                              java.util.List in,
                              java.util.List out)

importGraphEdge

private void importGraphEdge(com.port80.graph.IGraph g,
                             java.util.List in,
                             java.util.List out)
Only edges going from graph g to vertex external to g are used. External vertex that conected to an internal vertex of g would connect to the vertex that represent g instead. The fVertexMap of IVertex->DotVertex is built for such purpose.


importGraphVertex

private void importGraphVertex(com.port80.graph.IGraph g,
                               java.util.List ret)
Add subgraph, collapse cluster to single node for ranking.


minMaxRanked

private void minMaxRanked(DotVertex[] vts)
Reverse edges for min/max ranked vertex so ranking would put them into the right rank.


decompose

private java.util.List decompose()
Decompose graph into islands.


decompose

private java.util.List decompose(DotVertex start,
                                 java.util.Set visited,
                                 java.util.List ret)
Perform a bidirectional depth first search from the starting vertex to all vertices connected on the same island.


acyclic

private int acyclic(DotVertex[] vts)
Make graph acyclic by reversing edges that points back to an ancestor in a depth first search. . Which edge got reversed very much depends on where the search is started. We try all starting points and find the one with least reversals. This reduce distortion of the original topology and also make the layout result more stable (ie. we comes up with same result for same graph topology).


acyclic

private int acyclic(DotVertex[] vts,
                    int start,
                    boolean doreverse)

acyclic

private void acyclic(DotVertex start,
                     java.util.Set visited,
                     java.util.Set ancestors,
                     java.util.Set reversed,
                     DotGraph.AcyclicData data)

anneal

private void anneal(DotGraph.AcyclicData data)
Fix reversed critical edges.


getName

public java.lang.String getName()

getOriginal

public com.port80.graph.IGraph getOriginal()

getVertices

public DotVertex[] getVertices()

saveRanks

public void saveRanks()
Adjust ranks to eliminate empty ranks and save ranks to IGraph.


clear

public void clear()

toString

public java.lang.String toString()
Description copied from class: java.lang.Object
Convert this Object to a human-readable String. There are no limits placed on how long this String should be or what it should contain. We suggest you make it as intuitive as possible to be able to place it into System.out.println() 55 and such.

It is typical, but not required, to ensure that this method never completes abruptly with a java.lang.RuntimeException.

This method will be called when performing string concatenation with this object. If the result is null, string concatenation will instead use "null".

The default implementation returns getClass().getName() + "@" + Integer.toHexString(hashCode()).


checkAcyclic

private boolean checkAcyclic(DotVertex v,
                             java.util.Set visited,
                             java.util.Set ancestors)
Check that graph is acyclic.


checkAcyclic

public boolean checkAcyclic()

sprintRankDebugGraph

public java.lang.String sprintRankDebugGraph()
Print rank result graph for debugging.


sprintRankDebugEdge

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