mxSwimlaneModel

Internal model of a hierarchical graph.  This model stores nodes and edges equivalent to the real graph nodes and edges, but also stores the rank of the cells, the order within the ranks and the new candidate locations of cells.  The internal model also reverses edge direction were appropriate , ignores self-loop and groups parallels together under one edge object.

Summary
mxSwimlaneModelInternal model of a hierarchical graph.
Functions
mxSwimlaneModelCreates an internal ordered graph model using the vertices passed in.
Variables
maxRankStores the largest rank number allocated
vertexMapperMap from graph vertices to internal model nodes.
edgeMapperMap from graph edges to internal model edges
ranksMapping from rank number to actual rank
rootsStore of roots of this hierarchy model, these are real graph cells, not internal cells
parentThe parent cell whose children are being laid out
dfsCountCount of the number of times the ancestor dfs has been used.
SOURCESCANSTARTRANKHigh value to start source layering scan rank value from.
tightenToSourceWhether or not to tighten the assigned ranks of vertices up towards the source cells.
ranksPerGroupAn array of the number of ranks within each swimlane
Functions
createInternalCellsCreates all edges in the internal model
initialRankBasic determination of minimum layer ranking by working from from sources or sinks and working through each node in the relevant edge direction.
maxChainDfsPerforms a depth first search on the internal hierarchy model.
fixRanksFixes the layer assignments to the values stored in the nodes.
visitA depth first search through the internal heirarchy model.
dfsPerforms a depth first search on the internal hierarchy model
extendedDfsPerforms a depth first search on the internal hierarchy model.

Functions

mxSwimlaneModel

function mxSwimlaneModel(layout,
vertices,
roots,
parent,
tightenToSource)

Creates an internal ordered graph model using the vertices passed in.  If there are any, leftward edge need to be inverted in the internal model

Arguments

graphthe facade describing the graph to be operated on
verticesthe vertices for this hierarchy
orderedwhether or not the vertices are already ordered
deterministicwhether or not this layout should be deterministic on each
tightenToSourcewhether or not to tighten vertices towards the sources
scanRanksFromSinksWhether rank assignment is from the sinks or sources. usage

Variables

maxRank

mxSwimlaneModel.prototype.maxRank

Stores the largest rank number allocated

vertexMapper

mxSwimlaneModel.prototype.vertexMapper

Map from graph vertices to internal model nodes.

edgeMapper

mxSwimlaneModel.prototype.edgeMapper

Map from graph edges to internal model edges

ranks

mxSwimlaneModel.prototype.ranks

Mapping from rank number to actual rank

roots

mxSwimlaneModel.prototype.roots

Store of roots of this hierarchy model, these are real graph cells, not internal cells

parent

mxSwimlaneModel.prototype.parent

The parent cell whose children are being laid out

dfsCount

mxSwimlaneModel.prototype.dfsCount

Count of the number of times the ancestor dfs has been used.

SOURCESCANSTARTRANK

mxSwimlaneModel.prototype.SOURCESCANSTARTRANK

High value to start source layering scan rank value from.

tightenToSource

mxSwimlaneModel.prototype.tightenToSource

Whether or not to tighten the assigned ranks of vertices up towards the source cells.

ranksPerGroup

mxSwimlaneModel.prototype.ranksPerGroup

An array of the number of ranks within each swimlane

Functions

createInternalCells

mxSwimlaneModel.prototype.createInternalCells = function(layout,
vertices,
internalVertices)

Creates all edges in the internal model

Parameters

layoutReference to the mxHierarchicalLayout algorithm.
verticesArray of mxCells that represent the vertices whom are to have an internal representation created.
internalVerticesThe array of mxGraphHierarchyNodes to have their information filled in using the real vertices.

initialRank

mxSwimlaneModel.prototype.initialRank = function()

Basic determination of minimum layer ranking by working from from sources or sinks and working through each node in the relevant edge direction.  Starting at the sinks is basically a longest path layering algorithm.

maxChainDfs

mxSwimlaneModel.prototype.maxChainDfs = function(parent,
root,
connectingEdge,
seen,
chainCount)

Performs a depth first search on the internal hierarchy model.  This dfs extends the default version by keeping track of chains within groups.  Any cycles should be removed prior to running, but previously seen cells are ignored.

Parameters

