Next Article in Journal
Modeling PM2.5 Pollution Using a Truncated Positive Student’s-t Distribution: A Case Study in Chile
Previous Article in Journal
Improved YOLO11 for the Asian Citrus Psyllid on Yellow Sticky Traps: A Lightweight Design for Edge Deployment
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Bidirectional Algorithms for Polygon Triangulations and (m + 2)-Angulations via Fuss–Catalan Numbers

1
Faculty of Engineering and Architecture, International Vision University, Major Cede Filipovski No. 1, 1230 Gostivar, North Macedonia
2
Department of Economics and Computer Sciences, University of Novi Pazar, Dimitrija Tucovića 65, 36300 Novi Pazar, Serbia
3
Faculty of Informatics and Computer Science, University Union—Nikola Tesla, 11158 Belgrade, Serbia
4
Department of Scientific and Technical Information and Scientific Publications, Don State Technical University, 344002 Rostov-on-Don, Russia
5
Department of Electrical and Electronics Engineering, Faculty of Engineering and Natural Sciences, Manisa Celal Bayar University, 45140 Manisa, Türkiye
6
Waterloo Data and Artificial Intelligence Institute, University of Waterloo, Waterloo, ON N2L3G1, Canada
7
Faculty of Information Technology, University “VITEZ”, Školska 23, 72270 Travnik, Bosnia and Herzegovina
*
Author to whom correspondence should be addressed.
Mathematics 2025, 13(23), 3837; https://doi.org/10.3390/math13233837
Submission received: 2 November 2025 / Revised: 24 November 2025 / Accepted: 28 November 2025 / Published: 30 November 2025
(This article belongs to the Special Issue Advances in Algorithms, Data Structures, and Computing)

Abstract

Polygon triangulations and their generalizations to m + 2 angulations are fundamental in combinatorics and computational geometry. This paper presents a unified linear-time framework that establishes explicit bijections between m Dyck words, planted m + 1 ary trees, and   m + 2 angulations of convex polygons. We introduce stack-based and tree-based algorithms that enable reversible conversion between symbolic and geometric representations, prove their correctness and optimal complexity, and demonstrate their scalability through extensive experiments. The approach reveals a hierarchical decomposition encoded by Fuss–Catalan numbers, providing a compact and uniform representation for triangulations, quadrangulations, pentangulations, and higher-arity angulations. Experimental comparisons show clear advantages over rotation-based methods in both runtime and memory usage. The framework offers a general combinatorial foundation that supports efficient enumeration, compressed representation, and extensions to higher-dimensional or non-convex settings.

1. Introduction

Triangulations of convex polygons are a central object of study in combinatorics, computational geometry, and algorithm design [1]. The classical result that the number of triangulations of a convex n + 2 -gon is given by the Catalan number C n = 1 n + 1 2 n n establishes a deep connection between polygon dissections, binary trees, and Dyck paths [2]. This rich combinatorial structure has inspired a wide range of applications, from mesh generation and parsing algorithms to enumerative geometry and algebraic topology [3,4]. In recent decades, several algorithmic approaches have been proposed for generating and storing triangulations efficiently [5,6]. Rotation-based generation, Gray-code enumeration, and recursive tree expansion have each provided valuable insights into the structure of the space of triangulations. Nevertheless, there remains an ongoing need for representations that are simultaneously compact, reversible, and amenable to efficient traversal [7].
Despite the rich combinatorial structure of triangulations and their well-known correspondence with Dyck paths and binary trees, existing generation methods for polygon dissections show important limitations when extended to the general m + 2 angulation setting. Rotation-based approaches such as the Hurtado–Noy method rely on successive diagonal flips and require repeated geometric validity checks, which leads to increasing overhead and an amortized quadratic cost per output for larger values of m. Gray-code techniques suffer from similar drawbacks: although they ensure minimal changes between successive triangulations, their extension to higher arity angulations becomes increasingly complex and memory-intensive due to the need to maintain adjacency information across multiple simultaneously evolving subpolygons. More importantly, neither rotation-based nor Gray-code methods provide a compact, reversible, and bidirectional encoding that allows efficient conversion between symbolic objects (ballot sequences or m-Dyck words) and geometric structures. As a consequence, current algorithms scale poorly for large n or large m, lack uniform treatment across different arities, and offer limited support for applications such as parallel enumeration, compressed storage, or structural decomposition. The decomposition Δ(Cₙ), formally defined in Section 3, refers to the canonical subdivision of Catalan objects into ordered substructures. These limitations motivate the need for a unified, linear-time, and memory-light framework precisely the goal of the bidirectional ballot–tree–angulation methods developed in this paper.
In this paper, we adopt a bidirectional perspective based on ballot representations and planted trivalent binary trees (PTBT). By exploiting the natural equivalence between triangulations, binary trees, and Dyck paths, we develop linear-time algorithms that convert between symbolic and geometric representations. Our approach is built on a decomposition of Catalan numbers, Δ C n , that reveals a hierarchical structure within the set of triangulations and allows for systematic generation [1].
Beyond the classical Catalan case, we introduce a generalization to Fuss–Catalan numbers,
C n m = 1 m n + 1 m + 1 n n ,
which enumerate m + 1 -ary trees, m-Dyck paths, and m + 2 -angulations of convex polygons with m n + 2 vertices. This extension enables us to explore quadrangulations m = 2 , pentangulations m = 3 , and higher-order polygonal subdivisions within a unified algorithmic framework [3,8,9]. Higher-order (m + 2)-angulations (for example quadrangulations and pentangulations) arise naturally in mesh generation, data compression, cluster algebras, and higher-dimensional associahedra. These generalized structures support richer combinatorial decompositions than triangulations and enable more flexible modeling in computational geometry and algebraic combinatorics. This work provides a unified and reversible framework for the generation and representation of m + 2 angulations, revealing the structural role of Fuss–Catalan numbers. The main contributions are:
  • Unified Fuss–Catalan Decomposition: We formalize a hierarchical decomposition of Catalan and Fuss–Catalan structures, establishing a common foundation for triangulations, quadrangulations, pentangulations, and general m + 2 angulations.
  • Bidirectional Linear-Time Algorithms: We design mutually inverse stack-based and tree-based algorithms that convert m-Dyck words to angulations and back in strict linear time and space.
  • Correctness and Optimality Proofs: We prove soundness, completeness, bijection, and optimal O(n) bounds for all algorithms, supported by structural lemmas on stack nesting and dual-tree uniqueness.
  • Experimental Validation: Through extensive experiments, we show that the proposed methods outperform classical rotation-based algorithms, especially for higher-arity angulations, in both speed and memory footprint.
  • Generalizable Framework: The methods provide a compact, reversible, and scalable representation that supports enumeration, compressed storage, and future extensions to non-convex or higher-dimensional polygonal decompositions.
