Task: Train your dog back home

A Virtual World:

Assume your dog is in a virtual world as a sample shown here. There are two different types of land-forms: river and ground. When the dog is crossing the river, there would be some delay of the time. The goal for the dog is to reach home ASAP.