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

\(GraphPow[a_Graph, t_] := 
      Module[{powfile, i}, 
        powfile = {}; 
For[i = 0, i < t, \(i++\), 
          powfile = 
            Append[powfile, 
Graphics[{
Rectangle[{0, 0}, \ {0.8, \ 
                      1.0}, \ 
ShowGraph[
Highlight[
                        RemoveSelfLoops[
                          GraphPower[a, i]], 
{Flatten[
                            ConnectedComponents[a]], 
Edges[
                            RemoveSelfLoops[
                              GraphDifference[GraphPower[a, i], 
                                GraphPower[a, 
                                  i - 1]]]], 
Edges[
                            RemoveSelfLoops[
                              GraphDifference[GraphPower[a, i - 1], 
                                GraphPower[a, 
                                  i - 2]]]], 
Edges[
                            RemoveSelfLoops[
                              GraphDifference[GraphPower[a, i - 2], 
                                GraphPower[a, 
                                  i - 3]]]], 
Edges[
                            a]}, 
{
ImageSize -> 
                            330, 
HighlightedEdgeColors -> {Orange, \ Red, \ Blue, \ 
                              Green}, 
HighlightedEdgeStyle -> Thick, 
HighlightedVertexStyle -> 
                            Disk[Normal], \ 
HighlightedVertexColors -> {Yellow}, 
PlotLabel -> "Transitive Closure by Graph Powering", \ 
TextStyle -> {FontSize -> 12, 
                              FontColor -> 
                                Purple}}
], \ 
                      Graphics
]
], 
Text["www.combinatorica.com", \ {0.5, \ 
                      0}, \ {TextStyle -> {FontColor -> 
                            Red}}]\ }, 
{AspectRatio -> 1, ImageSize -> 
                    350}
]
]]; 
powfile
]\)

ShowGraph[
      g = SpringEmbedding[
          CircularEmbedding[
            Contract[
              Contract[GraphUnion[3, Path[11]], {1, 12}], {1, 
                21}]]]]

ShowAnimation[GraphPow[g, 30]]