This unified treatment highlights the versatility of ballot representations in combinatorial generation and provides a foundation for future extensions to non-convex polygons, three-dimensional decompositions, and combinatorial optimization problems.

2. Related Works

The study of polygon triangulations dates back to Euler and Cayley and has become a classical topic in enumerative combinatorics [10]. The well-known correspondence between triangulations of an n + 2 gon, binary rooted trees, and Dyck paths was formalized by Catalan in the 19th century and has since served as a cornerstone for combinatorial theory [11]. This connection underpins many modern applications, including syntax tree parsing in computer science, RNA secondary structure prediction, and the study of associahedra in algebraic combinatorics [12]. On the algorithmic side, triangulation generation has been investigated from several perspectives. Early approaches relied on brute-force enumeration with geometric feasibility checks, leading to O C n   ·   n 2 complexity. Later, Hurtado and Noy [13] proposed a rotation-based generation method that produces each triangulation exactly once and guarantees O n amortized time per output. Other works have explored Gray-code orderings of triangulations [14], in which successive triangulations differ by a single edge flip, enabling efficient traversal of the flip graph. The representation of triangulations through binary trees and parenthesis words has been exploited in multiple domains. Barcucci et al. [15] studied bijections between Dyck words and tree structures, while Stanley [16] provided a thorough treatment of Catalan structures, including their lattice properties. These symbolic encodings have the advantage of compactness and facilitate algorithmic manipulation, such as generating functions and recursive enumeration [17].
A particularly relevant contribution is the recent work by Saračević and Selimi [1], which proposed a direct algorithm for convex polygon triangulation based on planted trivalent binary trees and the ballot problem. Their method established a bidirectional mapping between ballot sequences and triangulations, achieving linear-time complexity and reduced memory footprint compared with earlier enumeration techniques. Our current work builds on this foundation, extending the approach to the more general Fuss–Catalan setting and providing correctness proofs, complexity analysis, and experimental evaluation across multiple values of m . The generalization to Fuss–Catalan numbers has also been studied independently by several authors. Fusy [18] and Chapoton [19] analyzed m-angulations and their relationship to m-associahedra, providing combinatorial and geometric characterizations. More recently, efficient generation algorithms for m + 2 angulations have been developed based on recursive decomposition and local closure operations [20,21]. These methods are relevant to applications in mesh generation and cluster algebras, where higher-order polygon partitions play a key role. Despite these advances, there is still a need for bidirectional and memory-efficient approaches that allow reversible mapping between symbolic and geometric representations. Our work contributes to this line of research by presenting a unified framework based on ballot representations and extending it naturally to the Fuss–Catalan setting. In doing so, we provide both theoretical guarantees and practical algorithms suitable for large-scale enumeration.

3. Theoretical Foundations

This subsection presents the theoretical foundations required for the unified ballot–tree–angulation framework developed in this paper. We introduce the combinatorial structures, notations, and classical correspondences that underlie the bijections and algorithms described later.
Definition 1 ((m + 2)-Angulation). 
Let m 1 and n 1 . An m + 2 -angulation of a convex polygon with
N = m n + 2
vertices labeled 1 , 2 , , N in clockwise order. A set of diagonals A forms an m + 2 angulation of a convex N -gon if:
  • The diagonals are pairwise non-crossing.
  • The diagonals partition the polygon into exactly n interior faces, each with exactly m + 2 edges.
  • Exactly m n 1 diagonals are inserted.
  • The boundary edge (1, 2) is designated as the root edge.
We denote the family of all such angulations by A m n .   Angulations generalize triangulations m = 1 , quadrangulations m = 2 , pentangulations m = 3 and so on [22,23].
Definition 2 (m-Dyck Word). 
The m-Dyck word of semilength n is a word
W = w 1 w 2 w m + 1 n , w i U , D ,
satisfying the following conditions:
  • Total balance:
    # U = m n ,       # D = n .
  • Prefix constraint: for every prefix W 1 k
    # U k m # D k ,
ensuring that the associated path never goes below height zero.
Interpreting U = +1 and D = −m, the word encodes a lattice path from  0 , 0  to m + 1 n ,   0 that never becomes negative. The set of all such sequences is denoted by D m n [24].
Definition 3 (Planted (m + 1)-Ary Tree). 
A planted (m + 1)-ary tree with n internal nodes is a rooted ordered tree such that:
  • Every internal node has exactly m+1 ordered children;
  • Leaves have no children;
  • The root node is distinguished and has no parent.
Such trees contain n internal nodes, m n + 1 leaves, and m + 1 n edges.
We denote this class by T m n .
The classes A m n , D m n and T m n all have size equal to the Fuss–Catalan number C n m [25,26].
They count:
  • m + 2 angulations of an m n + 2 -gon,
  • planted m + 1 ary trees with n internal nodes,
  • m Dyck words of semilength n.
