Length of shortest walk always equal to length of shortest path in an undirected graph

discrete mathematicsgraph theory

My discrete mathematics course text defines the distance between two nodes $u$ and $v$ in an undirected graph $\mathcal{G}$ as the length of the shortest walk between $u$ and $v$. A path was defined as a walk in which all edges are different.

When looking up other definitions I found that they all appear to define distance in terms of the shortest path between two nodes.

My question, as I cannot think of any counterexample where the length of the shortest walk is different from that of the shortest path:

Why might distance be defined here in terms of the shortest walk instead of the shortest path?

Best Answer

The two definitions are equivalent, because for every walk between $u$ and $v$, there exists a path between $u$ and $v$, and the length of the path is equal to or smaller than the length of the walk.

Related Question