mxFastOrganicLayout

Extends mxGraphLayout to implement a fast organic layout algorithm.  The vertices need to be connected for this layout to work, vertices with no connections are ignored.

Example

var layout = new mxFastOrganicLayout(graph);
layout.execute(graph.getDefaultParent());
Summary
mxFastOrganicLayoutExtends mxGraphLayout to implement a fast organic layout algorithm.
Functions
mxCompactTreeLayoutConstructs a new fast organic layout for the specified graph.
Variables
useInputOriginSpecifies if the top left corner of the input cells should be the origin of the layout result.
resetEdgesSpecifies if all edge points of traversed edges should be removed.
disableEdgeStyleSpecifies if the STYLE_NOEDGESTYLE flag should be set on edges that are modified by the result.
forceConstantThe force constant by which the attractive forces are divided and the replusive forces are multiple by the square of.
forceConstantSquaredCache of <forceConstant>^2 for performance.
minDistanceLimitMinimal distance limit.
maxDistanceLimitMaximal distance limit.
minDistanceLimitSquaredCached version of minDistanceLimit squared.
initialTempStart value of temperature.
temperatureTemperature to limit displacement at later stages of layout.
maxIterationsTotal number of iterations to run the layout though.
iterationCurrent iteration count.
vertexArrayAn array of all vertices to be laid out.
dispXAn array of locally stored X co-ordinate displacements for the vertices.
dispYAn array of locally stored Y co-ordinate displacements for the vertices.
cellLocationAn array of locally stored co-ordinate positions for the vertices.
radiusThe approximate radius of each cell, nodes only.
radiusSquaredThe approximate radius squared of each cell, nodes only.
isMoveableArray of booleans representing the movable states of the vertices.
neighboursLocal copy of cell neighbours.
indicesHashtable from cells to local indices.
allowedToRunBoolean flag that specifies if the layout is allowed to run.
Functions
isVertexIgnoredReturns a boolean indicating if the given mxCell should be ignored as a vertex.
executeImplements mxGraphLayout.execute.
calcPositionsTakes the displacements calculated for each cell and applies them to the local cache of cell positions.
calcAttractionCalculates the attractive forces between all laid out nodes linked by edges
calcRepulsionCalculates the repulsive forces between all laid out nodes
reduceTemperatureReduces the temperature of the layout from an initial setting in a linear fashion to zero.

Functions

mxCompactTreeLayout

Constructs a new fast organic layout for the specified graph.

Variables

useInputOrigin

mxFastOrganicLayout.prototype.useInputOrigin

Specifies if the top left corner of the input cells should be the origin of the layout result.  Default is true.

resetEdges

mxFastOrganicLayout.prototype.resetEdges

Specifies if all edge points of traversed edges should be removed.  Default is true.

disableEdgeStyle

mxFastOrganicLayout.prototype.disableEdgeStyle

Specifies if the STYLE_NOEDGESTYLE flag should be set on edges that are modified by the result.  Default is true.

forceConstant

mxFastOrganicLayout.prototype.forceConstant

The force constant by which the attractive forces are divided and the replusive forces are multiple by the square of.  The value equates to the average radius there is of free space around each node.  Default is 50.

forceConstantSquared

mxFastOrganicLayout.prototype.forceConstantSquared

Cache of <forceConstant>^2 for performance.

minDistanceLimit

mxFastOrganicLayout.prototype.minDistanceLimit

Minimal distance limit.  Default is 2.  Prevents of dividing by zero.

maxDistanceLimit

mxFastOrganicLayout.prototype.maxDistanceLimit

Maximal distance limit.  Default is 500.  Prevents of dividing by zero.

minDistanceLimitSquared

mxFastOrganicLayout.prototype.minDistanceLimitSquared

Cached version of minDistanceLimit squared.

initialTemp

mxFastOrganicLayout.prototype.initialTemp

Start value of temperature.  Default is 200.

temperature

mxFastOrganicLayout.prototype.temperature

Temperature to limit displacement at later stages of layout.

maxIterations

mxFastOrganicLayout.prototype.maxIterations

Total number of iterations to run the layout though.

iteration

mxFastOrganicLayout.prototype.iteration

Current iteration count.

vertexArray

mxFastOrganicLayout.prototype.vertexArray

An array of all vertices to be laid out.

dispX

mxFastOrganicLayout.prototype.dispX

An array of locally stored X co-ordinate displacements for the vertices.

dispY

mxFastOrganicLayout.prototype.dispY

An array of locally stored Y co-ordinate displacements for the vertices.

cellLocation

mxFastOrganicLayout.prototype.cellLocation

An array of locally stored co-ordinate positions for the vertices.

radius

mxFastOrganicLayout.prototype.radius

The approximate radius of each cell, nodes only.

radiusSquared

mxFastOrganicLayout.prototype.radiusSquared

The approximate radius squared of each cell, nodes only.