The recurrence
C 0 m = 1 , C n + 1 m = i 1 + + i m + 1 = n i k 0 C i 1 m C i m + 1 m , n 0 .
reflects the m + 1 ordered subtrees attached to each internal node.
The generating function F x = n 0 C n m x n satisfies F x = 1 + x F x m + 1 capturing the recursive tree structure.
Definition 4 (Mapping Conventions). 
To ensure consistency across all bijective mappings and algorithms, we adopt the following conventions:
  • Root and orientation:
    The polygon is rooted at boundary edge 1 , 2 .
    Vertices are labeled clockwise.
  • Traversal Conventions:
    The dual of an m + 2 angulation is a planted m + 1 ary tree.
    Preorder traversal outputs U when entering an internal node and D when finishing it.
  • Stack discipline:
    The stack contains the left endpoints of all currently open faces.
    Each U-step opens a new face.
    Each D-step closes exactly one face.
    These conventions guarantee that the bijections D m n T m n A m n are deterministic, structurally consistent, and mutually inverse [27,28,29,30].

4. Unified Algorithms and Fuss–Catalan Generalization

This section presents a unified algorithmic framework connecting three fundamental combinatorial structures enumerated by the Fuss–Catalan numbers: D m n ,   T m + 1 n ,   A m + 2 m n + 2 .
Here D m n is the set of m-Dyck words of semilength n, T m + 1 n the set of planted (m + 1)-ary trees with n internal nodes, and A m + 2 m n + 2 the set of m + 2 -angulations of polygon with m n + 2 vertices. Detailed pseudocode and implementation notes are provided in Appendix A.

4.1. Ballot-to-Angulation Algorithm (Generalized Algorithm 1)

The forward direction maps an m-Dyck word to an m + 2 -angulation by scanning the word from left to right and maintaining a stack of incomplete faces. Each U-step opens a new face and each D-step completes exactly one face. The stack enforces a strict nesting structure that guarantees the planarity and non-crossing nature of the resulting diagonals.
Let W   = w 1 w 2 w m + 1 n D m n   be an m-Dyck word.
Algorithm 1. From ballot notation to (m + 2)-angulation
  • Input:  m Dyck word W .
  • Output: A set of diagonals forming the corresponding m + 2 angulation.
    • 1: Initialization:
      Create a convex polygon with N   =   m n   +   2 vertices labeled 1 to N.
      Set current_vertex = 1.
      Initialize an empty stack S.
      Set all visited[v] ← false.
    • 2: Main Loop:
      For i   =   1 to m + 1 n do
       ● 
      (U-step) If   w i = U :
       ○ 
      push (current_vertex, m) onto S;
       ○ 
      advance current_vertex ← current_vertex + 1 (apply wrap-around if needed).
       ● 
      (D-step) If w i = D :
       ○ 
      pop the top element (v,k) from stack S;
       ○ 
      connect vertex v to the current_vertex to form part of a new m + 2 gon;
       ○ 
      decrease the parent’s remaining child count;
       ○ 
      if the parent’s count reaches zero, pop again (repeat until no pending closings);
       ○ 
      advance current_vertex ← current_vertex + 1.
    • 3: Output: Return the set of diagonals inserted; this uniquely defines the m + 2 -angulation corresponding to W.
Correctness
  • Prefix Condition: The m Dyck property ensures that at any point, the stack contains at least m elements before a D is processed.
  • The LIFO stack discipline guarantees that all diagonals are properly nested and therefore non-crossing.
  • Termination: After processing all symbols, exactly m n 1 diagonals have been inserted, yielding a valid m + 2 angulation.
The full pseudocode for Algorithm 1 is provided in Appendix A.1. Examples of quadrangulations and pentangulations are shown in Appendix B.

4.2. Angulation-to-Ballot Algorithm (Generalized Algorithm 2)

The inverse mapping reconstructs the m-Dyck word from the m + 2 -angulation by traversing the dual tree of the angulation. Rooting the decomposition at boundary edge 1 , 2 gives a planted m + 1 ary tree. A preorder traversal of this tree yields the corresponding m-Dyck word.
Algorithm 2. From m + 2 angulation to m Dyck ballot notation
  • Input: A valid m + 2 angulation A of a convex polygon with m n + 2 vertices.
  • Output: An m Dyck word W of length m + 1 n .
  • 1: Construct the dual tree T, rooted at the face adjacent to edge (1, 2).
  • 2: Perform a clockwise preorder traversal of T:
    • 2.1: output U when entering a face
    • 2.2: output D when finishing that face.
  • 3: Return W.
Correctness
  • The dual graph of the angulation is a tree because the diagonals are non-crossing.
  • The clockwise order of children gives a unique embedding, ensuring the output word is uniquely determined.
  • The resulting word satisfies the m-Dyck prefix condition by construction.
The complete pseudocode of the inverse mapping (Algorithm 2) is provided in Appendix A.2.

4.3. Tree-Based Enumeration of (m + 2)-Angulations (Generalized Algorithm 3)

Beyond conversion between representations, all m + 2 -angulations may be generated directly by recursively constructing the underlying planted m + 1 -ary tree.
Algorithm 3. Generation of all m + 2 angulations via backtracking on m + 1 ary tree
  • Input: Parameters m , n defining polygon size v = m n + 2 .
  • Output: All triangulations A m + 2 m n + 2 .
     1. 
    If the current tree has n internal nodes, output the corresponding angulation.
     2. 
    Otherwise, choose all possible placements of m non-crossing diagonals forming a new m + 2 gon.
     3. 
    Recursively extend each partial tree.
Additional implementation details and recursive pseudocode for Algorithm 3 can be found in Appendix A.3.

4.4. Correctness of the Unified Framework