parentthe parent internal node of the current internal node
rootthe current internal node
connectingEdgethe internal edge connecting the internal node and the parent internal node, if any
seena set of all nodes seen by this dfs
chainCountthe number of edges in the chain of vertices going through the current swimlane

fixRanks

mxSwimlaneModel.prototype.fixRanks = function()

Fixes the layer assignments to the values stored in the nodes.  Also needs to create dummy nodes for edges that cross layers.

visit

mxSwimlaneModel.prototype.visit = function(visitor,
dfsRoots,
trackAncestors,
seenNodes)

A depth first search through the internal heirarchy model.

Parameters

visitorThe visitor function pattern to be called for each node.
trackAncestorsWhether or not the search is to keep track all nodes directly above this one in the search path.

dfs

mxSwimlaneModel.prototype.dfs = function(parent,
root,
connectingEdge,
visitor,
seen,
layer)

Performs a depth first search on the internal hierarchy model

Parameters

parentthe parent internal node of the current internal node
rootthe current internal node
connectingEdgethe internal edge connecting the internal node and the parent internal node, if any
visitorthe visitor pattern to be called for each node
seena set of all nodes seen by this dfs a set of all of the ancestor node of the current node
layerthe layer on the dfs tree ( not the same as the model ranks )

extendedDfs

mxSwimlaneModel.prototype.extendedDfs = function(parent,
root,
connectingEdge,
visitor,
seen,
ancestors,
childHash,
layer)

Performs a depth first search on the internal hierarchy model.  This dfs extends the default version by keeping track of cells ancestors, but it should be only used when necessary because of it can be computationally intensive for deep searches.

Parameters

parentthe parent internal node of the current internal node
rootthe current internal node
connectingEdgethe internal edge connecting the internal node and the parent internal node, if any
visitorthe visitor pattern to be called for each node
seena set of all nodes seen by this dfs
ancestorsthe parent hash code
childHashthe new hash code for this node
layerthe layer on the dfs tree ( not the same as the model ranks )
function mxSwimlaneModel(layout,
vertices,
roots,
parent,
tightenToSource)
Creates an internal ordered graph model using the vertices passed in.
mxSwimlaneModel.prototype.maxRank
Stores the largest rank number allocated
mxSwimlaneModel.prototype.vertexMapper
Map from graph vertices to internal model nodes.
mxSwimlaneModel.prototype.edgeMapper
Map from graph edges to internal model edges
mxSwimlaneModel.prototype.ranks
Mapping from rank number to actual rank
mxSwimlaneModel.prototype.roots
Store of roots of this hierarchy model, these are real graph cells, not internal cells
mxSwimlaneModel.prototype.parent
The parent cell whose children are being laid out
mxSwimlaneModel.prototype.dfsCount
Count of the number of times the ancestor dfs has been used.
mxSwimlaneModel.prototype.SOURCESCANSTARTRANK
High value to start source layering scan rank value from.
mxSwimlaneModel.prototype.tightenToSource
Whether or not to tighten the assigned ranks of vertices up towards the source cells.
mxSwimlaneModel.prototype.ranksPerGroup
An array of the number of ranks within each swimlane
mxSwimlaneModel.prototype.createInternalCells = function(layout,
vertices,
internalVertices)
Creates all edges in the internal model
mxSwimlaneModel.prototype.initialRank = function()
Basic determination of minimum layer ranking by working from from sources or sinks and working through each node in the relevant edge direction.
mxSwimlaneModel.prototype.maxChainDfs = function(parent,
root,
connectingEdge,
seen,
chainCount)
Performs a depth first search on the internal hierarchy model.
mxSwimlaneModel.prototype.fixRanks = function()
Fixes the layer assignments to the values stored in the nodes.
mxSwimlaneModel.prototype.visit = function(visitor,
dfsRoots,
trackAncestors,
seenNodes)
A depth first search through the internal heirarchy model.
mxSwimlaneModel.prototype.dfs = function(parent,
root,
connectingEdge,
visitor,
seen,
layer)
Performs a depth first search on the internal hierarchy model
mxSwimlaneModel.prototype.extendedDfs = function(parent,
root,
connectingEdge,
visitor,
seen,
ancestors,
childHash,
layer)
Performs a depth first search on the internal hierarchy model.
A hierarchical layout algorithm.
Cells are the elements of the graph model.
An abstraction of a hierarchical edge for the hierarchy layout
Close