mxGraphHierarchyModel

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
mxGraphHierarchyModelInternal model of a hierarchical graph.
Functions
mxGraphHierarchyModelCreates 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.
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.
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

mxGraphHierarchyModel

function mxGraphHierarchyModel(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

mxGraphHierarchyModel.prototype.maxRank

Stores the largest rank number allocated

vertexMapper

mxGraphHierarchyModel.prototype.vertexMapper

Map from graph vertices to internal model nodes.

edgeMapper

mxGraphHierarchyModel.prototype.edgeMapper

Map from graph edges to internal model edges

ranks

mxGraphHierarchyModel.prototype.ranks

Mapping from rank number to actual rank

roots

mxGraphHierarchyModel.prototype.roots

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

parent

mxGraphHierarchyModel.prototype.parent

The parent cell whose children are being laid out

dfsCount

mxGraphHierarchyModel.prototype.dfsCount

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

SOURCESCANSTARTRANK

mxGraphHierarchyModel.prototype.SOURCESCANSTARTRANK

High value to start source layering scan rank value from.

tightenToSource

mxGraphHierarchyModel.prototype.tightenToSource

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

Functions

createInternalCells

mxGraphHierarchyModel.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

mxGraphHierarchyModel.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.

fixRanks

mxGraphHierarchyModel.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

mxGraphHierarchyModel.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

mxGraphHierarchyModel.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

mxGraphHierarchyModel.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 mxGraphHierarchyModel(layout,
vertices,
roots,
parent,
tightenToSource)
Creates an internal ordered graph model using the vertices passed in.
mxGraphHierarchyModel.prototype.maxRank
Stores the largest rank number allocated
mxGraphHierarchyModel.prototype.vertexMapper
Map from graph vertices to internal model nodes.
mxGraphHierarchyModel.prototype.edgeMapper
Map from graph edges to internal model edges
mxGraphHierarchyModel.prototype.ranks
Mapping from rank number to actual rank
mxGraphHierarchyModel.prototype.roots
Store of roots of this hierarchy model, these are real graph cells, not internal cells
mxGraphHierarchyModel.prototype.parent
The parent cell whose children are being laid out
mxGraphHierarchyModel.prototype.dfsCount
Count of the number of times the ancestor dfs has been used.
mxGraphHierarchyModel.prototype.SOURCESCANSTARTRANK
High value to start source layering scan rank value from.
mxGraphHierarchyModel.prototype.tightenToSource
Whether or not to tighten the assigned ranks of vertices up towards the source cells.
mxGraphHierarchyModel.prototype.createInternalCells = function(layout,
vertices,
internalVertices)
Creates all edges in the internal model
mxGraphHierarchyModel.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.
mxGraphHierarchyModel.prototype.fixRanks = function()
Fixes the layer assignments to the values stored in the nodes.
mxGraphHierarchyModel.prototype.visit = function(visitor,
dfsRoots,
trackAncestors,
seenNodes)
A depth first search through the internal heirarchy model.
mxGraphHierarchyModel.prototype.dfs = function(parent,
root,
connectingEdge,
visitor,
seen,
layer)
Performs a depth first search on the internal hierarchy model
mxGraphHierarchyModel.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