Class SwimlaneModel

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.

Constructors

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

    Parameters

    • layout: SwimlaneLayout
    • vertices: Cell[]

      the vertices for this hierarchy

    • roots: Cell[]
    • parent: Cell
    • tightenToSource: boolean

      whether or not to tighten vertices towards the sources

    Returns SwimlaneModel

Properties

dfsCount: number = 0

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

Map from graph edges to internal model edges

maxRank: number

Stores the largest rank number allocated

parent: Cell

The parent cell whose children are being laid out

ranks: GraphHierarchyNode[][] = []

Mapping from rank number to actual rank

ranksPerGroup: null | number[] = null

An array of the number of ranks within each swimlane

roots: Cell[]

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

SOURCESCANSTARTRANK: number = 100000000

High value to start source layering scan rank value from.

tightenToSource: boolean = false

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

Map from graph vertices to internal model nodes.

Methods

  • Creates all edges in the internal model

    Parameters

    • layout: SwimlaneLayout

      Reference to the algorithm.

    • vertices: Cell[]

      Array of Cells that represent the vertices whom are to have an internal representation created.

    • internalVertices: GraphHierarchyNode[]

      The array of GraphHierarchyNodes to have their information filled in using the real vertices.

    Returns void

  • Performs a depth first search on the internal hierarchy model

    Parameters

    • parent: null | Cell

      the parent internal node of the current internal node

    • root: GraphHierarchyNode

      the current internal node

    • connectingEdge: null | Cell

      the internal edge connecting the internal node and the parent internal node, if any

    • visitor: Function

      the visitor pattern to be called for each node

    • seen: {
          [key: string]: Cell;
      }

      a set of all nodes seen by this dfs a set of all of the ancestor node of the current node

    • layer: number

      the layer on the dfs tree ( not the same as the model ranks )

    Returns void

  • 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

    • parent: null | GraphHierarchyNode

      the parent internal node of the current internal node

    • root: GraphHierarchyNode

      the current internal node

    • connectingEdge: null | Cell

      the internal edge connecting the internal node and the parent internal node, if any

    • visitor: Function

      the visitor pattern to be called for each node

    • seen: {
          [key: string]: Cell;
      }

      a set of all nodes seen by this dfs

    • ancestors: any

      the parent hash code

    • childHash: string | number

      the new hash code for this node

    • layer: number

      the layer on the dfs tree ( not the same as the model ranks )

    Returns void

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

    Returns void

  • 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

    • parent: null | GraphHierarchyNode

      the parent internal node of the current internal node

    • root: GraphHierarchyNode

      the current internal node

    • connectingEdge: null | GraphHierarchyEdge

      the internal edge connecting the internal node and the parent internal node, if any

    • seen: {
          [key: string]: Cell;
      }

      a set of all nodes seen by this dfs

    • chainCount: number

      the number of edges in the chain of vertices going through the current swimlane

    Returns void

  • A depth first search through the internal heirarchy model.

    Parameters

    • visitor: Function

      The visitor function pattern to be called for each node.

    • dfsRoots: null | GraphHierarchyNode[]
    • trackAncestors: boolean

      Whether or not the search is to keep track all nodes directly above this one in the search path.

    • seenNodes: null | {
          [key: string]: Cell;
      }

    Returns void