Question:
Let $G=(V_n,E_n)$ such that:
- G's vertices are words over $\sigma=\{a,b,c,d\}$ with length of $n$, such that there aren't two adjacent equal chars.
- An edge is defined to be between two vertices that are different by only one char.
A. Does the graph contain an Euler cycle?
- Find a pattern.
B. Does the graph contain a Hamiltonian cycle
- This can be proven by induction.
$Solution.A.$
Now, when $n=1$, we have 4 vertices: $$v_1= \ 'a'$$ $$v_2= \ 'b'$$ $$v_3= \ 'c'$$ $$v_4= \ 'd'$$
Therefore, for each $v\in \{v_1,v_2,v_3,v_4\}$, $N(v)=\{v_1,v_2,v_3,v_4\}/ \{v\}$ so we get that their degree is 3, so by a theorem we get that there isn't an Euler cycle.
In addition, when $n=4$, considering the string $"abad"$ we have 2 options to replace the edges of the string. In order to replace the second char we have 2 options, replacing it by $'c'$ and $'d'$. For the third char, we can replace it only by $'c'$. In total, we got 7 edges with this vertex, so by a theorem, we get that there isn't an Euler cycle.
I cannot find here a pattern, because if we take a look at $n=2$ we get an Euler cycle.
$Solution.B.$
First, we examine whether each vertex has at least $\frac{n}{2}$ neighbors. Hence, we should take the vertex to have the least number of neighbors. This vertex should be the string with disjoint chars. i.e. the string "abcd" when $n=4$. The first and last chars has always 2 neighbors, so we get that the least degree is: $$2+2+\binom{n-2}{n-3} \cdotp 1=4+n-2=n+2\geq \frac{n}{2}$$
Thus, we get that the graph always has a Hamiltonian cycle.
I don't get why I didn't get a pattern in $A$, and how $B$ can be proven by induction. In addition, is my answer correct?
Your solution B doesn't work. The graph $G_n$ has $4\cdot3^n$ vertices rather than $n$ vertices, so you'd need to show each vertex had $4\cdot 3^n/2$ vertices to apply Dirac's theorem.