Okay.
I've been using dijkstra algorithm for marking all possible shortest paths.
Each grid cell may have number of "vectors" which shows direction to the next cell of shortest path, though at the end all of these alternatives eventually will get to "start" point.
First case is most difficult. There are 2 alternative ways, which are absolutely equal in TUs cost. Final point (at the bottom of 1st grid) have 4 (FOUR) alternative ways out, so making optimized paths would be quite difficult.
Second case also have two alternatives, which seems to be quite okay, but actually it's not that easy. Final point at the right of the grid. So there are 2 ways - above horizontal bar, or below it. Which of it will be most straight? I think below one, because initial walk vector will be closest to vector to the target point.
Optimizing those "equal areas" to straight line is not hard. You just need to look through all cells (from the closest) which have only ONE direction, until bresenham line (LOF) is possible.