Local alignment finds the best matching subregion instead of forcing the full sequences to align end to end.
highlighted = computed this step
Local alignment clamps negatives to zero
Local alignment resets any negative cell to 0. That lets a bad prefix disappear instead of forcing the full sequences into an end-to-end alignment.
cell=max(0,diag,up,left)
Traceback starts at the highest cell
Instead of starting at the corner, local traceback starts at the highest cell and stops when the score returns to 0. Here the shared region AAGG aligns with AAGG and scores 4.
local score=4
Local alignment models a matching subregion
Local versus global is a modelling choice, not a universal truth. Use local alignment when only a region is expected to match, and use global alignment when the full sequences should align.