The following is a problem of "Digital image processing" book.
Consider two points $p$ and $q$. State the condition(s) under which the $D_4$ distance between $p$ and $q$ is equal to the shortest 4-path between these points.
And the following is the solution in "solution manual"
This occurs whenever we can get from $p$ to $q$ by following a path whose elements (1) are from V, and (2) are arranged in such a way that we can traverse the path from $p$ to $q$ by making turns in at most two directions (e.g., right and up). [The black path in the following figure.]
But I don't understand why other "right angle" paths, such as the red one in the following figure, are not the solution. Why there must be at most only two directions?
P.S. For pixels $p$ and $q$ with coordinate $(x, y)$ and $(s, t)$, respectively, the $D_4$ distance is as $|x-s| + |y - t|$.