shortest path in tree