Need a counter example for cycle in a graph

Could anyone give a counter example for that theorem :

A graph G has exactly one vertex of degree $1$, then it contains a cycle.

I am so confused. I wonder that may I give a counter example which considers trees.


Solution 1:

The counter example does not exist.

Let $v_1$ be a vertex of $G$ with degree $1$. Then, let $v_2$ be its neighbor. Because the degree of $v_2$ is more than $1$, $v_2$ has a neighbor that is not $v_1$. Let that neighbor be $v_3$.

Now, $v_3$ has a neighbor that is not $v_2$ (because the degree of $v_3$ is at least $2$) and is not $v_1$ (because $v_1$ has degree $1$). Let that neighbor be $v_4$.

Now, $v_4$ has a neighbor that is not $v_3$ or $v_1$. If the neighbor is $v_2$, then $v_2,v_3,v_4$ is a cycle. Otherwise the neighbor is $v_5$ and repeat until a cycle is found.

Solution 2:

If you allow infinite graphs, then the set of natural numbers $\mathbb{N}=\{0,1,2,3,\ldots\}$ with consecutive numbers considered adjacent is a counterexample: the vertex $0$ has degree $1$, while all others have degree $2$, but the graph contains no cycles.