function InOrder = InOrderAlg(ChildrenList)
% InOrder = InOrderAlg(ChildrenList)
InOrder = InOrderRecursiveAlg(ChildrenList,[]);
function InOrder = InOrderRecursiveAlg(ChildrenList,InOrder)
%InOrder = InOrderRecursiveAlg(ChildrenList,InOrder)
%Input: ChildrenList: m + 1 column matrix (of integers) for an m-ary tree
%Output: InOrder: a vector containing the inorder list of the vertices
if nnz(ChildrenList)== 1 %tree consists only of root
InOrder = [InOrder ChildrenList(1,1)];
end
if nnz(ChildrenList)> 1 %root has children
ChildChildrenLists = ChildTrees(ChildrenList);
InOrder = InOrderRecursiveAlg(ChildChildrenLists(:,:,1),InOrder);
InOrder = [InOrder ChildrenList(1,1)];
[r c s] = size(ChildChildrenLists); % s = number of children trees
for i = 2:s
InOrder = InOrderRecursiveAlg(ChildChildrenLists(:,:,i),InOrder);
end
end