Back to Trending
RepositoryJavaScriptVNVietnam
phineas-pta

phineas-pta/comfyui-auto-nodes-layout

apply better nodes layout algorithm to ComfyUI workflow

73stars
8forks
2issues
2views

ComfyUI auto nodes layout

a ComfyUI extension that applies an improved node layout algorithm to ComfyUI workflows, primarily for better visualization

this serves as a working prototype of the proof-of-concept detailed in Comfy-Org/ComfyUI#1547

description

while ComfyUI includes a 1-click auto-arrange feature based on LiteGraph.js’s default arrange() method, which organizes nodes by dependency levels, i find its wire orientation often leads to visual clutter

for better visualization, my goal is to ensure all connections are clearly visible, indicating their direction, flow, and specific node attachments

given my limited understanding, it appears most (if not all) ComfyUI workflows can be classified as directed acyclic graphs; this suggests that more advanced graph drawing algorithms could be applied; specifically, i’m focusing on hierarchical graph drawing, which seems particularly well-suited for directed acyclic graphs.

credit: this approach was inspired by this comment

disclaimer: this reflects a personal preference, and it often produces larger graphs

[!IMPORTANT] it’s recommended to remove ‘ReRoute’ nodes from your ComfyUI workflows prior to applying the layout

Here’s why:

  • Directed acyclic graphs, like ComfyUI workflows, are typically structured with clear start and end nodes. Layout algorithms for such graphs operate by assigning a ‘column’ or ‘rank’ to each node, creating a layered visual hierarchy.
  • ‘ReRoute’ nodes disrupt this column assignment. Their presence can lead to misaligned nodes and a less intuitive, harder-to-read layout.
  • You can re-introduce ‘ReRoute’ nodes after the layout has been applied. This allows you to manage any wires that might be intercepted or partially obscured by other nodes in the newly optimized arrangement.

It’s worth noting that since ComfyUI workflows are inherently oriented from left to right, the concept of ‘depth’ is more accurately described as a ‘column’ or ‘rank’ within this hierarchical context.

how to use

[!WARNING] As per issue #8 changes to graph not visible until Undo + Redo. I struggle to reproduce this bug with my machine, if u have any additional information please share in #8

Installation: via ComfyUI Manager for ease of use, or clone this repository manually using git if you’re developing (no additional requirements needed)

Using:

  1. Finalize your workflow, then remove any Reroute nodes from your graph (you can add them back afterward if needed)
  2. Access the layout options by either:
    • Right-clicking on the canvas, or
    • Navigating to the top menu bar: Extensions > 📍 auto nodes layout
  3. Choose your preferred layout algorithm from the available options
  4. Customize the spacing between columns and nodes by adjusting the settings in ComfyUI settings

implementation details

the principle is to use an external library to compute all nodes position, then retrieve back to LiteGraph.js

requirements: ComfyUI version ≥ 0.12.3

implemented algorithms:

2 options to control layout density:

  • horizontal spacing between columns
  • vertical spacing between nodes in same column

TODO

  • apply layout to only a subset of nodes instead of whole graph
  • webcola layout: experimental, still exploring optimal settings
  • find more layout algorithm, in JS preferably

example

using noisy latent composition example

(the empty black rectangle box is browser viewport)

  • original workflow: Imgur remove groups because nodes gonna be placed very differently

  • LiteGraph.js default auto-arrange: Imgur

  • Dagre.js layout: Imgur

  • ELK.js ‘layered’ layout: Imgur

extra

other possible graph layout in JS (but unsatisfying to me nor suitable for DAG):

Similar Projects

Discover other similar projects and AI models.

RepositoryJavaScript
chanon/comfyui-obvpm

ComfyUI nodes to save time and keep your workflows tidy. Bundle multiple wires into one wire. Create customizable presets nodes.

152
Oct 23, 2026
RepositoryPython
Comfy-Org/ComfyUI

The most powerful and modular diffusion model GUI, api and backend with a graph/nodes interface. The fastest local inference engine in the world.

149.6k
Dec 2, 2026
RepositoryPython
Carasibana/ComfyUI-H3-FaceRefine

Refine and improve the quality of small faces in MiniMax H3 video. Per-frame face tracking, crop, refine with H3, stitch back.

653
Sep 13, 2026
RepositoryPython
Luisacaotica/ComfyUI-MiniMaxH3Mod

🚧 Under construction — no-training RefMod reference adapters for MiniMax H3 (compress reference images/videos into tiny latents, no training needed).

649
Nov 14, 2026
RepositoryJavaScript
ZhiHui6/zhiai_nodes_comfyui

ComfyUI custom nodes featuring prompt generation/expansion, multi-platform translation, AI vision understanding, image processing, and video prompt tools. ComfyUI自定义节点合集,涵盖提示词生成/扩写、多平台翻译、AI视觉理解、图像处理、视频提示词生成等功能。

184
Nov 23, 2026
RepositoryJavaScript
artokun/comfyui-mcp-panel

The local-first sidebar AI agent for ComfyUI — runs on your own Claude OR ChatGPT subscription (no API keys, no extra LLM costs). Drives your live graph: edits, workflows & installs in natural language. The panel UI for comfyui-mcp, the agent-native control plane for ComfyUI.

145
Oct 26, 2026
RepositoryJavaScript
MajoorWaldi/ComfyUI-Majoor-OmniCam

Majoor OmniCam is a camera layout and animation tool for ComfyUI. It lets you prepare camera motion without running image or video generation while editing. You can position cameras, create keyframes, preview motion, and record a simple reference video for compatible video models.

96
Oct 19, 2026
Modelimage-to-video
RuneXX/LTX-2.3-Workflows

Your browser does not support the video tag. The workflows are based on the extracted models from https://huggingface.co/Kijai/LTX2.3comfy The extracted models might run easier on your computer (as separate files). (but you can easily swap out the m...

♥0
0
Aug 28, 2026
RepositoryPython
Enemyx-net/VibeVoice-ComfyUI

A comprehensive ComfyUI integration for Microsoft's VibeVoice text-to-speech model, enabling high-quality single and multi-speaker voice synthesis directly within your ComfyUI workflows.

1.6k
Feb 18, 2026