Converts a tree data structure into an enumerable list for easy traversal