isMoveable

mxFastOrganicLayout.prototype.isMoveable

Array of booleans representing the movable states of the vertices.

neighbours

mxFastOrganicLayout.prototype.neighbours

Local copy of cell neighbours.

indices

mxFastOrganicLayout.prototype.indices

Hashtable from cells to local indices.

allowedToRun

mxFastOrganicLayout.prototype.allowedToRun

Boolean flag that specifies if the layout is allowed to run.  If this is set to false, then the layout exits in the following iteration.

Functions

isVertexIgnored

mxFastOrganicLayout.prototype.isVertexIgnored = function(vertex)

Returns a boolean indicating if the given mxCell should be ignored as a vertex.  This returns true if the cell has no connections.

Parameters

vertexmxCell whose ignored state should be returned.

execute

mxFastOrganicLayout.prototype.execute = function(parent)

Implements mxGraphLayout.execute.  This operates on all children of the given parent where isVertexIgnored returns false.

calcPositions

mxFastOrganicLayout.prototype.calcPositions = function()

Takes the displacements calculated for each cell and applies them to the local cache of cell positions.  Limits the displacement to the current temperature.

calcAttraction

mxFastOrganicLayout.prototype.calcAttraction = function()

Calculates the attractive forces between all laid out nodes linked by edges

calcRepulsion

mxFastOrganicLayout.prototype.calcRepulsion = function()

Calculates the repulsive forces between all laid out nodes

reduceTemperature

mxFastOrganicLayout.prototype.reduceTemperature = function()

Reduces the temperature of the layout from an initial setting in a linear fashion to zero.

Base class for all layout algorithms in mxGraph.
mxFastOrganicLayout.prototype.useInputOrigin
Specifies if the top left corner of the input cells should be the origin of the layout result.
mxFastOrganicLayout.prototype.resetEdges
Specifies if all edge points of traversed edges should be removed.
mxFastOrganicLayout.prototype.disableEdgeStyle
Specifies if the STYLE_NOEDGESTYLE flag should be set on edges that are modified by the result.
mxFastOrganicLayout.prototype.forceConstant
The force constant by which the attractive forces are divided and the replusive forces are multiple by the square of.
mxFastOrganicLayout.prototype.forceConstantSquared
Cache of <forceConstant>^2 for performance.
mxFastOrganicLayout.prototype.minDistanceLimit
Minimal distance limit.
mxFastOrganicLayout.prototype.maxDistanceLimit
Maximal distance limit.
mxFastOrganicLayout.prototype.minDistanceLimitSquared
Cached version of minDistanceLimit squared.
mxFastOrganicLayout.prototype.initialTemp
Start value of temperature.
mxFastOrganicLayout.prototype.temperature
Temperature to limit displacement at later stages of layout.
mxFastOrganicLayout.prototype.maxIterations
Total number of iterations to run the layout though.
mxFastOrganicLayout.prototype.iteration
Current iteration count.
mxFastOrganicLayout.prototype.vertexArray
An array of all vertices to be laid out.
mxFastOrganicLayout.prototype.dispX
An array of locally stored X co-ordinate displacements for the vertices.
mxFastOrganicLayout.prototype.dispY
An array of locally stored Y co-ordinate displacements for the vertices.
mxFastOrganicLayout.prototype.cellLocation
An array of locally stored co-ordinate positions for the vertices.
mxFastOrganicLayout.prototype.radius
The approximate radius of each cell, nodes only.
mxFastOrganicLayout.prototype.radiusSquared
The approximate radius squared of each cell, nodes only.
mxFastOrganicLayout.prototype.isMoveable
Array of booleans representing the movable states of the vertices.
mxFastOrganicLayout.prototype.neighbours
Local copy of cell neighbours.
mxFastOrganicLayout.prototype.indices
Hashtable from cells to local indices.
mxFastOrganicLayout.prototype.allowedToRun
Boolean flag that specifies if the layout is allowed to run.
mxFastOrganicLayout.prototype.isVertexIgnored = function(vertex)
Returns a boolean indicating if the given mxCell should be ignored as a vertex.
Cells are the elements of the graph model.
mxFastOrganicLayout.prototype.execute = function(parent)
Implements mxGraphLayout.execute.
mxGraphLayout.prototype.execute = function(parent)
Executes the layout algorithm for the children of the given parent.
mxFastOrganicLayout.prototype.calcPositions = function()
Takes the displacements calculated for each cell and applies them to the local cache of cell positions.
mxFastOrganicLayout.prototype.calcAttraction = function()
Calculates the attractive forces between all laid out nodes linked by edges
mxFastOrganicLayout.prototype.calcRepulsion = function()
Calculates the repulsive forces between all laid out nodes
mxFastOrganicLayout.prototype.reduceTemperature = function()
Reduces the temperature of the layout from an initial setting in a linear fashion to zero.
Close