com.mxgraph.layout.hierarchical.stage

## Class mxMedianHybridCrossingReduction

- java.lang.Object
- - com.mxgraph.layout.hierarchical.stage.mxMedianHybridCrossingReduction

- All Implemented Interfaces:
    mxHierarchicalLayoutStage

      public class mxMedianHybridCrossingReduction
      extends java.lang.Object
      implements mxHierarchicalLayoutStage

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

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `protected class` | `mxMedianHybridCrossingReduction.MedianCellSorter` A utility class used to track cells whilst sorting occurs on the median values.

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected int` | `currentBestCrossings` The total number of crossings found in the best configuration so far
    `protected int` | `iterationsWithoutImprovement`
    `protected mxHierarchicalLayout` | `layout` Reference to the enclosing layout algorithm
    `protected int` | `maxIterations` The maximum number of iterations to perform whilst reducing edge crossings
    `protected int` | `maxNoImprovementIterations`
    `protected mxGraphAbstractHierarchyCell[][]` | `nestedBestRanks` Stores each rank as a collection of cells in the best order found for each layer so far

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `mxMedianHybridCrossingReduction(mxHierarchicalLayout layout)` Constructor that has the roots specified

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected int` | `calculateRankCrossing(int i, mxGraphHierarchyModel model)` Calculates the number of edges crossings between the specified rank and the rank below it
    `void` | `execute(java.lang.Object parent)` 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

    - #### layout

          protected mxHierarchicalLayout layout

      Reference to the enclosing layout algorithm

    - #### maxIterations

          protected int maxIterations

      The maximum number of iterations to perform whilst reducing edge crossings

    - #### nestedBestRanks

          protected mxGraphAbstractHierarchyCell[][] 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

  - ### Constructor Detail

    - #### mxMedianHybridCrossingReduction

          public mxMedianHybridCrossingReduction(mxHierarchicalLayout layout)

      Constructor that has the roots specified

  - ### Method Detail

    - #### execute

          public void execute(java.lang.Object parent)

      Performs a vertex ordering within ranks as described by Gansner et al 1993
      Specified by:
        `execute` in interface `mxHierarchicalLayoutStage`

    - #### calculateRankCrossing

          protected int calculateRankCrossing(int i,
                                  mxGraphHierarchyModel 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

Copyright (c) 2010 Gaudenz Alder. All rights reserved.