# Class ParallelLayout

GoJS® Diagramming Components
version 3.0.14
by Northwoods Software®

This is an extension and not part of the main GoJS library. Note that the API for this class may change at any time. If you intend to use an extension in production, you should copy the code to your own source directory. See the Extensions intro page for more information.

#### Hierarchy

- TreeLayout
  - ParallelLayout

A custom go.TreeLayout that can be used for laying out stylized flowcharts. Each layout requires a single 'Split' node and a single 'Merge' node. The 'Split' node should be the root of a tree-like structure if one excludes links to the 'Merge' node. This will position the 'Merge' node to line up with the 'Split' node.

You can set all of the TreeLayout properties that you like, except that for simplicity this code just works for angle === 0 or angle === 90.

If you want to experiment with this extension, try the Parallel Layout sample.

#####
Index

### Constructors

constructor

### Accessors

mergeNode
splitNode

### Methods

findSplitMerge
isConditional
isMerge
isSplit
isSwitch

#####
Inherited Index

### Accessors

Layout.arrangementOrigin
Layout.boundsComputation
Layout.diagram
Layout.group
Layout.isInitial
Layout.isOngoing
Layout.isRealtime
Layout.isRouting
Layout.isValidLayout
Layout.isViewportSized
Layout.network
TreeLayout.alignment
TreeLayout.alternateAlignment
TreeLayout.alternateAngle
TreeLayout.alternateBreadthLimit
TreeLayout.alternateChildPortSpot
TreeLayout.alternateCommentMargin
TreeLayout.alternateCommentSpacing
TreeLayout.alternateCompaction
TreeLayout.alternateComparer
TreeLayout.alternateDefaults
TreeLayout.alternateLayerSpacing
TreeLayout.alternateLayerSpacingParentOverlap
TreeLayout.alternateNodeIndent
TreeLayout.alternateNodeIndentPastParent
TreeLayout.alternateNodeSpacing
TreeLayout.alternatePortSpot
TreeLayout.alternateRowIndent
TreeLayout.alternateRowSpacing
TreeLayout.alternateSetsChildPortSpot
TreeLayout.alternateSetsPortSpot
TreeLayout.alternateSorting
TreeLayout.angle
TreeLayout.arrangement
TreeLayout.arrangementSpacing
TreeLayout.breadthLimit
TreeLayout.childPortSpot
TreeLayout.commentMargin
TreeLayout.commentSpacing
TreeLayout.comments
TreeLayout.compaction
TreeLayout.comparer
TreeLayout.layerSpacing
TreeLayout.layerSpacingParentOverlap
TreeLayout.layerStyle
TreeLayout.nodeIndent
TreeLayout.nodeIndentPastParent
TreeLayout.nodeSpacing
TreeLayout.path
TreeLayout.portSpot
TreeLayout.rootDefaults
TreeLayout.roots
TreeLayout.rowIndent
TreeLayout.rowSpacing
TreeLayout.setsChildPortSpot
TreeLayout.setsPortSpot
TreeLayout.sorting
TreeLayout.treeStyle

### Methods

Layout.cloneProtected
Layout.collectParts
Layout.copy
Layout.getLayoutBounds
Layout.initialOrigin
Layout.invalidateLayout
Layout.updateParts
TreeLayout.addComments
TreeLayout.arrangeTrees
TreeLayout.assignTreeVertexValues
TreeLayout.commitLayers
TreeLayout.commitLayout
TreeLayout.createNetwork
TreeLayout.doLayout
TreeLayout.initializeTreeVertexValues
TreeLayout.layoutComments

## Constructors

### constructor

- new ParallelLayout(init?: Partial<ParallelLayout>): ParallelLayout

- Constructs a ParallelLayout and sets the following properties:

  - isRealtime = false
  - alignment = go.TreeAlignment.CenterChildren
  - compaction = go.TreeCompaction.None
  - alternateAlignment = go.TreeAlignment.CenterChildren
  - alternateCompaction = go.TreeCompaction.None

  #### Parameters

  - ##### `Optional` init: Partial<ParallelLayout>

  #### Returns ParallelLayout

## Accessors

### mergeNode
: Node

- This read-only property returns the node that the tree will converge at.

### splitNode
: Node

- This read-only property returns the node that the tree will extend from.

## Methods

### findSplitMerge

- findSplitMerge(vertexes: Iterable<TreeVertex>): void

- Find a Split vertex and a Merge vertex for this layout. This signals an error if there is not exactly one vertex/Node that isSplit and exactly one vertex/Node that isMerge. This can be overridden; any override must set splitNode and mergeNode.

  #### Parameters

  - ##### vertexes: Iterable<TreeVertex>

  #### Returns void

### isConditional

- isConditional(node: Node): boolean

- Overridable predicate for deciding if a Node is a conditional or 'If' type of Split Node expecting to have two links coming out of the sides.

  #### Parameters

  - ##### node: Node

  #### Returns boolean

### isMerge

- isMerge(node: Node): boolean

- Overridable predicate for deciding if a Node is a Merge node. By default this checks the node's go.Part.category to see if it is 'Merge', 'End', 'EndFor', 'EndWhile', 'EndIf', or 'EndSwitch'.

  #### Parameters

  - ##### node: Node

  #### Returns boolean

### isSplit

- isSplit(node: Node): boolean

- Overridable predicate for deciding if a Node is a Split node. By default this checks the node's go.Part.category to see if it is 'Split', 'Start', 'For', 'While', 'If', or 'Switch'.

  #### Parameters

  - ##### node: Node

  #### Returns boolean

### isSwitch

- isSwitch(node: Node): boolean

- Overridable predicate for deciding if a Node is a 'Switch' type of Split Node expecting to have three links coming out of the bottom/right side.

  #### Parameters

  - ##### node: Node

  #### Returns boolean

Copyright © 1998-2024 by Northwoods Software Corporation.