Not if there are hills in between. But the delta between A and B is the best you can do, yes.

In addition, while the net elevation change is bounded by the delta, given the choices might be "go up this steep section" vs "go along this gentle incline", one route can be "flatter" between the same endpoints.