We establish the correctness of the generalized algorithms by showing soundness (every produced object is a valid m + 2 angulation or m-Dyck word) and completeness (every such object can be obtained).
Theorem 1 (Soundness). 
Algorithm 1 transforms any m-Dyck word of semilength n into a valid m + 2 -angulation of a convex polygon with m n + 2 vertices.
Proof. 
Let W   = w 1 w 2 w m + 1 n be an m-Dyck word. It contains exactly mn U-steps and n D-steps and satisfies the prefix condition # U k     m · # D k . Algorithm 1 processes W from left to right and maintains a stack S of pairs v ,   k , where v is the leftmost boundary vertex of an incomplete internal face. When reading U, the algorithm pushes c u r r e n t _ v e r t e x ,   m to represent opening a new m + 2 gon. When reading D, it pops the top pair and inserts a diagonal closing exactly one pending m + 2 gon. The prefix condition ensures the stack is never empty during a D-step, so the operations are well-defined.
The diagonals drawn never intersect because faces are opened and closed in a nested last-in–first-out structure. A diagonal created during a D-step lies inside its ancestor regions, guaranteeing noncrossing behavior. Each D-step closes exactly one internal face; since there are n D-steps, the algorithm produces exactly n internal m + 2 gons. Thus Algorithm 1 outputs a valid m + 2 angulation. □
Theorem 2 (Completeness). 
Every m + 2 angulation of a convex m n + 2 gon can be encoded by a unique m Dyck word.
Proof. 
Let A be any m + 2 -angulation of a convex polygon. Because its diagonals are noncrossing, the dual graph of A is a tree. Rooting it at the face incident to boundary edge 1 , 2 yields a planted m + 1 ary tree T with n internal nodes. Algorithm 2 performs a preorder traversal of T, outputting U upon entering an internal node and D after all its children have been processed. Since T has n internal nodes, this yields mn U-steps and n D-steps, producing a word of length m + 1 n .
The preorder traversal enforces the m-Dyck prefix condition because a node cannot close before all of its descendants have been opened. Thus the resulting word is an m-Dyck word. Preorder traversal of a rooted ordered tree is unique, so no two angulations produce the same m-Dyck word. Therefore every m + 2 angulation is encoded by exactly one m-Dyck word via Algorithm 2.
The correctness of Algorithms 1–3 follows from three structural results. □
Lemma 1 (Stack Nesting Implies Noncrossing Diagonals). 
During Algorithm 1, the diagonals inserted upon processing each D-step do not intersect in their interior. In particular, the stack order ensures that every diagonal connects a vertex to the rightmost unfinished ancestor face, preserving a planar embedding and producing a valid (m + 2)-angulation.
Proof. 
Each U-step pushes a new pair v , k onto the stack representing a new incomplete m + 2 -gon whose left endpoint is v . The stack always stores these endpoints in increasing clockwise order (Algorithm Invariant A1). When a D-step is encountered, the algorithm closes the most recently opened face, which corresponds to the top of the stack. Let this face have left endpoint v, and let u be the current vertex.
Because the stack stores left endpoints in strictly increasing clockwise order, any face opened later must have a left endpoint lying clockwise between v and u. Closing a deeper face always produces a diagonal whose endpoints lie strictly inside the region bounded by its ancestor faces. Consequently, diagonals are always nested and never overlap with diagonals created earlier.
Since the closing order is exactly the reverse of the opening order (LIFO), the resulting diagonals respect the parent–child relationships in the derived tree, and no two diagonals cross. □
Lemma 2 (Uniqueness of the Reconstruction Tree). 
Given a valid (m + 2)-angulation A of an (mn + 2)-gon, Algorithm 2 constructs a unique planted (m + 1)-ary tree T, independent of traversal ambiguities. In particular, the clockwise face-first traversal yields a deterministic tree whose children are ordered.
Proof. 
The angulation is rooted at boundary edge 1 , 2 , which determines the root face. Every interior face shares exactly one diagonal or boundary edge with its parent during the recursive traversal of the dual graph of the angulation. Because the polygon is convex and all diagonals are noncrossing (Lemma 1), the dual graph is a tree. A clockwise traversal of this dual tree visits each face exactly once and assigns a unique parent.
For any interior vertex v, the diagonals incident to v appear in strictly increasing clockwise order by geometric arrangement. Sorting these edges by clockwise angle produces a unique sequence of child faces. This ensures that the planted (m + 1)-ary tree produced by Algorithm 2 has a unique parent mapping and uniquely ordered children at every node.
Hence, the reconstruction tree does not depend on arbitrary tie-breaking or traversal choices. □
Theorem 3 (Bijection). 
Algorithms 1 and Algorithm 2 define mutually inverse bijections between the following three classes of objects:
D m n T m n A m n
where D m n is the set of m-Dyck words of semilength n, T m n the set of planted (m + 1)-ary trees with n internal nodes, and A m n the set of (m + 2)-angulations of an (mn + 2)-gon.
Consequently, the number of objects of size n in each class equals C n m .
Proof. 
We first show that Algorithm 1 constitutes a well-defined mapping from D m n to A m n . A valid m-Dyck word has mn U-steps and n D-steps and satisfies the prefix condition # U k m # D k . Each U-step increases the number of open faces, while each D-step closes exactly one. Because the total number of openings and closings matches precisely, Algorithm 1 constructs exactly n interior faces, each of which is an m + 2 gon, which is the correct number of faces in an m + 2 angulation of a polygon with m n + 2 vertices. By Lemma 1, the diagonals added during these closings never intersect, ensuring that the final polygonal subdivision is a valid m + 2 angulation.
Next, Algorithm 2 maps a given angulation in A m n to a planted (m + 1)-ary tree by a clockwise traversal of the dual tree. Lemma 2 ensures that the resulting tree is uniquely determined.
Finally, the classical correspondence between planted (m + 1)-ary trees and m-Dyck words (via preorder traversal with U-steps for internal nodes and D-steps for returning from subtrees) is well known to be bijective. Algorithm 2 exactly implements this traversal on the tree extracted from the angulation.
It remains to show that the two algorithms are inverses. Applying Algorithm 1 to a Dyck word constructs an angulation whose dual tree is precisely the planted (m + 1)-ary tree encoded by the input word; Algorithm 2 therefore reverses the construction. Conversely, applying Algorithm 2 to an angulation yields the unique tree that Algorithm 1 would generate if given the corresponding Dyck word. Each diagonal created in Algorithm 1 corresponds to a unique D-step in the traversal of Algorithm 2, and the wrap-around rule ensures that vertex indices match modulo N.
Thus, each mapping is both injective and surjective, completing the bijection. □

4.5. Complexity Analysis

