match the algorithm for navigation to the one for the hierarchy