PathGraphQ
PathGraphQ[g] yields True if the graph g is a path and False otherwise.
Examples
PathGraphQ[PathGraph[{1, 2, 3, 4}]]
(* True *)PathGraphQ[CycleGraph[4]]
(* False *)Something isn't working? Report an issue.
Please visit the official Wolfram Language Reference for more details.