What is a path in a graph, and when is it simple?
A path is an alternating sequence of vertices and edges that starts and ends with a vertex, each edge joining the vertex before it to the one after it. It is simple if all its vertices and edges are distinct: P1 = (V, b, X, h, Z) is simple; P2 = (U, c, W, e, X, g, Y, f, W, d, V) is not, because it visits W twice.
* P2 runs around the loop W, X, Y, W before it continues to V. *
The edges are part of the sequence because there may be parallel edges: (X, h, Z) and (X, i, Z) are two different paths. In a simple graph the vertices alone already determine the path. The length of a path is its number of edges: P1 has length 2.
A path that is not simple can always be shortened to a simple one between the same two ends: cut out everything between the two visits of the repeated vertex. P2 without its detour (W, e, X, g, Y, f, W) becomes (U, c, W, d, V), a simple path from U to V. So whenever two vertices are joined by some path, they are also joined by a simple one.
Books differ in their words here: many graph-theory texts call a sequence that may repeat vertices a walk and reserve path for what is called a simple path here. Keep that in mind when you look things up.
Go deeper:
Path (graph theory) โ walks, trails and paths, and the terms for their lengths and ends.