This confusion is caused by the different notions of problem: there are "decision" problems and "functional" problems. What grandparent asked ("what is the shortest path?") is a functional problem in nature, whereas P & NP are classes of decision problems. A (more or less) equivalent decision problem version of above question would be "is there a path of length at most X?", which then is of course easy to verify if a potential solution is presented.