0

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 ?

Hendrix
  • 1,466
  • 1
  • 11
  • 20
Kbiir
  • 325
  • 5
  • 14

2 Answers2

2

To tack on to Fuseques' answer that highlights the distinction for simple graphs.

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.

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: An example graph.

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$.

Hendrix
  • 1,466
  • 1
  • 11
  • 20
  • 1
    In an undirected graph, a closed walk only implies the existence of a cycle if it does not take the same edge twice. (There's probably a term for such closed walks, but I forget it.) Otherwise, for any edge $xy$, $x - y - x$ is a closed walk, whether or not cycles exist. – Misha Lavrov Oct 26 '19 at 20:12
  • @MishaLavrov Ah, you are totally right. I have edited accordingly. Many thanks! – Hendrix Oct 26 '19 at 20:15
  • 1
    @MishaLavrov A closed walk with no repeated edges is traditionally called a circuit. See https://math.stackexchange.com/questions/655589/what-is-difference-between-cycle-path-and-circuit-in-graph-theory –  Oct 27 '19 at 19:21
1

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

It is not the case for undirected graphs, it is the case for simple undirected graphs (and also for simple directed graphs for that matter), where multiple edges between two vertices are not allowed, and neither do edges between vertices to themselves.

In a directed\undirected graph that is not simple, you can have a cycle formed with two edges between two vertices, and even a single edge cycle formed by an edge from a vertex to itself (also called a "loop").

Carpet4
  • 516