22. Introduction to Algorithm Animation

Definition of Algorithm Animation

An algorithm animation allows to visualize the behavior of an algorithm. Although algorithm animations have mostly been used in computer science, potential applications in other scientific domains as, e.g., mathematics, economics, etc., abound. An algorithm animation creates an abstraction of both the data and the operations of the algorithm. First it maps the data (the current "state" of the algorithm, i.e., the current values of the variables used in the algorithm) into an image, which then gets animated based on the operations between two succeeding states in the execution of the algorithm. Animating an algorithm allows for better understanding of the inner workings of the algorithm, furthermore it makes apparent its shortcomings and advantages thus allowing for further optimization.

Definition of Algorithm Animation System

An algorithm animation system is composed of an integrated set of multimedia tools (such as graphics, animation, text, video, code, etc.) that simulate how the algorithm works using abstractions of the data, operations, and semantics of the program behind the algorithm. Algorithm animation may involve views that have no direct correspondence to the algorithm's data or execution.

http://hcrl.open.ac.uk/jvlc/JVLC-Body.html

Price, Baecker and Small [Pri93] distinguish in their survey paper "A Principled Taxonomy of Software Visualization" between program visualization (the use of various visualization techniques to enhance the human understanding of the actual implementation of computer programs), and algorithm animation (a visualization of the high-level concept or algorithm that is latter implemented in software). Collectively, they define both of them to be part of software visualization, which is the "use of the crafts of typography, graphic design, animation, and cinematography with modern human-computer interaction technology to facilitate both the human understanding and effective use of computer software".

There are various well-known efforts to develop algorithm animation systems, starting as early as in the late sixties and early seventies [Bae69]. One of the most famous systems is Balsa-II [Bro88; Bro88a]. Balsa-II is a standalone system based on a kernel running on Macintoshes. Views for new algorithms are constructed in Pascal using an animation library. The algorithm is also specified in Pascal. Synchronization between the algorithm and the view is achieved by adding interesting events that trigger an action in the animation.


Figure II.1 Balsa screen dump illustrating Dijkstra's shortest path algorithm

http://www.research.digital.com/SRC/zeus/ home.html

Marc Brown has also completed a successor to Balsa-II called Zeus [Bro91] in the DEC systems research lab in Palo Alto, where he has investigated the use of color and sound for algorithm animation [Bro91a; Bro91b]. Zeus runs on special multiprocessor machines and has been used to animate a variety of algorithms for teaching and research purposes.


Figure II.2 Screen dump of Zeus heapsort animation (http://www.research.digital.com/SRC/zeus/heapsort3D.4.gif)

http://www.cc.gatech.edu/gvu/softviz/algoanim/algoanim.html

John Stasko [Sta89; Stas90] implemented a system called TANGO (short for "Transition based ANimation GeneratiOn") that can be used to create algorithm animations. In newer versions of his system his emphasis is on developing animations integrating three-dimensional views of data and on the integration of direct manipulation programming techniques into the animation development [Sta91]. Extend versions of XTango named Polka are currently being developed at Georgia Tech.


Figure II.3 Screen dump of XTango first-fit binpacking animation
(http://www.cc. gatech.edu/gvu/ softviz/algoanim/ bpack.gif)

http://swarm.cs.wustl.edu/pavane.html

Gruia-Catalin Roman and his concurrent systems group at Washington University in St. Louis are developing a system called Pavane [Cox94]. Visualizations in Pavane are specified abstractly, as a mapping from computational states to images on the screen. This declarative approach is favored by the Pavane team because visualizations can be specified and modified more easily and because visualization is decoupled from the program code. A similar approach had already been pursued by Duisberg about ten years ago based on temporal constraints [Dui86].


Figure II.4 Screen dump of Pavane quicksort animation
(http://swarm.cs.wustl.edu/vislab/gallery/pics/quicksort2.Gif)

Another animation system is Anim by Jon Bentley and Brian Kernighan [Ben91]. Anim is used at Bell Labs, running under UNIX and X windows, to produce simple program animations. Contrary to Balsa-II, XTango, and Animated Algorithms, Anim is not interactive, but more like a "...Camcorder and VCR..." [Ben91]. Anim's advantages lie in the wide availability of the underlying hard and software and in its reliance on general purpose UNIX tools like AWK [Aho88]. In this aspect, it is similar to Animated Algorithms that relies on the HyperCard runtime environment. But Anim has disadvantages in that it is not interactive, it's user interface is relatively crude and it demands an experienced UNIX programmer to do more than just run the movies.

Compared to the aforementioned algorithm animation systems, Animated Algorithms which will be introduced in the next chapter uses far less expensive hardware and less sophisticated software. It is less a vehicle for research than a generally usable hypermedia learning environment allowing the teacher to quickly develop new animations of well-known algorithms using a simple but powerful scripting language. The student gets an interactive system affording intimate exploration of the runtime behavior of algorithms unobtainable with more conventional means. Animated Algorithm exhibits some unique features in that (1) is based on a general purpose runtime environment like HyperCard, (2) covers a broad range of computer science algorithms with an easy to use interface and (3) is interactive.