Gidgiddoni knows that the Gadiantons were attempting to flee north, and he cuts off their retreat. Because he is in the land Bountiful, Gidgiddoni controls the narrow neck that leads into the land northward. Thus, the geography helped Gidgiddoni prevent Zemnarihah from simply marching around the Nephite defending armies.
Gidgiddoni manages to get troops both in front and behind Zemnarihah’s army. Therefore, they were in an untenable position, and many died before they realized that they were defeated and had to surrender.