We now present a concise and rigorous analysis of the computational complexity of the proposed algorithms. Let N = m n + 2 . All algorithms described in this section are optimal in both time and space.
Theorem 4 (Time and Space Complexity of Algorithm 1). 
Algorithm 1 converts an m-Dyck word of length (m + 1)n into a (m + 2)-angulation of an (mn + 2)-gon in O N time and O N  space.
Proof. 
The algorithm performs a single left-to-right scan of the Dyck word. Each symbol is processed exactly once:
  • A U-step pushes one record onto the stack, requiring constant time.
  • A D-step pops exactly one record, again in constant time, and adds a single diagonal.
Since the word contains m + 1 n = Θ ( N ) symbols, the total time is linear in N.
The stack stores at most m n = Θ N pending faces, and the output set contains m n 1 = Θ N diagonals. No additional auxiliary structures grow beyond linear size. Therefore, total space usage is also linear in N . Thus Algorithm 1 runs in O N time and uses O N space. □
Theorem 5 (Time and Space Complexity of Algorithm 2). 
Algorithm 2 transforms a (m + 2)-angulation into an m-Dyck word in O(N) time and O(N) space.
Proof. 
The traversal of the dual tree visits each face exactly once. For each visit:
  • Entering a face outputs one U,
  • Finishing a face outputs one D.
Since there are n internal faces, the total number of operations i s   m + 1 n = Θ N . Extracting and sorting adjacency lists of each vertex is linear because each diagonal and edge is processed once, and sorting within each vertex is bounded by a constant factor since each vertex participates in at most m + 1 incidence relations.
Thus Algorithm 2 also operates in linear time and linear space. □
Theorem 6 (Time and Space Complexity of Algorithm 3). 
Algorithm 3 generates all (m + 2)-angulations of an (mn + 2)-gon with O(N) space usage and O(1) amortized additional time per generated angulation, excluding the unavoidable O(N) cost of outputting the angulation itself.
Proof. 
Algorithm 3 constructs angulations by recursively building the corresponding planted m + 1 ary tree. At each level of recursion, the algorithm performs the following operations:
  • Local branching: For a partially constructed tree, the algorithm selects all admissible placements of m non-crossing diagonals that extend the current partial angulation. The number of such choices depends only on the tree node being expanded and does not depend on N = mn + 2. Thus each branching operation requires constant time.
  • Recursive extension: Each recursive call appends one internal node to the underlying tree, and there are exactly n internal nodes. Therefore, along any recursion path, at most n = O(N) calls are made, but each call performs only constant work aside from recursion management.
  • Amortized cost: Because every internal node of every tree is created exactly once, the total number of recursive calls is proportional to the number of generated angulations. The overhead between two successive outputs is therefore O(1), establishing the amortized bound.
  • Space usage: The recursion stack and the partial tree representation together store at most n = O(N) nodes. No additional data structures grow beyond linear size because each partial configuration corresponds to a prefix of the tree.
  • Output cost: Converting a fully constructed tree to its corresponding (m + 2)-angulation requires writing out mn − 1 = Θ(N) diagonals. This output cost is inherent and cannot be reduced.
Combining these observations, Algorithm 3 requires O N space and O 1 amortized time per angulation, in addition to the O N   unavoidable cost of writing the output structure. □

4.6. Comparison with Rotation-Based Methods

A classical approach to generating polygon triangulations and angulations is based on rotation (flip) operations in the flip graph, as exemplified by the Hurtado–Noy family of algorithms. In such methods, each new triangulation or angulation is obtained from the previous one by flipping one or more diagonals, while maintaining global validity constraints. This strategy has several consequences:
  • Each new output typically requires repeated geometric validity checks;
  • Adjacency information and local neighborhood structure must be stored and updated;
  • The amortized cost per generated angulation becomes superlinear once the method is extended from triangulations to general m + 2 angulations.
For m > 1, each flip in the Hurtado–Noy method must update multiple adjacency lists and revalidate up to m incident subpolygons. The number of affected configurations grows linearly in n for each step, resulting in an overall quadratic Θ N 2 average cost. This explains why the rotation-based approach becomes increasingly inefficient for general (m + 2)-angulations.
In contrast, the ballot–tree–angulation framework developed in this paper operates purely on combinatorial encodings ( m Dyck words and planted m + 1 ary trees). The forward and inverse transformations process each symbol or face exactly once, require only a single stack or tree structure, and avoid geometric validation completely. As a result, both directions of the correspondence run in linear time and linear space, with significantly smaller constant factors and no asymptotic dependence on m beyond the input size N = m n + 2 .
From this comparison, we see that the ballot–tree–angulation approach achieves true linear-time performance for both directions of the bijection and maintains linear space in all cases. Rotation-based methods remain valuable for studying the flip graph and related geometric structures, but for large-scale enumeration and conversion between symbolic and geometric representations, the combinatorial framework presented here is asymptotically more efficient and algorithmically simpler. Table 1 summarizes the asymptotic behavior and qualitative features of our algorithms compared with rotation-based methods.

4.7. Experimental Evaluation

To validate the practical efficiency of the proposed algorithms and to support the theoretical linear-time guarantees established in this section, we conducted a comprehensive experimental study. The primary goals were:
  • To measure the actual runtime of Algorithms 1 and 2 for a range of values of m and n;
  • To verify that memory usage grows linearly with the size of the polygon;
  • To empirically confirm that the bidirectional ballot–tree–angulation framework scales uniformly across different arities.
All experiments were performed on a dedicated machine with the following specifications:
  • CPU: Intel Core i7-11800H (8 cores, 2.30 GHz, 4.60 GHz turbo)
  • RAM: 32 GB DDR4
  • Operating System: Ubuntu 22.04 LTS (64-bit)
  • Implementation Language: Python 3.11 with optimized recursion disabled;
  • Critical loops implemented with CPython built-ins to avoid overhead.
  • Random Generation: Dyck words and angulations generated using standard uniform algorithms to ensure unbiased test cases.
