26.2 Structure-Based Algorithm Animation

In most systems, algorithm animators define a view that is suited for a certain class of algorithms. They then adapt the view for each particular algorithm of this class, but try to keep the individual adaptations as small as possible. In the following discussion this approach is called unified view-based . We have selected for Animated Algorithms a slightly different approach that we call structure-based. Our approach stresses the particularities of each algorithm and tries to emphasize its main points.

Each of the two types has advantages:

Unified view-based animation:
The animator tries to animate different, but related algorithms in a similar way by using generic views. This approach has two main advantages: (1) The algorithm animator is more productive because, once the animation view has been established for the first algorithm, the view can easily be adapted to accomplish the other related algorithms. (2) The behavior of related algorithms can be compared more easily because of the common base.
Structure-based animation:
With this approach the animation for each algorithm is developed from scratch. It takes more effort to animate algorithms this way because the algorithm has to be understood thoroughly before a meaningful representation can be found. This approach emphasizes the particularities of an algorithm. Fortunately we were well supported in this task by Introduction to Algorithms [Cor90], which already contains excellent graphical representations of most of the algorithms.

Fig. II.26 illustrates our approach by comparing unified view-based with structure-based animated sorting algorithms. The unified view-based animated examples are from an earlier experiment in algorithm animation undertaken by L. Richter and the author at the University of Zurich [Glo89]. Obviously the unified view-based animated algorithms allow an easier comparative analysis of the different sorting algorithms. But we feel that it is well worth expending the additional effort for structure-based animations because they communicate much more information about the intrinsic working of the particular algorithm. To compare structurally animated algorithms some additional effort has to be made, but these comparisons are then much better tailored to the actual algorithm comparisons. For an example comparing algorithms see figure II.17 depicting an analytical comparison of sorting algorithms in Animated Algorithms.


Figure II.26 Unified view-based versus structure-based algorithm animation