Actually they don't go by the same route in the books. Gandalf, Bilbo, and the Dwarves go by the Great East Road in the Hobbit.
In LOTR Aragorn avoids the road for fear of the Black Riders. He leads the Hobbits north of the road from Bree to Weathertop, south of the road from Weathertop to the Last Bridge over the River Hoarwell, and north of the road beyond the Last Bridge until they turn south to rejoin the road where it crosses the Loudwater at the Ford of Bruinein. They find the petrified trolls on the last turn south toward the road and talk about Biblo's adventure with the Trolls.
In the Hobbit the dwarves are camped by the road and the river and see the campfire of the Trolls to the north. In LOTR Aragorn & the Hobbits are travelling south after their detour to the north when they find the petrified Troll site.
There is a problem that the petrified Trolls and their cave seem to be much farther north of the road and the river in LOTR than in the Hobbit. This leads me to suppose that the course of the river moved to the south and the road was also moved to the south between the two stories.
But they definitely do pass though the area with the petrified Trolls in LOTR.