It's not that simple.
The rules for the ghosts are different from Pac man.
Pac man can change directions at any time, while the ghosts can only make decisions at intersections, and cannot go backwards. When the ghosts get to an intersection, they only have 3 possible directions to go. Pac Man, on the other hand has 4 possible directions to go (including backwards), and can do this at any time, not just intersections.