TALA Is Open-Source
316 points
• 6 days ago
• Article
Link
TALA,即 Terrastruct's AutoLayout Algorithm,现已在 MPL-2.0 许可证下开源。该新型布局引擎专为软件架构图设计,采用正交布局,旨在模仿白板绘图的直观结构,而不是基于 DAG 的算法那种刚性单向流线。通过将成熟的图形绘制研究与自创技术相结合,TALA 在对称性、流向、聚类和中位数距离等方面进行优化,以提升图形的美观与可读性。
该算法具有很强的灵活性,允许用户自定义或锁定节点的位置和大小。这个功能对 agentic 场景特别有用:在这些场景中,AI 模型可能能在二维空间里给出坐标,却难以完成复杂的连线路由工作。 TALA 也支持混合模式,用户可以固定部分元素,由引擎自动处理其余布局,从而在创意控制与计算效率之间取得平衡。
但在将 TALA 纳入工作流时也要权衡利弊。算法带有一定随机性,会使用多个种子来选出得分最佳的布局。虽然在输入一致时结果是可复现的,但对图表进行微小修改(例如新增一个节点)可能会引起视觉结构的大幅重排。此外,TALA 并不适合长而流动的 DAG,对于非常大的图表,其性能随规模呈非线性增长,速度可能比 Dagre 或 ELK 等方案慢。
要开始使用该引擎,开发者只需在 D2 version 0.9.0 中将 layout 标志设为 tala 。想要立即试验的用户可以在基于浏览器的 D2 playground 中体验完全客户端运行的测试环境。此次发布是一次协作成果,Gavin Nishizawa 和 Júlio César Batista 等开发者做出了重要贡献,团队期待社区在 TALA 公开后继续完善和改进它。
TALA, which stands for Terrastruct's AutoLayout Algorithm, is now open-source under the MPL-2.0 license. This novel layout engine is specifically engineered for software architecture diagrams, prioritizing an orthogonal design that mimics the intuitive structure of whiteboard drawings rather than the more rigid, unidirectional flow typical of DAG-based algorithms. By blending established graph-drawing research with original techniques, TALA optimizes for aesthetic clarity through considerations like symmetry, flow, clustering, and median distance.
The algorithm offers unique flexibility, allowing users to customize or lock node positions and sizes. This feature is particularly powerful for agentic use cases, where an AI model might be capable of defining coordinates in 2D space but struggles with the complex, manual task of routing connections. TALA also supports a hybrid approach, where some elements are fixed in place by the user while the engine automatically handles the remaining layout, providing a balance between creative control and computational efficiency.
However, users should be aware of certain trade-offs when integrating TALA into their workflow. The algorithm incorporates a degree of randomness, using multiple seeds to determine the best layout score. While this ensures consistency given identical inputs, small changes to the diagram, such as adding a single node, can lead to a significant reorganization of the visual structure. Additionally, TALA is not optimized for long, flowing DAGs, and for very large diagrams, its performance scales nonlinearly, making it slower than other options like Dagre or ELK.
To start using the new engine, developers can find it bundled into D2 version 0.9.0 by simply specifying the layout flag as tala. For those interested in immediate experimentation, the browser-based D2 playground offers a fully client-side environment to test the algorithm. The release is a collaborative effort, with significant contributions from developers like Gavin Nishizawa and Júlio César Batista, and the team looks forward to seeing how the community will further refine and improve TALA now that it is publicly available.
24 comments • Comments Link
- CSS 布局本质上很难,要做到视觉上直观的效果,需要解决复杂且计算量大的几何问题,在极端情况下这些方法常会失灵。
- TALA 布局引擎在架构图绘制方面贡献显著,以其输出质量和作为开发者工具的实用性广受好评。
- 虽然 TALA 在某些视觉构图上表现出色,但在处理特定方向性流向和纵横比时较为吃力,常比 ELK 或 Dagre 等现有方案生成更复杂或更"方正"的图表。
- 共识是自动布局工具虽有用,但在大规模图表上往往力不从心,许多人因此更倾向于使用交互式编辑器,对自动生成的布局进行手动微调。
- 构建自定义图表工具会让人深刻体会到节点定位、边路由和标签管理等底层复杂性,尤其在处理嵌套结构时更为明显。
- 作为一种声明式且省时的替代手动绘图的方案,D2 正越来越受关注,用户普遍认为学习其语法的成本能很快被生产力提升所抵消。
- 多年来自动图表布局软件进展缓慢,这也让像 TALA 这样的新引擎成为现有有限工具集中的受欢迎但不完美的补充。
- 像 yEd 这样的传统工具在专业环境中仍是精度和可定制性的黄金标准,但昂贵的许可费用常使其难以在更广泛的企业场景中推广。
- 在 Graphviz 和 D2 等声明式图表语言之间进行转换面临巨大的技术挑战,目前尚无标准且无损的桥接方式来在这些迥异格式间转换。
讨论凸显了社区对高效、自动化图表制作的渴望,与在布局复杂视觉信息时所面临的内在难题之间的持续张力。像 TALA 和 D2 这样的工具确实能显著提升技术文档的生产力,但在满足复杂架构图对细微方向性和比例的严格要求时仍常受限,因此用户往往采用自动化与人工微调相结合的混合工作流。社区既对这些引擎背后的工程付出表示赞赏,也认识到真正"完美"的布局工具难以实现;归根结底,人们既重视声明式语法的可及性,也重视那些成熟但昂贵的传统应用所提供的高精度。 • CSS layout remains inherently difficult because achieving visually intuitive results requires solving complex, computationally expensive geometric problems that often break in edge cases.
• The TALA layout engine represents a significant contribution to architecture diagramming, receiving praise for its output quality and its role as a useful tool for developers.
• While TALA excels at certain visual compositions, it struggles with specific directional flows and aspect ratios, often producing more complicated or "square" diagrams than existing alternatives like ELK or Dagre.
• The consensus suggests that while automatic layout tools are helpful, they often fall short for large-scale diagrams, leading some to prefer interactive editors that allow for manual refinement of auto-generated positions.
• Building custom diagramming tools provides a deep appreciation for the underlying complexity involved in node positioning, edge routing, and label management, especially when accounting for nested structures.
• D2 has gained traction as a time-saving, declarative alternative to manual drawing tools, with users finding that the investment to learn the syntax is quickly offset by increased productivity.
• The software landscape for automated graph layout has stagnated for years, making new engines like TALA a welcome, albeit imperfect, addition to the limited set of available tools.
• Legacy tools like yEd remain the gold standard for precision and customizability in professional settings, though prohibitive licensing often excludes them from widespread enterprise adoption.
• The technical challenge of translating between declarative diagramming languages like Graphviz and D2 is significant, as there is currently no standard, lossless way to bridge these disparate formats.
The discourse highlights a persistent tension between the desire for efficient, automated diagramming and the inherent difficulty of laying out complex visual information. While tools like TALA and D2 offer substantial productivity gains for technical documentation, they frequently struggle with the nuanced directional requirements of complex architectural diagrams, leading users to prefer hybrid workflows that combine automation with manual tweaking. There is a clear appreciation for the engineering effort behind these engines, alongside a recognition that the "perfect" layout tool remains elusive. Ultimately, the community values both the accessibility of declarative syntax and the precision found in more mature, albeit expensive, legacy applications.