layouttree - traverse function