In this paper we present an algorithm that generates k-noncrossing,
σ-modular diagrams with uniform probability. A diagram is a labeled
graph of degree ≤1 over n vertices drawn in a horizontal line with arcs
(i,j) in the upper half-plane. A k-crossing in a diagram is a set of k
distinct arcs (i1,j1),(i2,j2),…,(ik,jk) with the property $i_1
< i_2 < \ldots < i_k < j_1 < j_2 < \ldots< j_k.Adiagramwithoutanyk−crossingsiscalledak−noncrossingdiagramandastackoflength\sigmaisamaximalsequence((i,j),(i+1,j-1),\dots,(i+(\sigma-1),j-(\sigma-1))).Adiagramis\sigma−modularifanyarciscontainedinastackoflengthatleast\sigma.OuralgorithmgeneratesafterO(n^k)preprocessingtime,k−noncrossing,\sigma−modulardiagramsinO(n)$ time and space
complexity.