mxMedianHybridCrossingReduction

Sets the horizontal locations of node and edge dummy nodes on each layer.  Uses median down and up weighings as well heuristic to straighten edges as far as possible.

Summary
mxMedianHybridCrossingReductionSets the horizontal locations of node and edge dummy nodes on each layer.
Functions
mxMedianHybridCrossingReductionCreates a coordinate assignment.
Variables
layoutReference to the enclosing mxHierarchicalLayout.
maxIterationsThe maximum number of iterations to perform whilst reducing edge crossings.
nestedBestRanksStores each rank as a collection of cells in the best order found for each layer so far
currentBestCrossingsThe total number of crossings found in the best configuration so far
iterationsWithoutImprovementThe total number of crossings found in the best configuration so far
maxNoImprovementIterationsThe total number of crossings found in the best configuration so far
Functions
executePerforms a vertex ordering within ranks as described by Gansner et al 1993
calculateCrossingsCalculates the total number of edge crossing in the current graph.
calculateRankCrossingCalculates the number of edges crossings between the specified rank and the rank below it.
transposeTakes each possible adjacent cell pair on each rank and checks if swapping them around reduces the number of crossing
weightedMedianSweeps up or down the layout attempting to minimise the median placement of connected cells on adjacent ranks
medianRankAttempts to minimise the median placement of connected cells on this rank and one of the adjacent ranks
medianValueCalculates the median rank order positioning for the specified cell using the connected cells on the specified rank.
MedianCellSorterA utility class used to track cells whilst sorting occurs on the median values.
Functions
MedianCellSorterConstructs a new median cell sorter.
Variables
medianValueThe weighted value of the cell stored.
cellThe cell whose median value is being calculated
Functions
compareCompares two MedianCellSorters.

Functions

mxMedianHybridCrossingReduction

function mxMedianHybridCrossingReduction(layout)

Creates a coordinate assignment.

Arguments

intraCellSpacingthe minimum buffer between cells on the same rank
interRankCellSpacingthe minimum distance between cells on adjacent ranks
orientationthe position of the root node(s) relative to the graph
initialXthe leftmost coordinate node placement starts at

Variables

layout

mxMedianHybridCrossingReduction.prototype.layout

Reference to the enclosing mxHierarchicalLayout.

maxIterations

mxMedianHybridCrossingReduction.prototype.maxIterations

The maximum number of iterations to perform whilst reducing edge crossings.  Default is 24.

nestedBestRanks

mxMedianHybridCrossingReduction.prototype.nestedBestRanks

Stores each rank as a collection of cells in the best order found for each layer so far

currentBestCrossings

mxMedianHybridCrossingReduction.prototype.currentBestCrossings

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

iterationsWithoutImprovement

mxMedianHybridCrossingReduction.prototype.iterationsWithoutImprovement

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

maxNoImprovementIterations

mxMedianHybridCrossingReduction.prototype.maxNoImprovementIterations

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

Functions

execute

mxMedianHybridCrossingReduction.prototype.execute = function(parent)

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

calculateCrossings

mxMedianHybridCrossingReduction.prototype.calculateCrossings = function(model)

Calculates the total number of edge crossing in the current graph.  Returns the current number of edge crossings in the hierarchy graph model in the current candidate layout

Parameters

modelthe internal model describing the hierarchy

calculateRankCrossing

mxMedianHybridCrossingReduction.prototype.calculateRankCrossing = function(
   i,
   model
)

Calculates the number of edges crossings between the specified rank and the rank below it.  Returns the number of edges crossings with the rank beneath

Parameters

ithe topmost rank of the pair ( higher rank value )
modelthe internal model describing the hierarchy

transpose

mxMedianHybridCrossingReduction.prototype.transpose = function(
   mainLoopIteration,
   model
)

Takes each possible adjacent cell pair on each rank and checks if swapping them around reduces the number of crossing

Parameters

mainLoopIterationthe iteration number of the main loop
modelthe internal model describing the hierarchy

weightedMedian

mxMedianHybridCrossingReduction.prototype.weightedMedian = function(iteration,
model)

