I have a 2-D variable array.

Variables within each row have dependency, while variables across different rows are independent.

Each variable has categorical distribution. We also have a group of categorical distributions. The number of distributions is equal to the number of categories. Within each row, the distribution of v[i][j] is distribution[v[i][j-1]]. For each row i, v[i][0]
is not dependent on any other variables.

To apply such a dependence, switch and jagged array are involved.