<< DiscreteMath`Combinatorica`
<< Graphics`Animation`

\(Ham[x_Graph]\  := \ 
      Module[{hamfile, \ data\  = \ x, \ el}, \ 
        hamList\  = \ HamiltonianCycle[x, \ 1]; \ 
        el\  = \ Partition[hamList, \ 2, \ 1]; \ 
        hamfile\  = \ 
          Table[
Graphics[\ {
Rectangle[\ {0, 0}, \ {0.8, \ 0.8}, 
ShowGraph[\ 
                    Highlight[\ 
                      x, \ {Take[el, \ Quotient[t, \ 2]], \ 
                        Take[hamList, \ 
                          Quotient[t, \ 2]\  + \ 
                            Mod[t, \ 
                              2]]}, \ {HighlightedEdgeColors\  -> \ {Blue}, \ 
                        HighlightedVertexColors\  -> \ {Yellow}, \ 
                        HighlightedVertexStyle\  -> \ Disk[Normal]}], \ 
                    PlotLabel\  -> \ "Hamiltonian Cycle", \ 
                    TextStyle\  -> \ {FontSize\  -> \ 15, \ 
                        FontColor -> Purple}, \ 
                    Graphics\ ]], 
\ 
                Text["www.combinatorica.com", \ {0.5, 
                    0.0}, \ {TextStyle -> {FontColor -> 
                          Red}}]\ }, 
{\ 
                ImageSize -> 350, \ 
                AspectRatio -> 1}
], \ {t, \ 1, \ 
              2*\((Length[hamList]\  - \ 1)\), \ 
              1}]; \ 
hamfile
]\)

ShowGraph[ a = BooleanAlgebra[5]]

ShowAnimation[Ham[a]]