What is a Subgraph?
A subgraph combines multiple nodes into a single node. Besides tidying up the canvas, you can save it as a reusable module (Blueprint) and use it like a new node.
You could pack every node into one, but what makes ComfyUI distinctive is that it lets you split the image generation pipeline into small modules.
Personally, I see it less as a way to tidy things up and more as a feature for building "reusable modules."
Creating a Subgraph
- 1. Select multiple nodes you want to group
- 2. Click
🕸️(Convert Selection to Subgraph) inNode Selection Toolbox
Editing a Subgraph
Enter edit mode by double-clicking the subgraph or clicking the icon on the upper right.
Editing works the same as usual, but any parameter that passes data to or from the outside has to be connected to the subgraph's input/output slots (on the left and right edges).
Parameter Publication Settings
You can expose parameters inside the subgraph as widgets of the subgraph node. That way you can change values without entering edit mode every time.
- 1. Select Subgraph
- 2. Click
Edit Subgraph WidgetsinNode Selection Toolbox - 3. Check the parameters you want to publish
Saving and Reusing Subgraphs
Once you save a subgraph, you can reuse it as your own node.
- 1. Select Subgraph
- 2. Click
📖(Publish Subgraph) inNode Selection Toolbox - 3. Enter name and
Confirm
After saving, you can search for it (double-click the canvas) and add it just like any other node.
It also shows up in the node library in the sidebar, which is where you delete or edit Blueprints.