Clear Sky Science · en

An algorithm for one-stroke kolam generation using a gating structure

· Back to index

Art at the Doorstep

Every morning across Tamil homes in South India, intricate white patterns bloom on the ground just outside the front door. These designs, called kolams, are drawn in rice flour in a single sitting and then slowly fade away with footsteps, rain, and time. This paper explores how a carefully designed computer algorithm can learn to draw one particular, especially cherished kind of kolam—the kind made from a single unbroken line—so that this living art can be preserved, studied, and shared with future generations without losing sight of its cultural meaning.

Figure 1
Figure 1.

Living Lines of a Daily Ritual

Kolam is far more than decoration. It is a daily ritual, most often practiced by women, that connects home, community, nature, and the divine. Using rice flour on the ground at dawn, the artist traces a looping line around a grid of dots, creating symmetrical patterns that are believed to invite prosperity, protect the household, feed small creatures, and offer a quiet form of meditation. Among the many styles, pulli kolams—built from regular dot grids—are especially valued when they can be drawn in one continuous stroke that begins and ends at the same point. These single-stroke kolams symbolize the endless cycle of life, renewal, and return.

Why One-Stroke Patterns Are So Hard

Designing such a single, unbroken path by hand is surprisingly difficult. At each dot, the artist must choose which way the line bends or passes, while still enclosing every dot, maintaining symmetry, and making sure the line eventually comes home to its starting point. A single misjudged turn can break the flow or leave parts of the grid untouched, forcing the artist to erase and start again. Mathematicians and computer scientists have shown that kolams contain rich patterns related to geometry, symmetry, and network-like paths. Yet, until now, most work either analyzed existing kolams or produced relatively small ones; there was no general, practical way to automatically generate very large, aesthetically pleasing, one-stroke kolams.

Teaching a Computer to Weave a Loop

The authors build on earlier mathematical ideas to give the computer a kind of “road map” around each dot, which they call a gating structure. Imagine every dot surrounded by tiny checkpoints (gates) where the path can either pass straight through or be deflected toward a neighboring dot. By arranging these gates in a grid, the entire kolam becomes a network of possible moves. The algorithm starts with a mostly random setting of which gates are “open” or “closed,” but it steers this randomness using an aesthetic dial that controls how often different local shapes appear around each dot. The computer then traces the path, measures how long the continuous loop is, and repeatedly flips gate settings that make the loop longer and reduce stray “islands” of short, disconnected loops. Over many such flip–test–keep steps, a single long loop that encloses all dots gradually emerges.

Balancing Beauty and Choice

Because each dot is surrounded by a small pattern, or “primitive,” the mix of these local shapes determines how the finished kolam looks—more straight, more curved, more dense, or more open. The authors show how their aesthetic dial can bias the design toward different mixes of these primitives. High dial settings favor patterns with many straight, diamond-like motifs, similar to kambi kolams; medium settings yield more intertwined, looping forms reminiscent of sikku kolams. To assess whether these computer-made kolams truly “feel right,” the researchers asked 45 volunteers, many familiar with the tradition, to rate a selection of generated designs. Responses naturally split into two camps: one group preferred simpler, straighter patterns, while the other favored more balanced, curvy designs. The algorithm could satisfy both tastes by adjusting the dial.

Growing to Monumental Scale

One of the strengths of the new method is its ability to handle very large dot grids that would be almost impossible to plan and remember by hand. The authors generate a one-stroke kolam based on more than 125,000 dots, vastly larger than famous historic temple designs. Although computing time increases with size, the algorithm can still construct these giant loops in a reasonable time on an ordinary desktop computer. The resulting patterns resemble vast woven carpets of line, showing that the basic kolam logic scales smoothly from notebook sketches to monumental artworks.

Figure 2
Figure 2.

Respecting Tradition in a Digital Age

Throughout, the authors emphasize that their goal is not to replace human kolam makers, but to support and document a tradition that faces pressure from urban life and changing social roles. By making the underlying rules explicit and offering a vast digital library of possible designs, the algorithm can act like a modern pattern book for learners, teachers, and artists, while also opening doors to uses in education, graphic design, and even technology. At the same time, the paper acknowledges that a computer cannot reproduce the ritual, bodily, and spiritual dimensions of kolam drawing. Instead, this work treats the algorithm as a partner to tradition—one that preserves the structure and variety of one-stroke kolams, helps reveal their hidden mathematics, and keeps the doorway art of Tamil homes alive in both chalk dust and code.

Citation: Sivakumar, S., Sivakumar, S. An algorithm for one-stroke kolam generation using a gating structure. npj Herit. Sci. 14, 144 (2026). https://doi.org/10.1038/s40494-026-02310-3

Keywords: kolam, algorithmic art, cultural heritage, generative design, mathematical patterns