Characterizing and Recognizing Path Graphs and Directed Path