The Messenger of Allah (sal Allahu alaihi wa sallam) said: “Allah makes the way to the Garden easy for whoever treads a path in search of knowledge.” [Muslim]
Traveling on the path to knowledge refers both to walking along an actual pathway, such as going on foot to the assemblies of the Ulama, as well as to following a metaphysical road, such as studying and memorizing.
This Hadith also alludes to the road leading to the Garden on the Day of Judgment, which is the straight path.