To minimize measurement noise, each experiment was repeated 30 times, and results were reported as the mean runtime.
In Figure 1 x-axis shows the input size and the y-axis shows the average runtime in milliseconds. This graph compares the empirical runtime behavior of the three proposed algorithms (Algorithm 1–3) against the classical Hurtado–Noy rotation-based method for increasing values of n. The results clearly illustrate the theoretical differences between the approaches:
  • Algorithms 1 and 2 (Ballot ↔ Angulation Conversions): Both curves exhibit an almost perfect linear growth in n, confirming the proven O(N) time complexity. Their slopes are shallow, indicating small constant factors. Among these, Algorithm 1 is the fastest due to its strictly iterative structure and limited overhead (simple push/pop operations). Algorithm 2 is only slightly slower because constructing and traversing the dual tree incurs minor additional overhead, but it still remains strictly linear.
  • Algorithm 3 (Tree-Based Enumeration): The runtime also grows linearly with n, as expected for its amortized O(1) per-output cost (excluding output writing). Its slope is steeper than Algorithms 1 and 2, reflecting the cost of recursive branching and backtracking within the (m + 1)-ary tree structure. Nevertheless, it remains fully linear and far below the Hurtado–Noy growth rate.
  • Hurtado–Noy rotation method: This curve departs from linearity and displays clear superlinear behavior. Even at moderate values of n, the runtime grows noticeably faster than any of the proposed linear-time algorithms. This aligns with theoretical expectations: rotation-based generation requires repeated structural validations and adjacency updates, resulting in average-case Θ(N2) behavior for general (m + 2)−angulations.
The figure empirically validates the key performance claim of the paper: all three ballot–tree–angulation algorithms run in true linear time with small constants, while the Hurtado–Noy method is substantially slower and scales poorly as n increases. This provides strong practical support for the theoretical optimality of the proposed framework.
In addition to runtime analysis, we also compare the memory usage of Algorithms 1–3 against the Hurtado–Noy method. Figure 2 shows that our linear-stack and queue-based algorithms require consistently lower or comparable memory compared to the classical rotation-based method, confirming the theoretical expectations discussed in this section.

5. Future Directions

Building on the unified ballot–tree–angulation framework developed in this study, several promising research directions remain open for further investigation.
Many applications in combinatorics and statistical physics require sampling triangulations or m + 2 -angulations according to non-uniform distributions (e.g., Boltzmann samplers, energy-based weights, or degree-weighted trees). Adapting the bidirectional algorithms to incorporate weights, random generation, or rejection-free sampling would significantly broaden their applicability. A natural extension is to consider analogous bijections for:
  • Polyhedral dissections in 3D;
  • Higher-dimensional Catalan objects;
  • m-ary hypertrees and generalized polytopal subdivisions.
Developing a linear-time bijective framework for such objects remains a challenging open problem.
Because each step of our algorithms is local and involves only stack or tree operations, the approach is well-suited for parallelism. Future work may explore:
  • Parallel traversal of trees;
  • GPU-based generation of large families of angulations;
  • SIMD operations for vectorized ballot-sequence handling.
This could yield substantial performance gains for large datasets. Given the exponential growth of Fuss–Catalan families, practical enumeration for large n and large m remains difficult. Future efforts may focus on:
  • Compressed encodings of trees and Dyck paths;
  • Succinct representations of angulations;
  • Streaming algorithms that generate objects without storing them.
Such improvements would enable real-time or on-demand enumeration in memory-constrained environments. Our representation provides a robust combinatorial backbone that may be exploited in:
  • Mesh generation and geometric modeling;
  • Polygon partitioning for computational geometry;
  • Dynamic triangulation updates;
  • Computer graphics and animation.
Investigating how the bijective framework can accelerate or simplify geometric algorithms offers a valuable future research avenue. Altogether, these directions highlight the broader potential of the ballot–tree–angulation framework and suggest that many combinatorial and geometric structures may be approachable through analogous linear-time bijective techniques.

6. Conclusions

This paper extends the classical Catalan correspondence between Dyck paths, binary trees, and triangulations to the full Fuss–Catalan family of m + 2 angulations. By combining stack-based and tree-based constructions, we obtain linear-time and linear-space algorithms that provide explicit bijections between m Dyck words, planted m + 1 ary trees, and polygon angulations. The framework is supported by rigorous correctness proofs and experimentally validated performance gains over rotation-based methods. The results highlight the universality and efficiency of symbolic representations for geometric structures, enabling uniform handling of triangulations, quadrangulations, pentangulations, and higher-arity decompositions. Beyond offering compact and reversible encodings, the approach opens avenues for future work on non-convex polygons, higher-dimensional polytopal subdivisions, parallel generation, and compressed enumeration of large combinatorial families.

Author Contributions

Conceptualization, A.S. and M.S.; methodology, A.S.; software, A.S.; validation, A.S., O.A. and M.Z.; formal analysis, A.S.; investigation, A.S.; resources, L.S.; data curation, A.S.; writing—original draft preparation, A.S.; visualization, L.S.; supervision, L.S. All authors have read and agreed to the published version of the manuscript.

Funding

This research received no external funding.

Data Availability Statement

The raw data supporting the conclusions of this article will be made available by the authors on request.

Conflicts of Interest

The authors declare no conflicts of interest.

Appendix A

Appendix A.1. Detailed Pseudocode of Algorithm 1

Algorithm 1 converts an m Dyck word interpreted as a ballot sequence into its corresponding ( m + 2 ) angulation of a convex polygon with m n + 2 vertices. The conversion leverages the structural correspondence between up/down steps in the word and the internal nodes/leaves of a planted m + 1 ary tree, using a stack to dynamically assign vertex labels and insert diagonals that define each m + 2 -gon.
At any time, the stack S stores all currently open (m + 2)-gons in increasing clockwise order of their left endpoints. Each U-step opens a new face, and each D-step closes exactly one, ensuring noncrossing diagonals.
Under this invariant:
  • A U-step adds a new pending face;
  • A D-step closes the most recently opened face;
  • Certex indices advance cyclically around the polygon boundary.
