Tree traversals and Dijkstras