I am currently reading about graph theory and came across something that confused me.
Say we have a walk between vertices $x$ and $y$. If vertex $x$ does not equal to vertex $y$ then it is called a path. However, if $x = y$ then it is called a cycle.
What confused me is that there are at least three distinct edge to form a cycle. I understand that it is the case for undirected graph, but why is it also the case for a directed graph. Can't we have $2$ edges to form a cycle?
For example, lets say we have a directed graph with vertices $x,y$ and edges $x\to y$ and $y \to x$. Doesn't this graph form a cycle ?
Best Answer
To tack on to Fuseques' answer that highlights the distinction for simple graphs.
Be a little bit careful with your definitions.
A walk between $2$ vertices $x$ and $y$, commonly referred to as an $xy$-walk, is a sequence of vertices (or vertices and edges, but naming the edges is not necessary) that we can traverse to get from $x$ to $y$. Note that in a walk, edges and vertices can repeat.
A trail is a walk that does not repeat an edge.
A path is a walk that does not repeat vertices (and thus does not repeat edges).
Now some may fuzz this definition a bit to say that that we can have a closed path in order to define cycles. You can see the differences in the way cycles are defined at Wolfram MathWorld and Wikipedia.
A closed walk, i.e. an $xx$-walk is not necessarily a cycle, but a cycle is a closed walk. (See Misha Lavrov's comment).
An example:
A walk (in this case closed) would be $1-2-3-4-5-2-3-4-5-2-1$.
A trail would be $1-2-3-4-5-2$.
A path would be $4-3-2-1-6-9-8$.