This yields a simple and implementable linear-time algorithm for constructing the angulation determined by W.
Mathematics 13 03837 i001

Appendix A.2. Detailed Pseudocode of Algorithm 2

Algorithm 2 gives a complete m + 2 angulation, this algorithm reconstructs the associated planted m + 1 ary tree and then traverses it in preorder to produce the corresponding m-Dyck word in ballot notation. Each internal node contributes one up-step before its children and one down-step after, faithfully encoding the hierarchical decomposition of the polygon. At all times during the face-first traversal of the dual tree, the number of U symbols emitted equals the number of entered but uncompleted faces. The path constructed never dips below zero, ensuring a valid m-Dyck prefix condition.
Mathematics 13 03837 i002

Appendix A.3. Detailed Pseudocode of Algorithm 3

Algorithm 3 is a recursive backtracking procedure that systematically enumerates all valid m + 2 angulations by constructing planted m + 1 ary trees level by level. At each step, it selects admissible placements of m non-crossing diagonals that extend the current partial angulation, ensuring combinatorial completeness and avoiding duplicates through canonical tree growth. Algorithm 2 gives a complete m + 2 angulation, this algorithm reconstructs the associated planted m + 1 ary tree and then traverses it in preorder to produce the corresponding m Dyck word in ballot notation. Each internal node contributes one up-step before its children and one down-step after, faithfully encoding the hierarchical decomposition of the polygon.
Mathematics 13 03837 i003

Appendix B

Illustrative Examples
  • Example (m = 2, n = 3): C 3 2 = 12 quadrangulations of an 8-gon.
  • Example (m = 3, n = 2): C 2 3 = 4 pentangulations of an 8-gon.
    Example for m   =   2
    Here C 3 2 = 1 7 9 3 = 12 . The objects correspond to decompositions of a convex 8-gon into quadrilaterals.
    m-Dyck path: e.g., U   U   U   U   U   U   D   D   D .
    Tree representation: a ternary rooted tree with three internal nodes.
    An example quadrangulation of an 8-gon corresponding to the case m = 2 and example pentangulation of an 8-gon corresponding to the case m = 3 are shown in Figure A1a,b.
Figure A1. (a) Quadrangulation of an 8-gon for m = 2 . (b) Pentangulation of an 8-gon for m = 3 .
Figure A1. (a) Quadrangulation of an 8-gon for m = 2 . (b) Pentangulation of an 8-gon for m = 3 .
Mathematics 13 03837 g0a1
Example for   m   =   3
For n = 2 , we have C 2 3 = 1 7 8 2 = 4 . These represent decompositions of an octagon into pentagons. Each configuration corresponds to a rooted 4-ary tree with two internal nodes.

References

  1. Saračević, M.; Selimi, A. Convex polygon triangulation based on planted trivalent binary tree and ballot problem. Turk. J. Electr. Eng. Comput. Sci. 2019, 27, 346–361. [Google Scholar] [CrossRef]
  2. Pilaud, V.; Santos, F.; Ziegler, G.M. Celebrating Loday’s associahedron. Arch. Math. 2023, 121, 559–601. [Google Scholar] [CrossRef]
  3. Firoozi, F.; Jedwab, J.; Rattan, A. Combinatorial enumeration of lattice paths by flaws with respect to a linear boundary of rational slope. arXiv 2024, arXiv:2406.09590. [Google Scholar] [CrossRef]
  4. The Catalan Connection. Springer eBooks; Springer Nature: Cham, Switzerland, 2007; p. 289. [Google Scholar] [CrossRef]
  5. Kaibel, V.; Ziegler, G.M. Counting lattice triangulations. In Cambridge University Press eBooks; Cambridge University Press: Cambridge, UK, 2003; p. 277. [Google Scholar] [CrossRef]
  6. Dumitrescu, A.; Gärtner, B.; Pedroni, S.; Welzl, E. Enumerating triangulation paths. Comput. Geom. 2001, 20, 3–12. [Google Scholar] [CrossRef]
  7. Aleardi, L.C.; Devillers, O. Explicit Array-Based Compact Data Structures for Triangulations. In Lecture Notes in Computer Science; Springer Science+Business Media: Berlin/Heidelberg, Germany, 2011; p. 312. [Google Scholar] [CrossRef]
  8. Lee, E.; Masuda, M.; Park, S. Toric Richardson varieties of Catalan type and Wedderburn–Etherington numbers. Eur. J. Comb. 2022, 108, 103617. [Google Scholar] [CrossRef]
  9. Acharya, R.C.; Mütze, T.; Verciani, F. Flips in colorful triangulations. arXiv 2024, arXiv:2406.03783. [Google Scholar] [CrossRef]
  10. Jönsson, J. Generalized triangulations and diagonal-free subsets of stack polyominoes. J. Comb. Theory Ser. A 2005, 112, 117–142. [Google Scholar] [CrossRef]
  11. Stanley, R.P. Catalan Numbers, 1st ed.; Cambridge University Press: Cambridge, UK, 2015. [Google Scholar]
  12. Armstrong, D.; Rhoades, B.; Williams, N. Rational Catalan Combinatorics: The Associahedron. In Discrete Mathematics & Theoretical Computer Science, Proceedings of the 25th International Conference on Formal Power Series and Algebraic Combinatorics (FPSAC 2013), Paris, France, 24–28 June 2013; Discrete Mathematics and Theoretical Computer Science (DMTCS): Nancy, France, 2013. [Google Scholar] [CrossRef]
  13. Hurtado, F.; Noy, M. Counting triangulations of almost-convex polygons. Comput. Geom. 1999, 13, 219–229. [Google Scholar]
  14. Epstein, P.; Sack, J.-R. Generating triangulations at random. In Proceedings of the Fourth Canadian Conference on Computational Geometry, St. John’s, NL, Canada, 10–14 August 1992; pp. 305–310. [Google Scholar]
  15. Barcucci, E.; Del Lungo, A.; Pergola, E. Random generation of trees and other combinatorial objects. Theor. Comput. Sci. 1999, 218, 219–232. [Google Scholar] [CrossRef]
  16. Stanley, R.P. Enumerative Combinatorics, 1st ed.; Cambridge University Press: Cambridge, UK, 2011; Volume 2. [Google Scholar]
  17. Lyapin, A.P.; Chandragiri, S. The Cauchy Problem for Multidimensional Difference Equations in Lattice Cones. J. Sib. Fed. Univ. Math. Phys. 2020, 13, 187–196. [Google Scholar] [CrossRef]
  18. Fusy, É. New bijective links on planar maps via orientations. Eur. J. Comb. 2010, 31, 145–160. [Google Scholar] [CrossRef][Green Version]
  19. Chapoton, F. Enumerative properties of generalized associahedra. Sémin. Lothar. Comb. 2006, 55, B55b. [Google Scholar]
  20. Bernardi, O.; Fusy, É. Unified bijections for maps with prescribed degrees and girth. J. Comb. Theory Ser. A 2012, 119, 1351–1387. [Google Scholar] [CrossRef]
  21. Pallo, J.M. Enumeration of polygon dissections. Theor. Comput. Sci. 2000, 233, 147–182. [Google Scholar]
  22. Aichholzer, O.; Mulzer, W.; Pilz, A. Flip Distance Between Triangulations of a Simple Polygon is NP-Complete. Discret. Comput. Geom. 2015, 54, 368–389. [Google Scholar] [CrossRef]
  23. Kirkpatrick, D.; Klawe, M.; Tarjan, R.E. Polygon triangulation in O(logn) time with simple data structures. Discret. Comput. Geom. 1992, 7, 329. [Google Scholar] [CrossRef]
  24. Krtolica, P.; Stanimirović, P.S.; Stojanović, I. An Alternative Decomposition of Catalan Number. Facta Univ. Ser. Math. Inform. 2018, 33, 63–77. [Google Scholar] [CrossRef]
  25. Poulalhon, D.; Schaeffer, G. Optimal Coding and Sampling of Triangulations. Algorithmica 2006, 46, 505–527. [Google Scholar] [CrossRef]
  26. Svihla, S.S.; Lladser, M.E. Sparsification of Phylogenetic Covariance Matrices of k-Regular Trees. arXiv 2024, arXiv:2405.17847. [Google Scholar] [CrossRef]
  27. Merlini, D.; Sprugnoli, R.; Verri, M.C. Some statistics on Dyck paths. J. Stat. Plan. Inference 2002, 101, 211–227. [Google Scholar] [CrossRef]
  28. Prodinger, H. On k-Dyck Paths with a Negative Boundary. J. Comb. Math. Comb. Comput. 2024, 119, 3–12. [Google Scholar] [CrossRef]
  29. Sabri, A.; Vajnovszki, V. On the exhaustive generation of generalized ballot sequences in lexicographic and Gray code order. Pure Math. Appl. 2019, 28, 109–119. [Google Scholar] [CrossRef]
  30. Merino, A.; Mütze, T. Combinatorial Generation via Permutation Languages. III. Rectangulations. Discret. Comput. Geom. 2022, 70, 51–122. [Google Scholar] [CrossRef]
