A comprehensive mathematical Kolam pattern generator implementing multiple algorithms based on research papers and traditional mathematical foundations.
kolam/
├── backend/ # Flask API backend
│ ├── app.py # Main application
│ ├── requirements.txt # Python dependencies
│ └── README.md # Backend documentation
├── test-frontend/ # Temporary test frontend (delete after testing)
│ ├── index.html # Test HTML interface
│ └── README.md # Frontend test documentation
├── run_backend.bat # Windows batch file to start backend
└── README.md # This file
The Kolam generator implements multiple algorithms based on research papers:
- Algorithm 1: Hridaya Kolam (Chakraborty & Manna, 2025)
- Algorithm 2: Pulli Kolam (Traditional dot-grid patterns)
- Algorithm 3: Rangoli Kolam (Artistic flowing patterns)
- Algorithm 4: Muggulu Kolam (Telugu geometric designs)
- Algorithm 5: Alpana Kolam (Bengali floral motifs)
- Algorithm 6: Kolam Classification (KolamNetV2 inspired)
- m: Number of dots per arm
- n: Number of arms
- Constraint: gcd(m,n) = 1 (parameters must be coprime)
- Type: Kolam style selection (hridaya, pulli, rangoli, muggulu, alpana)
Source: Chakraborty & Manna (2025) - Algorithm 1
Mathematical Foundation:
- Input: m (number of radial dots), n (number of arms) where gcd(m,n) = 1
- Output: Set of polar coordinates (r, θ) for closed Kolam pattern
Algorithm Steps:
- Initialize angle step: Δθ = 2π/n
- Generate sequence S:
for k = 0 to m-1: if k == 0: a_k = m else: a_k = (k × n) mod m Append a_k to S - Form extended sequence S': Repeat S exactly n times
- Generate coordinates:
for i = 0 to length(S')-1: θ_i = (i mod n) × Δθ r_i = S'[i] Append point (r_i, θ_i) to C - Close the loop: Append initial point C[0] at the end
Source: Traditional dot-grid patterns
Characteristics: Simple geometric connections, grid-based, linear connections
Algorithm:
- Generate dot positions: Create radial dot grid
- Connect consecutive dots: Linear connections within each arm
- Connect arms: Circular connections between outer dots
Source: Artistic flowing patterns
Characteristics: Flower-like artistic connections, flowing curves, organic shapes
Algorithm:
- Generate dot positions: Create radial dot grid
- Create center connections: Connect center dots in flower pattern
- Add outer ring: Connect consecutive dots in each arm
Source: Telugu geometric patterns
Characteristics: Intricate geometric designs, diamond/square patterns, symmetric connections
Algorithm:
- Generate dot positions: Create radial dot grid
- Create geometric patterns: Connect opposite arms in pairs
- Form diamond shapes: Connect dots in symmetric patterns
Source: Bengali floral motifs
Characteristics: Floral, organic patterns, petal-like connections, radial symmetry
Algorithm:
- Generate dot positions: Create radial dot grid
- Create petal connections: Connect center to outer dots
- Form circular pattern: Connect outer dots in circular fashion
Source: Sasithradevi et al. (2024) - KolamNetV2
Classification Rules:
def classify_kolam(m, n):
if m <= 3:
return 'pulli', 0.85
elif m <= 6:
return 'hridaya', 0.90
elif m <= 8:
return 'rangoli', 0.80
else:
return 'muggulu', 0.75Based on the research papers, here are some valid pattern combinations:
- m=4, n=5: Simple 4-dot pattern (Pulli style)
- m=5, n=8: Classic Hridaya Kolam (Heart-shaped)
- m=6, n=7: 6-dot pattern (Rangoli style)
- m=8, n=9: 8-dot pattern (Muggulu style)
- m=10, n=7: Complex 10-dot pattern (Alpana style)
- m=12, n=5: 12-dot pattern with 5 arms
- Multiple Kolam Types: 5 different traditional styles
- Research-Based Algorithms: Based on academic papers
- Pattern Classification: KolamNetV2 inspired classification
- Modular Arithmetic: Algorithm 1 implementation
- Parameter Validation: Coprime constraint checking
- Multiple Connection Styles: Curves, lines
- RESTful API Design: Clean, documented endpoints
- Interactive Test Frontend: Real-time pattern generation
- Mathematical Foundation: Traditional and modern approaches
- Requirement: gcd(m, n) = 1
- Purpose: Ensures proper sequence generation and pattern closure
- Validation:
math.gcd(m, n) == 1
- Generator Sequence S: Length = m
- Extended Sequence S': Length = m × n
- Pattern Closure: S'[0] = S'[m×n] (circular)
- Radial Symmetry: n-fold rotational symmetry
- Scale Invariance: Patterns scale with radius parameter
- Connectivity: Each pattern forms closed loops
| Kolam Type | Best For | Characteristics | Complexity |
|---|---|---|---|
| Hridaya | Traditional patterns | Complex curves, mathematical precision | High |
| Pulli | Simple designs | Grid-based, linear connections | Low |
| Rangoli | Artistic patterns | Flowing curves, organic shapes | Medium |
| Muggulu | Geometric designs | Symmetric patterns, angular lines | Medium |
| Alpana | Floral motifs | Petal-like, radial connections | Medium |