We use a lookup table in our scheduling software to automate navigation. The logic is something like:
If [current show] = SpongeBob & [next show] = SpongeBob ==> place 'more SpongeBob after the break'
If [current show] = SpongeBob & [next show] = The Thundermans ==> place 'Thundermans next'
...and so on for every possible form of navigation for every show we currently air on the channel.
You can imagine: it's a pretty long table.