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.
mxGraphHierarchyModel | Internal model of a hierarchical graph. |
Functions | |
mxGraphHierarchyModel | Creates an internal ordered graph model using the vertices passed in. |
Variables | |
scanRanksFromSinks | Whether the rank assignment is done from the sinks or sources. |
maxRank | Stores the largest rank number allocated |
vertexMapper | Map from graph vertices to internal model nodes. |
edgeMapper | Map from graph edges to internal model edges |
ranks | Mapping from rank number to actual rank |
roots | Store of roots of this hierarchy model, these are real graph cells, not internal cells |
parent | The parent cell whose children are being laid out |
dfsCount | Count of the number of times the ancestor dfs has been used. |
SOURCESCANSTARTRANK | High value to start source layering scan rank value from. |
deterministic | Whether or not cells are ordered according to the order in the graph model. |
tightenToSource | Whether or not to tighten the assigned ranks of vertices up towards the source cells. |
Functions | |
formOrderedHierarchy | Creates an internal ordered graph model using the vertices passed in. |
createInternalCells | Creates all edges in the internal model |
initialRank | Basic determination of minimum layer ranking by working from from sources or sinks and working through each node in the relevant edge direction. |
fixRanks | Fixes the layer assignments to the values stored in the nodes. |
visit | A depth first search through the internal heirarchy model. |
dfs | Performs a depth first search on the internal hierarchy model |
extendedDfs | Performs a depth first search on the internal hierarchy model. |
function mxGraphHierarchyModel( layout, vertices, roots, parent, ordered, deterministic, tightenToSource, scanRanksFromSinks )
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
graph | the facade describing the graph to be operated on |
vertices | the vertices for this hierarchy |
ordered | whether or not the vertices are already ordered |
deterministic | whether or not this layout should be deterministic on each |
tightenToSource | whether or not to tighten vertices towards the sources |
scanRanksFromSinks | Whether rank assignment is from the sinks or sources. usage |
mxGraphHierarchyModel.prototype.deterministic
Whether or not cells are ordered according to the order in the graph model. Defaults to false since sorting usually produces quadratic performance. Note that since mxGraph returns edges in a deterministic order, it might be that this layout is always deterministic using that JGraph regardless of this flag setting (i.e. leave it false in that case). Default is true.
mxGraphHierarchyModel.prototype.formOrderedHierarchy = function( layout, vertices, parent )
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
layout | Reference to the mxHierarchicalLayout algorithm. |
vertices | Array of mxCells that represent the vertices to be laid out. |
mxGraphHierarchyModel.prototype.createInternalCells = function( layout, vertices, internalVertices )
Creates all edges in the internal model
layout | Reference to the mxHierarchicalLayout algorithm. |
vertices | Array of mxCells that represent the vertices whom are to have an internal representation created. |
internalVertices | The array of mxGraphHierarchyNodes to have their information filled in using the real vertices. |
mxGraphHierarchyModel.prototype.visit = function( visitor, dfsRoots, trackAncestors, seenNodes )
A depth first search through the internal heirarchy model.
visitor | The visitor function pattern to be called for each node. |
trackAncestors | Whether or not the search is to keep track all nodes directly above this one in the search path. |
mxGraphHierarchyModel.prototype.dfs = function( parent, root, connectingEdge, visitor, seen, layer )
Performs a depth first search on the internal hierarchy model
parent | the parent internal node of the current internal node |
root | the current internal node |
connectingEdge | the internal edge connecting the internal node and the parent internal node, if any |
visitor | the visitor pattern to be called for each node |
seen | a set of all nodes seen by this dfs a set of all of the ancestor node of the current node |
layer | the layer on the dfs tree ( not the same as the model ranks ) |
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.
parent | the parent internal node of the current internal node |
root | the current internal node |
connectingEdge | the internal edge connecting the internal node and the parent internal node, if any |
visitor | the visitor pattern to be called for each node |
seen | a set of all nodes seen by this dfs |
ancestors | the parent hash code |
childHash | the new hash code for this node |
layer | the layer on the dfs tree ( not the same as the model ranks ) |
Creates an internal ordered graph model using the vertices passed in.
function mxGraphHierarchyModel( layout, vertices, roots, parent, ordered, deterministic, tightenToSource, scanRanksFromSinks )
Whether the rank assignment is done from the sinks or sources.
mxGraphHierarchyModel.prototype.scanRanksFromSinks
Stores the largest rank number allocated
mxGraphHierarchyModel.prototype.maxRank
Map from graph vertices to internal model nodes.
mxGraphHierarchyModel.prototype.vertexMapper
Map from graph edges to internal model edges
mxGraphHierarchyModel.prototype.edgeMapper
Mapping from rank number to actual rank
mxGraphHierarchyModel.prototype.ranks
Store of roots of this hierarchy model, these are real graph cells, not internal cells
mxGraphHierarchyModel.prototype.roots
The parent cell whose children are being laid out
mxGraphHierarchyModel.prototype.parent
Count of the number of times the ancestor dfs has been used.
mxGraphHierarchyModel.prototype.dfsCount
High value to start source layering scan rank value from.
mxGraphHierarchyModel.prototype.SOURCESCANSTARTRANK
Whether or not cells are ordered according to the order in the graph model.
mxGraphHierarchyModel.prototype.deterministic
Whether or not to tighten the assigned ranks of vertices up towards the source cells.
mxGraphHierarchyModel.prototype.tightenToSource
Creates an internal ordered graph model using the vertices passed in.
mxGraphHierarchyModel.prototype.formOrderedHierarchy = function( layout, vertices, parent )
Creates all edges in the internal model
mxGraphHierarchyModel.prototype.createInternalCells = function( layout, vertices, internalVertices )
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.initialRank = function()
Fixes the layer assignments to the values stored in the nodes.
mxGraphHierarchyModel.prototype.fixRanks = function()
A depth first search through the internal heirarchy model.
mxGraphHierarchyModel.prototype.visit = function( visitor, dfsRoots, trackAncestors, seenNodes )
Performs a depth first search on the internal hierarchy 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 )