it is not a binary tree.. each parent could has the same number of children but not necessarily 2 children. Each path means the set of nodes from the root to a leaf.. so each row in the array should contain the set of nodes from the root to one leaf
If the full tree is a complete tree (every level, except possibly the last, is completely filled, and all nodes in the last level are as far left as possible), a one dimensional array representation is possible. For the complete 3-ary tree above:
Compute the depth D of the n-ary tree.
The two dimensional matrix representation will have D columns.
Perform a traversal (say a postorder traversal) of the n-ary tree. During the traversal,
a. Push each node encountered onto a stack. (the first node pushed would be the root).
b. If the node is a leaf node:
Add the entire contents of the stack as a row of the 2D array.
If the size of the stack is less than [b]D[/b], add a [b]null[/b] at the end.
(with a complete n-ary tree, more than one [b]null[/b] will never be required.)
Move down to the next level, processing each of the [b]n[/b] children one by one.
c. Pop the node just visited off the stack, move up one level and continue with the traversal.