computePath: stop traversing after root has been found