JGraph
v5.13.0.4


com.jgraph.layout.hierarchical
Class JGraphMedianHybridCrossingReduction

java.lang.Object
  extended by com.jgraph.layout.hierarchical.JGraphMedianHybridCrossingReduction
All Implemented Interfaces:
JGraphHierarchicalLayoutStep, JGraphLayout.Stoppable

public class JGraphMedianHybridCrossingReduction
extends java.lang.Object
implements JGraphHierarchicalLayoutStep, JGraphLayout.Stoppable

Performs a vertex ordering within ranks as described by Gansner et al 1993


Nested Class Summary
protected  class JGraphMedianHybridCrossingReduction.MedianCellSorter
          A utility class used to track cells whilst sorting occurs on the median values.
 
Field Summary
protected  int currentBestCrossings
          The total number of crossings found in the best configuration so far
protected  int iterationsWithoutImprovement
           
protected  int maxIterations
          The maximum number of iterations to perform whilst reducing edge crossings
protected  int maxNoImprovementIterations
           
protected  java.lang.Object[][] nestedBestRanks
          Stores each rank as a collection of cells in the best order found for each layer so far
protected  JGraphLayoutProgress progress
          The layout progress bar
 
Constructor Summary
JGraphMedianHybridCrossingReduction()
           
 
Method Summary
protected  int calculateRankCrossing(int i, JGraphHierarchyModel model)
          Calculates the number of edges crossings between the specified rank and the rank below it
 JGraphLayoutProgress getProgress()
          Returns the progress object that represents the progress of the current layout run.
 JGraphHierarchyModel run(JGraphFacade facade, JGraphHierarchyModel model)
          Performs a vertex ordering within ranks as described by Gansner et al 1993
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

maxIterations

protected int maxIterations
The maximum number of iterations to perform whilst reducing edge crossings


nestedBestRanks

protected java.lang.Object[][] nestedBestRanks
Stores each rank as a collection of cells in the best order found for each layer so far


currentBestCrossings

protected int currentBestCrossings
The total number of crossings found in the best configuration so far


iterationsWithoutImprovement

protected int iterationsWithoutImprovement

maxNoImprovementIterations

protected int maxNoImprovementIterations

progress

protected JGraphLayoutProgress progress
The layout progress bar

Constructor Detail

JGraphMedianHybridCrossingReduction

public JGraphMedianHybridCrossingReduction()
Method Detail

run

public JGraphHierarchyModel run(JGraphFacade facade,
                                JGraphHierarchyModel model)
Performs a vertex ordering within ranks as described by Gansner et al 1993

Specified by:
run in interface JGraphHierarchicalLayoutStep
Parameters:
facade - the facade describing the input graph
model - an internal model of the hierarchical layout
Returns:
the updated hierarchy model

calculateRankCrossing

protected int calculateRankCrossing(int i,
                                    JGraphHierarchyModel model)
Calculates the number of edges crossings between the specified rank and the rank below it

Parameters:
i - the topmost rank of the pair ( higher rank value )
model - the internal hierarchy model of the graph
Returns:
the number of edges crossings with the rank beneath

getProgress

public JGraphLayoutProgress getProgress()
Description copied from interface: JGraphLayout.Stoppable
Returns the progress object that represents the progress of the current layout run. Once created, this instance should not be replaced during a layout run. For new runs you should use the reset method on the progress. Consequently, the max progress is only valid after the run method has been invoked, which means you should use a listener if you spawn a new thread.

By convention, the layout must check the isStopped method in its inner-most loops and return immediately if the method returns true.

Specified by:
getProgress in interface JGraphLayout.Stoppable
Returns:
Returns the progress.

JGraph
v5.13.0.4


Copyright (C) 2001-2009 JGraph Ltd. All rights reserved.