Figure 1. Runtime comparison: Algorithms 1–3 vs. Hurtado–Noy method.
Figure 1. Runtime comparison: Algorithms 1–3 vs. Hurtado–Noy method.
Mathematics 13 03837 g001
Figure 2. Memory comparison for Algorithms 1–3 and Hurtado–Noy method.
Figure 2. Memory comparison for Algorithms 1–3 and Hurtado–Noy method.
Mathematics 13 03837 g002
Table 1. Complexity Comparison of Algorithms for Generating and Converting m Dyck Paths and ( m + 2 ) angulations.
Table 1. Complexity Comparison of Algorithms for Generating and Converting m Dyck Paths and ( m + 2 ) angulations.
AlgorithmsInput SizeTime ComplexitySpace ComplexityExplanation
Ballot-to-Angulation (Algorithm 1)m-Dyck word of length (m + 1)n; polygon with
N = mn + 2 vertices
O N O N Processes each symbol once; each D-step closes exactly one face; stack ≤ mn; output diagonals Θ N .
Angulation-to-Ballot (Algorithm 2)(m + 2)-angulation with (N = mn + 2) vertices O N O N Preorder traversal of the dual (m + 1)-ary tree visits each internal node once.
Tree-Based Generation (Algorithm 3) Total   outputs = C n m Θ C m n   per   output ,   Θ 1 amortized per output O N Each extension of the tree requires constant work; writing each angulation costs Θ N .
Hurtado–Noy Method (m + 2)-angulations Θ N 2 per output O N Rotation/flip operations require repeated validity checks and structural updates; known to be superlinear for m > 1.
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Share and Cite

MDPI and ACS Style

Selim, A.; Saracevic, M.; Stosic, L.; Aydin, O.; Zajmović, M. Bidirectional Algorithms for Polygon Triangulations and (m + 2)-Angulations via Fuss–Catalan Numbers. Mathematics 2025, 13, 3837. https://doi.org/10.3390/math13233837

AMA Style

Selim A, Saracevic M, Stosic L, Aydin O, Zajmović M. Bidirectional Algorithms for Polygon Triangulations and (m + 2)-Angulations via Fuss–Catalan Numbers. Mathematics. 2025; 13(23):3837. https://doi.org/10.3390/math13233837

Chicago/Turabian Style

Selim, Aybeyan, Muzafer Saracevic, Lazar Stosic, Omer Aydin, and Mahir Zajmović. 2025. "Bidirectional Algorithms for Polygon Triangulations and (m + 2)-Angulations via Fuss–Catalan Numbers" Mathematics 13, no. 23: 3837. https://doi.org/10.3390/math13233837

APA Style

Selim, A., Saracevic, M., Stosic, L., Aydin, O., & Zajmović, M. (2025). Bidirectional Algorithms for Polygon Triangulations and (m + 2)-Angulations via Fuss–Catalan Numbers. Mathematics, 13(23), 3837. https://doi.org/10.3390/math13233837

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop