# I wrote a code that animates an Eulerian cycle on a graph but something is missing

This code here

Euleriano[g_] :=
l = {FindEulerianCycle[g][[1]][[1]][[1]]} For[i = 1,
i < EdgeCount[g] + 1, i++,
AppendTo[l,
FindEulerianCycle[g][[1]][[i]][[2]]]] Block[{grafo = g, inizio,
cammino}, inizio = FindEulerianCycle[grafo][[1]][[1]][[1]];
cammino = l;
ListAnimate[
Table[Graph[grafo,
VertexStyle ->
Append[Map[Rule[#, Pink] &, Union[cammino[[1 ;; v]]]],
cammino[[v]] -> Red],
EdgeStyle ->
Evaluate[(UndirectedEdge[#1, #2] -> Directive[Red, Thick]) & @@@
Partition[cammino[[1 ;; v]], 2, 1]],
VertexSize -> Medium], {v, Length[cammino]}]]]


finds and animates an eulerian cycle on an input graph, provided it has one. The problem is this animation always misses the last edge of the cycle. How can I solve this? For clarification, cammino=path, inizio=start, grafo=graph.

After fixing some typo in your code. It seems to run fine to me:

This code here

Euleriano[g_] :=
(l = {FindEulerianCycle[g][[1]][[1]][[1]]}; For[i = 1,
i < EdgeCount[g] + 1, i++,
AppendTo[l,
FindEulerianCycle[g][[1]][[i]][[2]]]] Block[{grafo = g, inizio,
cammino}, inizio = FindEulerianCycle[grafo][[1]][[1]][[1]];
cammino = l;
ListAnimate[
Table[Graph[grafo,
VertexStyle ->
Append[Map[Rule[#, Pink] &, Union[cammino[[1 ;; v]]]],
cammino[[v]] -> Red],
EdgeStyle ->
Evaluate[(UndirectedEdge[#1, #2] -> Directive[Red, Thick]) & @@@
Partition[cammino[[1 ;; v]], 2, 1]],
VertexSize -> Medium], {v, Length[cammino]}]]])


You could also use Animate and HighlightGraph for simpler code:

AnimateEulerican[g_] :=
With[{l = First[FindEulerianCycle[g]]},
Animate[HighlightGraph[
g, {Style[Graph[l[[1 ;; n]]], Directive[Pink, Thick]],
Style[l[[n, 2]], Red]}, VertexSize -> {_ -> Medium}], {n, 1,
Length[l], 1}]]