"Мы шли по парку" - in certain direction, to some certain place
"Мы ходили по парку" - over and back, just walked without aim

the same with the dog:

"Собака бежала по двору" - in certain...