The Spectrum Dispatch News

technology

TALA, Terrastruct's AutoLayout Algorithm, Now Open-Source

The orthogonal layout engine designed for software architecture diagrams is released under the MPL-2.0 license, bundled with D2 v0.9.0.

TALA, Terrastruct's AutoLayout Algorithm, Now Open-Source

Terrastruct has released TALA (Terrastruct’s AutoLayout Algorithm) as open-source software under the MPL-2.0 license, the same license as D2, the diagramming language it supports.

TALA, Terrastruct’s AutoLayout Algorithm, Now Open-Source

TALA is an autolayout algorithm designed specifically for software architecture diagrams. According to the announcement, it functions as an orthogonal layout engine, meaning it produces diagrams more closely resembling whiteboard sketches rather than directed acyclic graph (DAG)-based layouts that expand in a single direction. The algorithm combines research from multiple graph-drawing papers with original techniques to generate what the developers describe as aesthetic diagrams, considering objectives including symmetry, median distance, flow, and clustering of similar nodes.

The algorithm offers several distinctive features. It allows customization of node positions and sizes, including locking coordinates in place. This capability is designed to support agentic use cases, where AI models can draw effectively in 2D space but may struggle with routing. TALA can handle routing automatically while accepting fixed node positions. The algorithm also supports hybrid layouts, where some nodes have specified coordinates while others are positioned by the layout engine.

However, TALA comes with notable tradeoffs. The algorithm incorporates randomness—it finds optimal layouts by default using three seeds and selecting the highest-scoring result. While the same input and seeds produce identical diagrams, adding a single node could result in a substantially different layout. In contrast, competing algorithms like Dagre and ELK typically preserve existing node positions when new elements are added. Additionally, TALA does not handle DAGs as effectively as alternatives; the developers note preferring Dagre or ELK for long, flowing graphs. Runtime performance scales nonlinearly, and the algorithm can take longer to execute on larger diagrams compared to other layout engines.

TALA is bundled into D2 v0.9.0 and can be tested by specifying the --layout=tala flag during installation. The algorithm is also available through https://play.d2lang.com, which runs entirely client-side. Terrastruct credits Gavin Nishizawa and Júlio César Batista for substantial contributions to the project’s development.

Key facts

  • TALA is released under MPL-2.0 license and bundled with D2 v0.9.0
  • The orthogonal layout engine is designed for software architecture diagrams and matches whiteboard-style layouts
  • The algorithm supports custom node positioning, enabling AI models to specify coordinates while TALA handles routing
  • TALA uses multiple seeds (default of three) to find optimal layouts, which can result in significantly different diagrams when input changes
  • The algorithm has longer runtime performance for larger diagrams compared to Dagre and ELK alternatives

Sources

← All posts