Difference w and w0

Could somebody please explain the difference between w and w0 in some of the functions of assignment 3.2? In calculate_optimal_path for example, it says ‚energy‘ up to (excluding) column ‚w‘ and ‚w0‘ states the width of the energy matrix ‚energy‘. Where’s the difference there? Aren’t both acting as the same boundary?

Also: what exactly do I have to store in the seam? Is it just the x-coordinate of each row from bottom to top or is it the elements index in the array (that I get via yx_index())? I got kind of confused there.