Create a subgraph

Create a subgraph to encapsulate a set of nodes into a single reusable unit, or start with a blank subgraph and build its contents from scratch.

Convert existing nodes to a subgraph

  1. On the graph canvas, hold Shift and drag to draw a selection box around the nodes you want to include in the subgraph.

  2. Right-click the empty canvas (not on a node) and choose Convert to > Subgraph.

    The selected nodes move into a new subgraph. Any wires that crossed the selection boundary become input or output ports on the subgraph automatically. A subgraph node appears at the center of the selection.

  3. To rename the subgraph, select it, open the Node tab in the Details panel, and click the title box at the top to edit it.

  4. To open the subgraph for editing, double-click the subgraph node, or right-click it and choose Enter subgraph.

    The breadcrumb bar at the top of the editor shows your position in the graph hierarchy. Click a breadcrumb to navigate back to a parent graph.

  5. Inside the subgraph, connect wires to the Subgraph Input node to define its input ports, and connect wires from the Subgraph Output node to define its output ports.

    Any output port you wire from the Subgraph Input node becomes an input port on the subgraph node in the parent graph. Any input port you wire into the Subgraph Output node becomes an output port.

Create a blank subgraph

  1. Click Add node add node icon on the toolbar or press Space.

    The Add node dialog opens.

  2. Expand Blank subgraphs and select Standard subgraph.

    An empty subgraph node is placed on the canvas. The subgraph contains a Subgraph Input node and a Subgraph Output node with no ports yet.

  3. Double-click the subgraph node to enter it, then add nodes and connect wires between them.

  4. To expose values to the parent graph, drag a wire from the Add Input port on the Subgraph Input node to any inner node's input port. Drag a wire from any inner node's output port to the Add Output port on the Subgraph Output node.

    Each connection you create adds a corresponding port to the subgraph node in the parent graph. The new port takes its name from the port you connected.

Explode a subgraph

Exploding a subgraph lifts its contents back into the parent graph and removes the subgraph node.

  1. Right-click the subgraph node and choose Explode subgraph.

    The nodes inside the subgraph are placed on the parent canvas in the same relative position as the original subgraph node. Wires that previously crossed the subgraph boundary are reconnected automatically. The hoisted nodes are selected after the explode completes.

  2. If the subgraph is a For-Each loop, a confirmation dialog appears. Confirm to proceed.

    Exploding a For-Each loop removes the loop. Only one copy of the inner nodes is placed on the canvas. Wires connected to the Items and LoopResults ports on the loop node aren't reconnected. Remove or reconnect them manually.

Tip: To undo an explode, click Undo or press Ctrl+Z (Windows) / Command+Z (macOS).