Sweeps up or down the layout attempting to minimise the median placement of connected cells on adjacent ranks

Parameters

iterationthe iteration number of the main loop
modelthe internal model describing the hierarchy

medianRank

mxMedianHybridCrossingReduction.prototype.medianRank = function(rankValue,
downwardSweep)

Attempts to minimise the median placement of connected cells on this rank and one of the adjacent ranks

Parameters

rankValuethe layer number of this rank
downwardSweepwhether or not this is a downward sweep through the graph

medianValue

mxMedianHybridCrossingReduction.prototype.medianValue = function(
   connectedCells,
   rankValue
)

Calculates the median rank order positioning for the specified cell using the connected cells on the specified rank.  Returns the median rank ordering value of the connected cells

Parameters

connectedCellsthe cells on the specified rank connected to the specified cell
rankValuethe rank that the connected cell lie upon

MedianCellSorter

A utility class used to track cells whilst sorting occurs on the median values.  Does not violate (x.compareTo(y)==0) == (x.equals(y))

Summary
Functions
MedianCellSorterConstructs a new median cell sorter.
Variables
medianValueThe weighted value of the cell stored.
cellThe cell whose median value is being calculated
Functions
compareCompares two MedianCellSorters.

Functions

MedianCellSorter

function MedianCellSorter()

Constructs a new median cell sorter.

Variables

medianValue

MedianCellSorter.prototype.medianValue

The weighted value of the cell stored.

cell

MedianCellSorter.prototype.cell

The cell whose median value is being calculated

Functions

compare

MedianCellSorter.prototype.compare = function(a,
b)

Compares two MedianCellSorters.

function mxMedianHybridCrossingReduction(layout)
Creates a coordinate assignment.
mxMedianHybridCrossingReduction.prototype.layout
Reference to the enclosing mxHierarchicalLayout.
A hierarchical layout algorithm.
mxMedianHybridCrossingReduction.prototype.maxIterations
The maximum number of iterations to perform whilst reducing edge crossings.
mxMedianHybridCrossingReduction.prototype.nestedBestRanks
Stores each rank as a collection of cells in the best order found for each layer so far
mxMedianHybridCrossingReduction.prototype.currentBestCrossings
The total number of crossings found in the best configuration so far
mxMedianHybridCrossingReduction.prototype.iterationsWithoutImprovement
The total number of crossings found in the best configuration so far
mxMedianHybridCrossingReduction.prototype.maxNoImprovementIterations
The total number of crossings found in the best configuration so far
mxMedianHybridCrossingReduction.prototype.execute = function(parent)
Performs a vertex ordering within ranks as described by Gansner et al 1993
mxMedianHybridCrossingReduction.prototype.calculateCrossings = function(model)
Calculates the total number of edge crossing in the current graph.
mxMedianHybridCrossingReduction.prototype.calculateRankCrossing = function(
   i,
   model
)
Calculates the number of edges crossings between the specified rank and the rank below it.
mxMedianHybridCrossingReduction.prototype.transpose = function(
   mainLoopIteration,
   model
)
Takes each possible adjacent cell pair on each rank and checks if swapping them around reduces the number of crossing
mxMedianHybridCrossingReduction.prototype.weightedMedian = function(iteration,
model)
Sweeps up or down the layout attempting to minimise the median placement of connected cells on adjacent ranks
mxMedianHybridCrossingReduction.prototype.medianRank = function(rankValue,
downwardSweep)
Attempts to minimise the median placement of connected cells on this rank and one of the adjacent ranks
mxMedianHybridCrossingReduction.prototype.medianValue = function(
   connectedCells,
   rankValue
)
Calculates the median rank order positioning for the specified cell using the connected cells on the specified rank.
function MedianCellSorter()
Constructs a new median cell sorter.
MedianCellSorter.prototype.medianValue
The weighted value of the cell stored.
MedianCellSorter.prototype.cell
The cell whose median value is being calculated
MedianCellSorter.prototype.compare = function(a,
b)
Compares two MedianCellSorters.
Close