On optimal tree traversals for sparse matrix factorization